eolang 0.7.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,13 @@
1
1
  <img alt="logo" src="https://www.objectionary.com/cactus.svg" height="92px" />
2
2
 
3
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
+ [![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)
5
+
3
6
  [![grunt](https://github.com/objectionary/eoc/actions/workflows/grunt.yml/badge.svg)](https://github.com/objectionary/eoc/actions/workflows/grunt.yml)
7
+ [![PDD status](http://www.0pdd.com/svg?name=objectionary/eoc)](http://www.0pdd.com/p?name=objectionary/eoc)
8
+ [![Hits-of-Code](https://hitsofcode.com/github/objectionary/eoc)](https://hitsofcode.com/view/github/objectionary/eoc)
9
+ ![Lines of code](https://img.shields.io/tokei/lines/github/objectionary/eoc)
10
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/eoc/blob/master/LICENSE.txt)
4
11
 
5
12
  First, you install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
6
13
  and [Java SE](https://www.oracle.com/java/technologies/downloads/).
@@ -38,8 +45,8 @@ You can also do many other things with `eoc` commands
38
45
  * `transpile` converts XMIR to target programming language (Java by default)
39
46
  * `compile` converts target language sources to binaries
40
47
  * `link` puts all binaries together into a single executable binary
41
- * `dataize` executes the binary and dataizes a single object
42
- * `test` executes all visible unit tests
48
+ * `dataize` dataizes a single object from the executable binary
49
+ * `test` dataizes all visible unit tests
43
50
 
44
51
  There are also commands that help manipulate with XMIR and EO sources (some of them are not implemented as of yet):
45
52
 
package/mvnw/pom.xml CHANGED
@@ -1,7 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- The MIT License (MIT)
4
-
5
3
  Copyright (c) 2022 Yegor Bugayenko
6
4
 
7
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eolang",
3
- "version": "0.7.0",
3
+ "version": "0.8.2",
4
4
  "author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
5
5
  "license": "MIT",
6
6
  "repository": "objectionary/eoc",
@@ -22,16 +22,16 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "colors": "1.4.0",
25
- "commander": "9.2.0",
26
- "fast-xml-parser": "4.0.0",
25
+ "commander": "9.4.0",
26
+ "fast-xml-parser": "4.0.9",
27
27
  "xmlhttprequest": "1.8.0"
28
28
  },
29
29
  "devDependencies": {
30
- "eslint": "5.15.3",
31
- "eslint-config-google": "0.12.0",
32
- "grunt": "^1.5.3",
33
- "grunt-contrib-clean": "2.0.0",
34
- "grunt-eslint": "21.0.0",
30
+ "eslint": "5.16.0",
31
+ "eslint-config-google": "0.14.0",
32
+ "grunt": "1.5.3",
33
+ "grunt-contrib-clean": "2.0.1",
34
+ "grunt-eslint": "21.1.0",
35
35
  "grunt-mocha-cli": "7.0.0",
36
36
  "mocha": "^10.0.0"
37
37
  },
package/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
@@ -33,7 +33,7 @@ const parserVersion = require('../parser-version');
33
33
  module.exports = function(opts) {
34
34
  mvnwSync([
35
35
  'eo:assemble',
36
- '-Deo.version=' + (opts.parserVersion ? opts.parserVersion : parserVersion()),
36
+ '-Deo.version=' + (opts.parser ? opts.parser : parserVersion()),
37
37
  opts.verbose ? '' : '--quiet',
38
38
  opts.trackOptimizationSteps ? '-Deo.trackOptimizationSteps' : '',
39
39
  opts.hash ? '-Deo.hash=' + opts.hash : '',
@@ -24,6 +24,7 @@
24
24
 
25
25
  const fs = require('fs');
26
26
  const path = require('path');
27
+ const os = require('os');
27
28
 
28
29
  /**
29
30
  * Deletes all temporary files.
@@ -33,4 +34,11 @@ module.exports = function(opts) {
33
34
  const home = path.resolve(opts.target);
34
35
  fs.rmSync(home, {recursive: true, force: true});
35
36
  console.info('The directory %s deleted', home);
37
+ if (opts.cached) {
38
+ const eo = path.join(os.homedir(), '.eo');
39
+ if (fs.existsSync(eo)) {
40
+ fs.rmSync(eo, {recursive: true});
41
+ console.info('The directory ~/.eo was deleted');
42
+ }
43
+ }
36
44
  };
@@ -0,0 +1,45 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022 Yegor Bugayenko
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included
14
+ * in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const path = require('path');
26
+ const mvnwSync = require('../mvnw');
27
+ const parserVersion = require('../parser-version');
28
+
29
+ /**
30
+ * Generate GMI files from XMIR.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function(opts) {
34
+ mvnwSync([
35
+ 'eo:gmi',
36
+ '-Deo.version=' + (opts.parser ? opts.parser : parserVersion()),
37
+ opts.verbose ? '' : '--quiet',
38
+ opts.gmiXml ? '-Deo.generateGmiXmlFiles' : '',
39
+ opts.gmiXembly ? '-Deo.generateXemblyFiles' : '',
40
+ opts.gmiGraph ? '-Deo.generateGraphFiles' : '',
41
+ opts.gmiDot ? '-Deo.generateDotFiles' : '',
42
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
43
+ ]);
44
+ console.info('GMI files generated in %s', path.resolve(opts.target));
45
+ };
@@ -34,7 +34,7 @@ module.exports = function(opts) {
34
34
  const foreign = path.resolve(opts.target, 'eo-foreign.json');
35
35
  mvnwSync([
36
36
  'eo:register',
37
- '-Deo.version=' + (opts.parserVersion ? opts.parserVersion : parserVersion()),
37
+ '-Deo.version=' + (opts.parser ? opts.parser : parserVersion()),
38
38
  opts.verbose ? '' : '--quiet',
39
39
  `-Deo.targetDir=${path.resolve(opts.target)}`,
40
40
  `-Deo.sourcesDir=${path.resolve(opts.sources)}`,
@@ -39,7 +39,7 @@ module.exports = function(opts) {
39
39
  }
40
40
  mvnwSync([
41
41
  'eo:transpile',
42
- '-Deo.version=' + (opts.parserVersion ? opts.parserVersion : parserVersion()),
42
+ '-Deo.version=' + (opts.parser ? opts.parser : parserVersion()),
43
43
  opts.verbose ? '' : '--quiet',
44
44
  `-Deo.targetDir=${path.resolve(opts.target)}`,
45
45
  `-Deo.generatedDir=${sources}`,
package/src/eoc.js CHANGED
@@ -28,6 +28,7 @@ const tinted = require('./tinted-console');
28
28
  const audit = require('./commands/audit');
29
29
  const clean = require('./commands/clean');
30
30
  const assemble = require('./commands/assemble');
31
+ const gmi = require('./commands/gmi');
31
32
  const register = require('./commands/register');
32
33
  const transpile = require('./commands/transpile');
33
34
  const compile = require('./commands/compile');
@@ -69,10 +70,12 @@ program.command('foreign')
69
70
  foreign(program.opts());
70
71
  });
71
72
 
72
- program.command('clean')
73
+ program
74
+ .command('clean')
75
+ .option('--cached', 'delete ~/.eo directory')
73
76
  .description('delete all temporary files')
74
77
  .action((str, opts) => {
75
- clean(program.opts());
78
+ clean({...program.opts(), ...str});
76
79
  });
77
80
 
78
81
  program.command('register')
@@ -90,6 +93,20 @@ program.command('assemble')
90
93
  assemble(program.opts());
91
94
  });
92
95
 
96
+ program.command('gmi')
97
+ .description('generate GMI files from XMIR')
98
+ .option('--gmi-xml', 'generate .gmi.xml files')
99
+ .option('--gmi-xembly', 'generate .gmi.xe files')
100
+ .option('--gmi-graph', 'generate .gmi.graph files')
101
+ .option('--gmi-dot', 'generate .gmi.dot files')
102
+ .action((str, opts) => {
103
+ if (program.opts().alone == undefined) {
104
+ register(program.opts());
105
+ assemble(program.opts());
106
+ }
107
+ gmi({...program.opts(), ...str});
108
+ });
109
+
93
110
  program.command('transpile')
94
111
  .description('convert EO files into target language')
95
112
  .action((str, opts) => {
package/src/mvnw.js CHANGED
@@ -25,6 +25,16 @@
25
25
  const path = require('path');
26
26
  const {spawnSync} = require('child_process');
27
27
 
28
+ /**
29
+ * The shell to use (depending on operating system).
30
+ * @return {String} Path to shell or "undefined" if default one should be used
31
+ */
32
+ function shell() {
33
+ if (process.platform == 'win32') {
34
+ return 'C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe';
35
+ }
36
+ }
37
+
28
38
  /**
29
39
  * Run mvnw with provided commands.
30
40
  * @param {Hash} args - All arguments to pass to it
@@ -48,13 +58,7 @@ module.exports = function(args) {
48
58
  {
49
59
  cwd: home,
50
60
  stdio: 'inherit',
51
- shell: (
52
- process.platform == 'win32'
53
- ?
54
- 'C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe'
55
- :
56
- undefined
57
- ),
61
+ shell: shell(),
58
62
  }
59
63
  );
60
64
  if (result.status != 0) {
package/src/version.js CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- module.exports = '0.7.0';
25
+ module.exports = '0.8.2';