tla-sbuilder 0.2.2 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +150 -116
  3. data/VERSION +1 -1
  4. data/lib/cli/cli-customer.rb +23 -3
  5. data/lib/cli/cli-pet.rb +66 -12
  6. data/lib/cli/cli-text.rb +127 -8
  7. data/lib/cli/cli.rb +49 -6
  8. data/lib/sbuilder.rb +26 -3
  9. data/lib/sbuilder/constants.rb +165 -6
  10. data/lib/sbuilder/controller.rb +943 -169
  11. data/lib/sbuilder/controller_utils.rb +122 -0
  12. data/lib/sbuilder/default-sbuilder.yaml +38 -44
  13. data/lib/sbuilder/domain.rb +160 -36
  14. data/lib/sbuilder/domain_cardinality.rb +1 -1
  15. data/lib/sbuilder/domain_range.rb +102 -0
  16. data/lib/sbuilder/domain_type.rb +150 -0
  17. data/lib/sbuilder/domain_value.rb +21 -13
  18. data/lib/sbuilder/exception.rb +16 -0
  19. data/lib/sbuilder/extension_loader.rb +67 -686
  20. data/lib/sbuilder/extension_loader_deprecated_step_extensions.rb +711 -0
  21. data/lib/sbuilder/extension_loader_step_generator.rb +876 -0
  22. data/lib/sbuilder/facade/{api_loader.rb → api_loader_facade.rb} +176 -45
  23. data/lib/sbuilder/facade/api_loader_plugin.rb +6 -32
  24. data/lib/sbuilder/facade/api_loader_plugin_mixer.rb +35 -0
  25. data/lib/sbuilder/facade/facade_constants.rb +23 -0
  26. data/lib/sbuilder/facade/loader_plugin_root.rb +56 -0
  27. data/lib/sbuilder/facade/param_set_root.rb +55 -0
  28. data/lib/sbuilder/facade/snippet_loader_facade.rb +600 -0
  29. data/lib/sbuilder/facade/snippet_loader_plugin.rb +76 -0
  30. data/lib/sbuilder/facade/snippet_loader_plugin_mixer.rb +56 -0
  31. data/lib/sbuilder/factory.rb +224 -45
  32. data/lib/sbuilder/model.rb +125 -45
  33. data/lib/sbuilder/mustache/template.rb +107 -58
  34. data/lib/sbuilder/mustache/template_reader.rb +56 -46
  35. data/lib/sbuilder/mustache/template_reader_context.rb +64 -234
  36. data/lib/sbuilder/mustache/template_resolve.rb +103 -0
  37. data/lib/sbuilder/mustache/template_root.rb +71 -0
  38. data/lib/sbuilder/param_set.rb +30 -15
  39. data/lib/sbuilder/param_set_db.rb +1 -1
  40. data/lib/sbuilder/param_set_def.rb +6 -1
  41. data/lib/sbuilder/param_set_def_func.rb +39 -0
  42. data/lib/sbuilder/param_set_if.rb +45 -10
  43. data/lib/sbuilder/param_set_loader_swagger.rb +56 -26
  44. data/lib/sbuilder/param_set_step.rb +1 -1
  45. data/lib/sbuilder/param_sets.rb +2 -1
  46. data/lib/sbuilder/parameter.rb +9 -3
  47. data/lib/sbuilder/parameter_container.rb +1 -1
  48. data/lib/sbuilder/parameter_dom.rb +17 -5
  49. data/lib/sbuilder/parameter_ref.rb +39 -10
  50. data/lib/sbuilder/parser/parser_facade.rb +310 -0
  51. data/lib/sbuilder/resolver.rb +11 -6
  52. data/lib/sbuilder/resolver_loader.rb +1 -1
  53. data/lib/sbuilder/resolver_loader_yaml.rb +1 -1
  54. data/lib/sbuilder/resolver_rule.rb +1 -1
  55. data/lib/sbuilder/resolver_rule_match.rb +10 -4
  56. data/lib/sbuilder/resolver_rule_ref.rb +1 -1
  57. data/lib/sbuilder/setup_loader.rb +49 -0
  58. data/lib/sbuilder/setup_loader_env.rb +478 -0
  59. data/lib/sbuilder/setup_loader_pref.rb +56 -0
  60. data/lib/sbuilder/snippet_loader_simple.rb +125 -0
  61. data/lib/sbuilder/spec/api_loader.rb +34 -0
  62. data/lib/sbuilder/spec/api_loader_facade.rb +169 -32
  63. data/lib/sbuilder/spec/loader_plugin.rb +98 -0
  64. data/lib/sbuilder/spec/snippet_loader.rb +228 -0
  65. data/lib/sbuilder/symbol_table.rb +279 -0
  66. data/lib/utils/{cache_lines.rb → fileio.rb} +8 -1
  67. data/lib/utils/logger.rb +2 -1
  68. data/lib/utils/powerset.rb +13 -0
  69. data/lib/utils/validate.rb +38 -0
  70. data/mustache/cfg/const_def.mustache +2 -0
  71. data/mustache/cfg/macro_run.mustache +1 -4
  72. data/mustache/data-model-header.mustache +1 -0
  73. data/mustache/definition_types.mustache +34 -4
  74. data/mustache/domains.mustache +1 -1
  75. data/mustache/domains_assign.mustache +1 -1
  76. data/mustache/infrastructure-service-init.mustache +1 -1
  77. data/mustache/interface_processes.mustache +16 -10
  78. data/mustache/interface_types.mustache +37 -11
  79. data/mustache/operator-infrastructure-service.mustache +1 -1
  80. data/mustache/resources/schedule_operator_new_step.tla +8 -0
  81. data/mustache/resources/schedule_process_macro.tla +37 -0
  82. data/mustache/resources/schedule_process_procedure.tla +22 -0
  83. data/mustache/resources/schedule_throw.tla +16 -0
  84. data/mustache/setup/domains_run.mustache +8 -2
  85. data/mustache/setup/operator_run.mustache +0 -4
  86. data/mustache/setup/steps_run.mustache +4 -3
  87. data/mustache/setup/steps_run_parameterBind.mustache +14 -6
  88. data/mustache/setup/steps_run_parameterExact.mustache +7 -3
  89. data/mustache/state_type_invariant-infrastructure-service.mustache +9 -4
  90. data/mustache/tla/const_def.mustache +1 -1
  91. data/mustache/tla/macro_run.mustache +7 -1
  92. data/mustache/tla/module_header.mustache +1 -1
  93. data/mustache/tla/operator_run.mustache +8 -5
  94. data/mustache/tla/plc_define_run.mustache +45 -36
  95. data/mustache/tla/plc_run_state.mustache +12 -5
  96. data/src-extend/extend/extend_assumptions.mustache +3 -0
  97. data/src-extend/extend/extend_const.mustache +3 -0
  98. data/src-extend/extend/extend_implementation.mustache +3 -0
  99. data/src-extend/extend/extend_invariant.mustache +3 -0
  100. data/src-extend/extend/extend_macros.mustache +3 -0
  101. data/src-extend/extend/extend_operations.mustache +3 -0
  102. data/src-extend/extend/extend_state.mustache +3 -0
  103. data/src/pet/extend/extend_assumptions.mustache +4 -0
  104. data/src/pet/extend/extend_implementation.mustache +3 -0
  105. data/src/pet/extend/extend_invariant.mustache +3 -0
  106. data/src/pet/extend/extend_macros.mustache +3 -0
  107. data/src/pet/extend/extend_operations.mustache +4 -0
  108. data/src/pet/extend/extend_state.mustache +3 -0
  109. data/src/pet/interface +5 -5
  110. data/src/pet/interface_delete_pet.tla +1 -1
  111. data/src/pet/interface_get_pet.tla +1 -1
  112. data/src/pet/interface_post_pet.tla +4 -2
  113. data/src/pet/interface_post_tag.tla +1 -1
  114. data/src/pet/interface_put_tag.tla +1 -1
  115. data/tla-sbuilder.gemspec +3 -3
  116. metadata +44 -19
  117. data/mustache/name_definition_type.mustache +0 -5
  118. data/mustache/name_domain.mustache +0 -5
  119. data/mustache/name_domain_value.mustache +0 -5
  120. data/mustache/name_domain_value_prefix.mustache +0 -5
  121. data/mustache/name_interface_response_type.mustache +0 -6
  122. data/mustache/name_interface_type.mustache +0 -6
  123. data/mustache/name_parameter_type.mustache +0 -6
  124. data/mustache/name_process.mustache +0 -6
  125. data/mustache/state_type_invariant.mustache +0 -17
  126. data/mustache/state_variables.mustache +0 -20
  127. data/src-extend/extend/extend_invariant_cfg.mustache +0 -7
@@ -5,8 +5,8 @@
5
5
  }}
6
6
 
7
7
 
8
- {{>interface_post_pet.tla}}
9
- {{>interface_get_pet.tla}}
10
- {{>interface_delete_pet.tla}}
11
- {{>interface_post_tag.tla}}
12
- {{>interface_put_tag.tla}}
8
+ {{!interface_post_pet.tla}}
9
+ {{!interface_get_pet.tla}}
10
+ {{!interface_delete_pet.tla}}
11
+ {{!interface_post_tag.tla}}
12
+ {{!interface_put_tag.tla}}
@@ -1,5 +1,5 @@
1
1
  \* this macro expanded in process
2
- macro delete_pet( input ) {
2
+ macro {{#SPEC_NAME}}service_implementation./pets/{id}(delete){{/SPEC_NAME}}( input ) {
3
3
 
4
4
  call s_delete_pet( input );
5
5
  }
@@ -1,4 +1,4 @@
1
- macro get_pet( input ) {
1
+ macro {{#SPEC_NAME}}service_implementation./pets/{id}(get){{/SPEC_NAME}}( input ) {
2
2
 
3
3
  call s_get_pet( input );
4
4
  }
@@ -1,5 +1,7 @@
1
- \* this macro expanded in process
2
- macro post_pet( input ) {
1
+ (* This macro uses 'specName' -property to create name for the
2
+ interface in specification code domain. *)
3
+
4
+ macro {{specName}}( input ) {
3
5
 
4
6
  call s_post_pet( input );
5
7
  }
@@ -1,5 +1,5 @@
1
1
 
2
- macro post_tag( input ) {
2
+ macro {{#SPEC_NAME}}service_implementation./tags(post){{/SPEC_NAME}}( input ) {
3
3
 
4
4
  call s_post_tag( input );
5
5
  }
@@ -1,3 +1,3 @@
1
- macro put_tag( input ) {
1
+ macro {{#SPEC_NAME}}service_implementation./tags(put){{/SPEC_NAME}}( input ) {
2
2
  call s_put_tag( input );
3
3
  }
@@ -33,12 +33,12 @@ EOF
33
33
 
34
34
  s.required_ruby_version = '~> 2'
35
35
 
36
- s.add_runtime_dependency 'mustache', '~>1.0', ">=1.0.2"
36
+ s.add_runtime_dependency 'mustache', '~>1.0', ">=1.0.3"
37
37
  s.add_runtime_dependency 'hashie', '~>3.3', ">=3.3.2"
38
38
  s.add_runtime_dependency 'thor', '~>0.19', ">=0.19.1"
39
39
  s.add_runtime_dependency 'json-schema', '~>2.5', ">=2.5.2"
40
- s.add_runtime_dependency 'tla-parser-s', ">=0.1.2"
41
-
40
+ s.add_runtime_dependency 'tla-parser-s', '~>0.2', ">=0.2.2"
41
+
42
42
  # # used in pet.sh
43
43
  # s.add_runtime_dependency 'bcat'
44
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tla-sbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarjuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.2
22
+ version: 1.0.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '1.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.2
32
+ version: 1.0.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: hashie
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -94,16 +94,22 @@ dependencies:
94
94
  name: tla-parser-s
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.2'
97
100
  - - ">="
98
101
  - !ruby/object:Gem::Version
99
- version: 0.1.2
102
+ version: 0.2.2
100
103
  type: :runtime
101
104
  prerelease: false
102
105
  version_requirements: !ruby/object:Gem::Requirement
103
106
  requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.2'
104
110
  - - ">="
105
111
  - !ruby/object:Gem::Version
106
- version: 0.1.2
112
+ version: 0.2.2
107
113
  description: |2+
108
114
 
109
115
  A tool to generate runnable specification models in TLA+ language
@@ -128,22 +134,37 @@ files:
128
134
  - lib/sbuilder.rb
129
135
  - lib/sbuilder/constants.rb
130
136
  - lib/sbuilder/controller.rb
137
+ - lib/sbuilder/controller_utils.rb
131
138
  - lib/sbuilder/default-sbuilder.yaml
132
139
  - lib/sbuilder/domain.rb
133
140
  - lib/sbuilder/domain_cardinality.rb
141
+ - lib/sbuilder/domain_range.rb
142
+ - lib/sbuilder/domain_type.rb
134
143
  - lib/sbuilder/domain_value.rb
135
144
  - lib/sbuilder/exception.rb
136
145
  - lib/sbuilder/extension_loader.rb
137
- - lib/sbuilder/facade/api_loader.rb
146
+ - lib/sbuilder/extension_loader_deprecated_step_extensions.rb
147
+ - lib/sbuilder/extension_loader_step_generator.rb
148
+ - lib/sbuilder/facade/api_loader_facade.rb
138
149
  - lib/sbuilder/facade/api_loader_plugin.rb
150
+ - lib/sbuilder/facade/api_loader_plugin_mixer.rb
151
+ - lib/sbuilder/facade/facade_constants.rb
152
+ - lib/sbuilder/facade/loader_plugin_root.rb
153
+ - lib/sbuilder/facade/param_set_root.rb
154
+ - lib/sbuilder/facade/snippet_loader_facade.rb
155
+ - lib/sbuilder/facade/snippet_loader_plugin.rb
156
+ - lib/sbuilder/facade/snippet_loader_plugin_mixer.rb
139
157
  - lib/sbuilder/factory.rb
140
158
  - lib/sbuilder/model.rb
141
159
  - lib/sbuilder/mustache/template.rb
142
160
  - lib/sbuilder/mustache/template_reader.rb
143
161
  - lib/sbuilder/mustache/template_reader_context.rb
162
+ - lib/sbuilder/mustache/template_resolve.rb
163
+ - lib/sbuilder/mustache/template_root.rb
144
164
  - lib/sbuilder/param_set.rb
145
165
  - lib/sbuilder/param_set_db.rb
146
166
  - lib/sbuilder/param_set_def.rb
167
+ - lib/sbuilder/param_set_def_func.rb
147
168
  - lib/sbuilder/param_set_if.rb
148
169
  - lib/sbuilder/param_set_loader_swagger.rb
149
170
  - lib/sbuilder/param_set_step.rb
@@ -152,19 +173,30 @@ files:
152
173
  - lib/sbuilder/parameter_container.rb
153
174
  - lib/sbuilder/parameter_dom.rb
154
175
  - lib/sbuilder/parameter_ref.rb
176
+ - lib/sbuilder/parser/parser_facade.rb
155
177
  - lib/sbuilder/resolver.rb
156
178
  - lib/sbuilder/resolver_loader.rb
157
179
  - lib/sbuilder/resolver_loader_yaml.rb
158
180
  - lib/sbuilder/resolver_rule.rb
159
181
  - lib/sbuilder/resolver_rule_match.rb
160
182
  - lib/sbuilder/resolver_rule_ref.rb
183
+ - lib/sbuilder/setup_loader.rb
184
+ - lib/sbuilder/setup_loader_env.rb
185
+ - lib/sbuilder/setup_loader_pref.rb
186
+ - lib/sbuilder/snippet_loader_simple.rb
161
187
  - lib/sbuilder/spec/README
188
+ - lib/sbuilder/spec/api_loader.rb
162
189
  - lib/sbuilder/spec/api_loader_facade.rb
163
- - lib/utils/cache_lines.rb
190
+ - lib/sbuilder/spec/loader_plugin.rb
191
+ - lib/sbuilder/spec/snippet_loader.rb
192
+ - lib/sbuilder/symbol_table.rb
193
+ - lib/utils/fileio.rb
164
194
  - lib/utils/hash_inject.rb
165
195
  - lib/utils/logger.rb
166
196
  - lib/utils/netio.rb
197
+ - lib/utils/powerset.rb
167
198
  - lib/utils/string_inject.rb
199
+ - lib/utils/validate.rb
168
200
  - lib/utils/version.rb
169
201
  - mustache/cfg/const_def.mustache
170
202
  - mustache/cfg/const_run.mustache
@@ -194,15 +226,7 @@ files:
194
226
  - mustache/invariant_activate.mustache
195
227
  - mustache/markdown-header.mustache
196
228
  - mustache/markdown-toc.mustache
197
- - mustache/name_definition_type.mustache
198
- - mustache/name_domain.mustache
199
- - mustache/name_domain_value.mustache
200
- - mustache/name_domain_value_prefix.mustache
201
- - mustache/name_interface_response_type.mustache
202
- - mustache/name_interface_type.mustache
203
229
  - mustache/name_parameter_definition.mustache
204
- - mustache/name_parameter_type.mustache
205
- - mustache/name_process.mustache
206
230
  - mustache/name_type_invariant.mustache
207
231
  - mustache/name_variable.mustache
208
232
  - mustache/operator-infrastructure-service.mustache
@@ -212,6 +236,10 @@ files:
212
236
  - mustache/possibility/possibility_definition.mustache
213
237
  - mustache/possibility/possibility_directive.mustache
214
238
  - mustache/possibility/possility_setup.mustache
239
+ - mustache/resources/schedule_operator_new_step.tla
240
+ - mustache/resources/schedule_process_macro.tla
241
+ - mustache/resources/schedule_process_procedure.tla
242
+ - mustache/resources/schedule_throw.tla
215
243
  - mustache/setup/assumptions_activate.mustache
216
244
  - mustache/setup/domains_run.mustache
217
245
  - mustache/setup/module_footer.mustache
@@ -224,9 +252,7 @@ files:
224
252
  - mustache/setup/steps_run_parameterBind.mustache
225
253
  - mustache/setup/steps_run_parameterExact.mustache
226
254
  - mustache/state_type_invariant-infrastructure-service.mustache
227
- - mustache/state_type_invariant.mustache
228
255
  - mustache/state_type_invariant_cfg.mustache
229
- - mustache/state_variables.mustache
230
256
  - mustache/tla/const_def.mustache
231
257
  - mustache/tla/const_run.mustache
232
258
  - mustache/tla/macro-infrastructure-service.mustache
@@ -250,7 +276,6 @@ files:
250
276
  - src-extend/extend/extend_const.mustache
251
277
  - src-extend/extend/extend_implementation.mustache
252
278
  - src-extend/extend/extend_invariant.mustache
253
- - src-extend/extend/extend_invariant_cfg.mustache
254
279
  - src-extend/extend/extend_macros.mustache
255
280
  - src-extend/extend/extend_operations.mustache
256
281
  - src-extend/extend/extend_state.mustache
@@ -1,5 +0,0 @@
1
- {{! name of type
2
-
3
- Notice no new-lines!!!
4
-
5
- }}t_{{definition_name}}
@@ -1,5 +0,0 @@
1
- {{! value within domain_values
2
-
3
- Notice no new-lines!!!
4
-
5
- }}d_{{domain_name}}
@@ -1,5 +0,0 @@
1
- {{! value within domain_values
2
-
3
- Notice no new-lines!!!
4
-
5
- }}{{value}}
@@ -1,5 +0,0 @@
1
- {{! name of first domain value
2
-
3
- Notice no new-lines!!!
4
-
5
- }}{{namespace}}{{type}}
@@ -1,6 +0,0 @@
1
- {{! name of interface reponse type
2
-
3
-
4
- Notice no new-lines!!!
5
-
6
- }}t_resp_{{interface_name}}
@@ -1,6 +0,0 @@
1
- {{! name of interface type
2
-
3
-
4
- Notice no new-lines!!!
5
-
6
- }}t_{{interface_name}}
@@ -1,6 +0,0 @@
1
- {{!
2
-
3
-
4
- Notice no newlines
5
-
6
- }}{{namespace}}{{type}}
@@ -1,6 +0,0 @@
1
- {{! name of process
2
-
3
-
4
- Notice no new-lines!!!
5
-
6
- }}p_{{interface_name}}
@@ -1,17 +0,0 @@
1
- {{!
2
-
3
- state_type_constraint: type invariant operator for a varibale
4
-
5
- }}
6
-
7
-
8
- (******************************************************************
9
- Type invariants: {{META.desc}}
10
- - modelData {{META.modelData}}
11
- - template {{META.template}}
12
- ******************************************************************)
13
-
14
- {{#variables}}
15
- {{>name_type_invariant.mustache}} == \A entry \in {{>name_variable.mustache}}: entry \in {{>name_interface_type.mustache}}
16
- {{/variables}}
17
-
@@ -1,20 +0,0 @@
1
- {{!
2
-
3
- state_variables: state variables parser
4
-
5
-
6
- }}
7
-
8
- (******************************************************************
9
- State varibles: {{META.desc}}
10
- - modelData {{META.modelData}}
11
- - template {{META.template}}
12
- ******************************************************************)
13
-
14
-
15
- {{#variables}}
16
- {{>name_variable.mustache}} = {}; \* of type {{>name_interface_type.mustache}}
17
- {{/variables}}
18
-
19
-
20
-
@@ -1,7 +0,0 @@
1
- (*
2
- {{META.desc}}
3
- - modelData {{META.modelData}}
4
- - template {{META.template}}
5
- *)
6
-
7
- {{! >correctness.cfg}}