Skip to content

Commit eb00f0f

Browse files
Add documentation to the main class
1 parent 74b8151 commit eb00f0f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/services/SetupClient.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class SetupClient
2727

2828
idName: (name) -> name.trim().split(' ').join('_').toLowerCase()
2929

30+
# Executes all handlebars templates and places them in the destination directory
3031
createProject: (dir, contract) ->
3132
this.createDirectoryIfNotExist dir
3233
this.createDirectoryIfNotExist dir + path.sep + 'grammar'
@@ -43,13 +44,15 @@ class SetupClient
4344
this.createFile dir + path.sep + 'lib' + path.sep + 'logic.ergo', this.template('logic.ergo.hbs', {})
4445
this.createFile dir + path.sep + 'models' + path.sep + 'model.cto', this.template('model.cto.hbs', {dataModels: contract.contract.dataModels})
4546

47+
# Executes the handlebars template with the data as given
4648
template: (file, data) ->
4749
root = path.dirname(require.main.filename)
4850
file = fs.readFileSync(root + path.sep + 'handlebars' + path.sep + file, 'utf8')
4951
template = Handlebars.compile(file)
5052
result = template({data: data}) # result = template({data: d})
5153
result
5254

55+
# Creates a file with this contents, the string template
5356
createFile: (file, template) ->
5457
fs.writeFileSync file, template,
5558
encoding: 'utf8'
@@ -61,6 +64,8 @@ class SetupClient
6164
catch e
6265
this.doNothing e
6366

67+
# Constructs a GraphlQL query and then executes that query on api.contractpen.com GraphQL API endpoint.
68+
# You may use this URL to test GraphQL queries http://api.contractpen.com/graphQl
6469
fetchContractJsonFromServer: (guid) ->
6570
query = """
6671
query {

0 commit comments

Comments
 (0)