Skip to content

Commit

Permalink
#235: clean
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 14, 2024
1 parent 25e2878 commit f26163f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eo-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.35.1
0.35.2
1 change: 1 addition & 0 deletions home-hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
130afdd1456a0cbafd52aee8d7bc612e1faac547
2 changes: 1 addition & 1 deletion src/commands/phi.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

const rel = require('relative');
const path = require('path');
const {gte} = require('../demand')
const {gte} = require('../demand');
const {mvnw, flags} = require('../mvnw');

/**
Expand Down
2 changes: 1 addition & 1 deletion src/commands/unphi.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const rel = require('relative');
const path = require('path');
const {mvnw, flags} = require('../mvnw');
const {gte} = require('../demand')
const {gte} = require('../demand');

/**
* Command to convert .PHI files into .XMIR files.
Expand Down
11 changes: 9 additions & 2 deletions src/demand.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ const semver = require('semver');

/**
* Only if provided version is the required one or younger.
*
* @param {String} subject - What is being checked
* @param {String} current - Current version
* @param {String} min - Minimal expected version
*/
module.exports.gte = function(subject, current, min) {
if (semver.lt(current, min)) {
console.error('%s is required to have version %s or higher, while you use %s', subject, min, current);
console.error(
'%s is required to have version %s or higher, while you use %s',
subject, min, current
);
process.exit(1);
}
}
};
4 changes: 3 additions & 1 deletion src/eoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ if (process.argv.includes('--latest')) {
console.debug('EO parser ' + parser + '; use the --latest flag if you need a freshier one');
}

const hash = fs.readFileSync(path.join(__dirname, '../home-hash.txt'), 'utf8');

const version = require('./version');
program
.name('eoc')
Expand All @@ -68,7 +70,7 @@ program
program
.option('-s, --sources <path>', 'Directory with .EO sources', '.')
.option('-t, --target <path>', 'Directory with all generated files', '.eoc')
.option('--hash <hex>', 'Hash in objectionary/home to compile against', parser)
.option('--hash <hex>', 'Hash in objectionary/home to compile against', hash)
.option('--parser <version>', 'Set the version of EO parser to use', parser)
.option('--latest', 'Use the latest parser version from Maven Central')
.option('--alone', 'Just run a single command without dependencies')
Expand Down
1 change: 1 addition & 0 deletions test/commands/test_dataize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {runSync, parserVersion, homeHash} = require('../helpers');

const versions = new Map([
[parserVersion, homeHash],
['0.35.1', '130afdd1456a0cbafd52aee8d7bc612e1faac547'],
['0.34.1', '1d605bd872f27494551e9dd2341b9413d0d96d89'],
]);
versions.forEach(function(hash, version) {
Expand Down
2 changes: 1 addition & 1 deletion test/commands/test_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('link', function() {
'+package foo.bar',
'+alias org.eolang.io.stdout',
'',
'# sample object'
'# sample object',
'[args] > link',
' stdout "Hello, world!" > @',
].join('\n')
Expand Down

0 comments on commit f26163f

Please sign in to comment.