Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
fix(template) Upgrade Concerto, Rename 'grammar' directory to 'text'
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <jeromesimeon@me.com>
  • Loading branch information
jeromesimeon committed Oct 23, 2019
1 parent ab4a563 commit d0cb228
Show file tree
Hide file tree
Showing 32 changed files with 62 additions and 51 deletions.
Binary file modified examples/helloworldcontract.zip
Binary file not shown.
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 29 additions & 18 deletions packages/ergo-cli/package.json
Expand Up @@ -2,10 +2,18 @@
"name": "@accordproject/ergo-cli",
"version": "0.20.0-beta.1",
"description": "Ergo CLI",
"repository": {
"type": "git",
"url": "https://github.com/accordproject/ergo"
"engines": {
"node": ">=8",
"npm": ">=3"
},
"publishConfig": {
"access": "public"
},
"bin": {
"ergo": "./index.js",
"ergotop": "./ergotop.js"
},
"main": "index.js",
"scripts": {
"pretest": "npm run lint",
"lint": "eslint .",
Expand All @@ -16,16 +24,23 @@
"test": "npm run test:mocha && npm run test:cucumber",
"test:cov": "nyc npm run test"
},
"contributors": [
{
"name": "Jerome Simeon",
"email": "jerome@clause.io"
}
"repository": {
"type": "git",
"url": "https://github.com/accordproject/ergo"
},
"keywords": [
"accord project",
"contracts",
"smart",
"legal",
"tech"
],
"author": "clause.io",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
"bugs": {
"url": "https://github.com/accordproject/cicero/issues"
},
"homepage": "https://www.accordproject.org/projects/ergo",
"dependencies": {
"@accordproject/ergo-compiler": "0.20.0-beta.1",
"@accordproject/ergo-engine": "0.20.0-beta.1",
Expand All @@ -36,10 +51,6 @@
"winston": "3.2.1",
"yargs": "13.2.4"
},
"bin": {
"ergo": "./index.js",
"ergotop": "./ergotop.js"
},
"devDependencies": {
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
Expand Down Expand Up @@ -83,10 +94,10 @@
"exclude": [],
"all": true,
"check-coverage": true,
"statements": 93,
"branches": 70,
"functions": 92,
"lines": 93
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
},
"gitHead": "bf65386e8590dff56f8b9bc0bb657263ff049437"
}
4 changes: 2 additions & 2 deletions packages/ergo-cli/test/commands.js
Expand Up @@ -216,7 +216,7 @@ describe('#draft', function () {
result.response.should.equal('\nThis is a fixed interest loan to the amount of <variable id="loanAmount" value="100000.0"/>\nat the yearly interest rate of <variable id="rate" value="2.5"/>%\nwith a loan term of <variable id="loanDuration" value="15"/>,\nand monthly payments of <computed value="667.0"/>\n');
});
it('should draft text for a late delivery and penalty contract (wrap variable)', async function () {
const grammarPath = Path.join(EXAMPLES_DIR, 'latedeliveryandpenalty', 'grammar/template.tem.md');
const grammarPath = Path.join(EXAMPLES_DIR, 'latedeliveryandpenalty', 'text/grammar.tem.md');
const ergoPath = Path.join(EXAMPLES_DIR, 'latedeliveryandpenalty', 'logic/logic.ergo');
const ctoPath = Path.join(EXAMPLES_DIR, 'latedeliveryandpenalty', 'model/model.cto');
const contractPath = { file: Path.join(EXAMPLES_DIR, 'latedeliveryandpenalty', 'data.json') };
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('#draftwithinterestsvar', function () {
return Commands.draft(null, [ctoPath], contractPath, '1970-01-01T00:00:00Z', null).should.be.rejectedWith('No input ergo found');
});
it('should initialize a smart Ergo contract state', async function () {
const grammarPath = Path.join(EXAMPLES_DIR, 'interestsvar2', 'grammar/template.tem.md');
const grammarPath = Path.join(EXAMPLES_DIR, 'interestsvar2', 'text/grammar.tem.md');
const ergoPath = Path.join(EXAMPLES_DIR, 'interestsvar2', 'logic/logic2.ergo');
const ergoPath2 = Path.join(EXAMPLES_DIR, 'interestsvar2', 'logic/interests.ergo');
const ctoPath = Path.join(EXAMPLES_DIR, 'interestsvar2', 'model/model.cto');
Expand Down
8 changes: 4 additions & 4 deletions packages/ergo-compiler/lib/ergoloader.js
Expand Up @@ -46,10 +46,10 @@ async function fromDirectory(path, options) {
await logicManager.getModelManager().updateExternalModels();

// load and add the template
let templatizedGrammar = await FileLoader.loadFileContents(path, 'grammar/template.tem.md', false, false);
let templatizedGrammar = await FileLoader.loadFileContents(path, 'text/grammar.tem.md', false, false);

if(templatizedGrammar) {
logicManager.addTemplateFile(templatizedGrammar,'grammar/template.tem.md');
logicManager.addTemplateFile(templatizedGrammar,'text/grammar.tem.md');
}

// load and add the ergo files
Expand Down Expand Up @@ -89,10 +89,10 @@ async function fromZip(buffer, options) {
await logicManager.getModelManager().updateExternalModels();

// load and add the template
let templatizedGrammar = await FileLoader.loadZipFileContents(zip, 'grammar/template.tem.md', false, false);
let templatizedGrammar = await FileLoader.loadZipFileContents(zip, 'text/grammar.tem.md', false, false);

if(templatizedGrammar) {
logicManager.addTemplateFile(templatizedGrammar,'grammar/template.tem.md');
logicManager.addTemplateFile(templatizedGrammar,'text/grammar.tem.md');
}

// load and add the ergo files
Expand Down
6 changes: 3 additions & 3 deletions packages/ergo-compiler/package.json
Expand Up @@ -26,9 +26,9 @@
"access": "public"
},
"dependencies": {
"@accordproject/concerto-core": "0.82.1",
"@accordproject/markdown-cicero": "0.5.0",
"@accordproject/markdown-common": "0.5.0",
"@accordproject/concerto-core": "0.82.2",
"@accordproject/markdown-cicero": "0.5.1",
"@accordproject/markdown-common": "0.5.1",
"acorn": "5.1.2",
"debug": "4.1.0",
"doctrine": "3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ergo-compiler/test/logicmanager.js
Expand Up @@ -386,7 +386,7 @@ describe('LogicManager', () => {
const files = [
Path.join(EXAMPLES_DIR,'helloworldcontract/model/model.cto'),
Path.join(EXAMPLES_DIR,'helloworldcontract/logic/logic.ergo'),
Path.join(EXAMPLES_DIR,'helloworldcontract/grammar/template.tem.md'),
Path.join(EXAMPLES_DIR,'helloworldcontract/text/grammar.tem.md'),
];
const logicManager = await ErgoLoader.fromFiles(files);
const modelManager = logicManager.getModelManager();
Expand Down
14 changes: 7 additions & 7 deletions packages/ergo-engine/test/workload.json
Expand Up @@ -356,7 +356,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.helloworld.HelloWorld",
"clauseName": "generateText",
Expand All @@ -377,7 +377,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.helloworld.HelloWorld",
"clauseName": "generateText",
Expand All @@ -398,7 +398,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.volumediscountlist.VolumeDiscount",
"clauseName": "generateText",
Expand All @@ -419,7 +419,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template2.tem.md",
"grammar": "text/grammar2.tem.md",
"state": "state.json",
"contractName": "org.accordproject.volumediscountlist.VolumeDiscount",
"clauseName": "generateText",
Expand All @@ -440,7 +440,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.helloworld.Helloworld",
"clauseName": "generateText",
Expand All @@ -461,7 +461,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.helloworld.Helloworld",
"clauseName": "generateText",
Expand All @@ -482,7 +482,7 @@
"template": true
},
"params": {},
"grammar": "grammar/template.tem.md",
"grammar": "text/grammar.tem.md",
"state": "state.json",
"contractName": "org.accordproject.helloworld.Helloworld",
"clauseName": "generateText",
Expand Down
8 changes: 4 additions & 4 deletions packages/ergo-test/package.json
Expand Up @@ -70,10 +70,10 @@
"exclude": [],
"all": true,
"check-coverage": true,
"statements": 93,
"branches": 70,
"functions": 92,
"lines": 93
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
},
"gitHead": "bf65386e8590dff56f8b9bc0bb657263ff049437"
}

0 comments on commit d0cb228

Please sign in to comment.