Skip to content

Commit

Permalink
Rename Place.place to Place.name
Browse files Browse the repository at this point in the history
  • Loading branch information
tshemsedinov committed Jul 30, 2023
1 parent 6d22d39 commit cd4372e
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const { Procedure } = require('./procedure.js');
const { Place } = require('./place.js');

class Api extends Place {
constructor(place, application) {
super(place, application);
constructor(name, application) {
super(name, application);
this.collection = {};
this.signatures = {};
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cert.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { node, metarhia, wt } = require('./deps.js');
const { Static } = require('./static.js');

class Cert extends Static {
constructor(place, application, options = {}) {
super(place, application, options);
constructor(name, application, options = {}) {
super(name, application, options);
this.domains = new Map();
}

Expand Down
8 changes: 4 additions & 4 deletions lib/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const { Place } = require('./place.js');
const bus = require('./bus.js');

class Code extends Place {
constructor(place, application) {
super(place, application);
constructor(name, application) {
super(name, application);
this.tree = {};
}

Expand Down Expand Up @@ -55,12 +55,12 @@ class Code extends Place {

async change(filePath) {
if (!filePath.endsWith('.js')) return;
const { application, path, place } = this;
const { application, path, name } = this;
const options = { context: application.sandbox, filename: filePath };
try {
const { exports } = await metarhia.metavm.readScript(filePath, options);
const relPath = filePath.substring(path.length + 1);
const exp = place === 'bus' ? bus.prepare(exports, application) : exports;
const exp = name === 'bus' ? bus.prepare(exports, application) : exports;
this.set(relPath, exp);
} catch (error) {
if (error.code !== 'ENOENT') {
Expand Down
6 changes: 3 additions & 3 deletions lib/place.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const { node, metarhia } = require('./deps.js');

class Place {
constructor(place, application) {
this.place = place;
this.path = application.absolute(place);
constructor(name, application) {
this.name = name;
this.path = application.absolute(name);
this.application = application;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { node, metarhia } = require('./deps.js');
const { Place } = require('./place.js');

class Schemas extends Place {
constructor(place, application) {
super(place, application);
constructor(name, application) {
super(name, application);
this.model = null;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const WIN = process.platform === 'win32';
const MAX_FILE_SIZE = '10 mb';

class Static extends Place {
constructor(place, application, options = {}) {
super(place, application);
constructor(name, application, options = {}) {
super(name, application);
this.files = new Map();
this.ext = options.ext;
this.maxFileSize = -1;
Expand Down
2 changes: 1 addition & 1 deletion test/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const application = {

metatests.testAsync('lib/bus', async (test) => {
const bus = new Code('bus', application);
test.strictSame(bus.place, 'bus');
test.strictSame(bus.name, 'bus');
test.strictSame(bus.path, path.join(root, 'test/bus'));
test.strictSame(typeof bus.application, 'object');
test.strictSame(bus.tree, {});
Expand Down
2 changes: 1 addition & 1 deletion test/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ metatests.testAsync('lib/place', async (test) => {

const place = new EmptyPlace('lib', application);
await place.load();
test.strictSame(place.place, 'lib');
test.strictSame(place.name, 'lib');
test.strictSame(place.empty, true);
});
2 changes: 1 addition & 1 deletion test/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const application = {

metatests.testAsync('lib/code', async (test) => {
const code = new Code('lib', application);
test.strictSame(code.place, 'lib');
test.strictSame(code.name, 'lib');
test.strictSame(typeof code.path, 'string');
test.strictSame(typeof code.application, 'object');
test.strictSame(code.tree, {});
Expand Down

0 comments on commit cd4372e

Please sign in to comment.