@@ -27,6 +27,7 @@ class SetupClient
27
27
28
28
idName : (name ) -> name .trim ().split (' ' ).join (' _' ).toLowerCase ()
29
29
30
+ # Executes all handlebars templates and places them in the destination directory
30
31
createProject : (dir , contract ) ->
31
32
this .createDirectoryIfNotExist dir
32
33
this .createDirectoryIfNotExist dir + path .sep + ' grammar'
@@ -43,13 +44,15 @@ class SetupClient
43
44
this .createFile dir + path .sep + ' lib' + path .sep + ' logic.ergo' , this .template (' logic.ergo.hbs' , {})
44
45
this .createFile dir + path .sep + ' models' + path .sep + ' model.cto' , this .template (' model.cto.hbs' , {dataModels : contract .contract .dataModels })
45
46
47
+ # Executes the handlebars template with the data as given
46
48
template : (file , data ) ->
47
49
root = path .dirname (require .main .filename )
48
50
file = fs .readFileSync (root + path .sep + ' handlebars' + path .sep + file, ' utf8' )
49
51
template = Handlebars .compile (file)
50
52
result = template ({data : data}) # result = template({data: d})
51
53
result
52
54
55
+ # Creates a file with this contents, the string template
53
56
createFile : (file , template ) ->
54
57
fs .writeFileSync file, template,
55
58
encoding : ' utf8'
@@ -61,6 +64,8 @@ class SetupClient
61
64
catch e
62
65
this .doNothing e
63
66
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
64
69
fetchContractJsonFromServer : (guid ) ->
65
70
query = """
66
71
query {
0 commit comments