tla-sbuilder 0.3.4 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -70
  3. data/VERSION +1 -1
  4. data/lib/sbuilder/constants.rb +4 -4
  5. data/lib/sbuilder/controller.rb +232 -76
  6. data/lib/sbuilder/default-sbuilder.yaml +66 -22
  7. data/lib/sbuilder/facade/api_loader_facade.rb +47 -11
  8. data/lib/sbuilder/facade/facade_constants.rb +26 -0
  9. data/lib/sbuilder/facade/loader_plugin_root.rb +4 -1
  10. data/lib/sbuilder/facade/param_set_root.rb +38 -1
  11. data/lib/sbuilder/facade/snippet_loader_facade.rb +90 -8
  12. data/lib/sbuilder/factory.rb +9 -4
  13. data/lib/sbuilder/model.rb +25 -3
  14. data/lib/sbuilder/param_set.rb +8 -7
  15. data/mustache/cfg/const_def.mustache +2 -0
  16. data/mustache/{setup → config}/assumptions_activate.mustache +0 -0
  17. data/mustache/{setup → config}/domains_run.mustache +0 -0
  18. data/mustache/config/module_footer.mustache +1 -0
  19. data/mustache/config/module_header.mustache +10 -0
  20. data/mustache/{setup → config}/operator_run.mustache +0 -0
  21. data/mustache/{setup → config}/operator_tick.mustache +0 -0
  22. data/mustache/config/steps_run.mustache +43 -0
  23. data/mustache/{setup → config}/steps_run_bind_rule.mustache +5 -2
  24. data/mustache/{setup → config}/steps_run_bind_set.mustache +11 -5
  25. data/mustache/{setup → config}/steps_run_parameterBind.mustache +10 -4
  26. data/mustache/{setup → config}/steps_run_parameterExact.mustache +11 -3
  27. data/mustache/inherit/inherit_config.mustache +29 -0
  28. data/mustache/interface_processes.mustache +6 -2
  29. data/mustache/interfaces/interface_mapper.mustache +12 -0
  30. data/mustache/possibility/module_extends.mustache +1 -1
  31. data/mustache/possibility/operator_set_step_input.mustache +8 -0
  32. data/mustache/possibility/possibility_definition.mustache +4 -4
  33. data/mustache/possibility/possility_setup.mustache +4 -3
  34. data/mustache/setup/module_header.mustache +3 -1
  35. data/mustache/setup/operator_set_step_input.mustache +8 -0
  36. data/mustache/state_type_invariant-infrastructure-service.mustache +2 -2
  37. data/mustache/tla/const_def.mustache +1 -0
  38. data/mustache/tla/macro_run.mustache +10 -2
  39. data/mustache/tla/plc_run_state.mustache +2 -0
  40. data/src/pet/infrastructure_id_get.tla +6 -2
  41. data/src/pet/service_pet_post.tla +2 -2
  42. data/src/pet/service_tag_post.tla +1 -1
  43. data/tla-sbuilder.gemspec +1 -1
  44. metadata +21 -13
  45. data/mustache/setup/steps_run.mustache +0 -23
@@ -3,3 +3,4 @@
3
3
  CONSTANTS WildCard \* bind to any value
4
4
  CONSTANTS Nil \* no value
5
5
  CONSTANTS Abort \* response.status error
6
+ CONSTANTS SetStepInput \* Set variable step_input at process start
@@ -8,11 +8,19 @@
8
8
  macro enable( s ) {
9
9
  (* head in sequence 'steps' enable processes *)
10
10
  \* await Len( steps ) # 0 /\ ProcessEnabled( steps, s );
11
+ \* NOTICE deterministic .await and with NON-determ choice below
12
+ \* MUST \ s1,s2 \ steps: s1.process = s2.process
11
13
  await ProcessEnabled( steps, s );
12
14
 
13
15
  (* process entered, remove head from sequence 'steps' *)
14
- step := ProcessRunning( steps ); \* Head( steps ).process;
15
- step_parameter := ProcessParameter( steps );
16
+ with ( r \in Head( steps ) ) {
17
+ \* step := ProcessRunning( steps ); \* Head( steps ).process;
18
+ \* step_parameter := ProcessParameter( steps );
19
+ \* await( r.process = s);
20
+ step := r.process;
21
+ step_parameter := r;
22
+ };
23
+
16
24
  \* steps := ProcessesToRun( steps ); \* Tail( steps );
17
25
 
18
26
  \* Context to resume to from Head(steps ), Nil = not resuming
@@ -11,6 +11,8 @@ variables
11
11
  step = Nil;
12
12
  \* head from +steps+ sequence used to schedule +step+
13
13
  step_parameter = {};
14
+ \* input to process - modified if check_possibility
15
+ step_input = Nil;
14
16
  \* current time tick, each process run in own tick
15
17
  now = 0;
16
18
  \* TRUE when process is running
@@ -10,7 +10,9 @@ infrastructure_id_get_start:
10
10
  if ( Cardinality( v_ids[ id_type ] ) = 0 ) {
11
11
 
12
12
  \* response: 404 & Nil
13
- InfrastructureServiceReturn( "/id/{type}(get)", "status_404", Nil );
13
+ \* InfrastructureServiceReturn( "/id/{type}(get)", "status_404", Nil );
14
+ InfrastructureServiceReturn( "/id/{type}(get)", "status_404", [ status_200 |-> [ id |-> Nil] , status_404 |-> [code |-> Nil, message |-> Nil ]]);
15
+
14
16
  }
15
17
  else {
16
18
 
@@ -18,7 +20,9 @@ infrastructure_id_get_start:
18
20
  v_ids := [ v_ids EXCEPT ![id_type] = @ \ { Next_id( id_type ) } ] ;
19
21
 
20
22
  \* response: 200 && generated id
21
- InfrastructureServiceReturn( "/id/{type}(get)", "status_200", [ id |-> Next_id( id_type ) ] );
23
+ \* InfrastructureServiceReturn( "/id/{type}(get)", "status_200", [ status_200 |-> Next_id( id_type ) ] );
24
+ InfrastructureServiceReturn( "/id/{type}(get)", "status_200", [ status_200 |-> [ id |-> Next_id( id_type ) ], status_404 |-> [code |-> Nil, message |-> Nil ] ] );
25
+
22
26
  };
23
27
  return;
24
28
  }
@@ -61,12 +61,12 @@ procedure s_post_pet( input ) {
61
61
  post_pet_ok:
62
62
 
63
63
  assert( InfrastructureServiceGetStatus( "/id/{type}(get)" ) = "status_200"
64
- /\ ValidatePet( New_Pet( input.pet, InfrastructureServiceGetResponse( "/id/{type}(get)" ).id ) )
64
+ /\ ValidatePet( New_Pet( input.pet, InfrastructureServiceGetResponse( "/id/{type}(get)" ).status_200.id ) )
65
65
  );
66
66
 
67
67
 
68
68
  (* Database transaction: create pet *)
69
- enter_pet( New_Pet( input.pet, InfrastructureServiceGetResponse( "/id/{type}(get)" ).id ));
69
+ enter_pet( New_Pet( input.pet, InfrastructureServiceGetResponse( "/id/{type}(get)" ).status_200.id ));
70
70
 
71
71
  {{^PREFERENCES.debug-output}}\* {{/PREFERENCES.debug-output}} print <<"Pet post, SUCCESS!!, v_pets=", v_pets >>;
72
72
 
@@ -45,7 +45,7 @@ procedure s_post_tag( input ) {
45
45
  post_tag_ok:
46
46
 
47
47
  (* All checks passed: enter into database *)
48
- enter_tag( New_Tag( input.tag, InfrastructureServiceGetResponse( "/id/{type}(get)" ).id ) );
48
+ enter_tag( New_Tag( input.tag, InfrastructureServiceGetResponse( "/id/{type}(get)" ).status_200.id ) );
49
49
 
50
50
  post_tag_done:
51
51
 
@@ -31,7 +31,7 @@ EOF
31
31
 
32
32
  s.homepage = "https://github.com/jarjuk/tla-sbuilder"
33
33
 
34
- s.required_ruby_version = '~> 2'
34
+ s.required_ruby_version = '~> 2', ">=2.3.1"
35
35
 
36
36
  s.add_runtime_dependency 'mustache', '~>1.0', ">=1.0.3"
37
37
  s.add_runtime_dependency 'hashie', '~>3.3', ">=3.3.2"
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.3.4
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarjuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -204,6 +204,17 @@ files:
204
204
  - mustache/cfg/macro_run.mustache
205
205
  - mustache/cfg/module_footer.mustache
206
206
  - mustache/cfg/module_header.mustache
207
+ - mustache/config/assumptions_activate.mustache
208
+ - mustache/config/domains_run.mustache
209
+ - mustache/config/module_footer.mustache
210
+ - mustache/config/module_header.mustache
211
+ - mustache/config/operator_run.mustache
212
+ - mustache/config/operator_tick.mustache
213
+ - mustache/config/steps_run.mustache
214
+ - mustache/config/steps_run_bind_rule.mustache
215
+ - mustache/config/steps_run_bind_set.mustache
216
+ - mustache/config/steps_run_parameterBind.mustache
217
+ - mustache/config/steps_run_parameterExact.mustache
207
218
  - mustache/data-model-dump.mustache
208
219
  - mustache/data-model-footer.mustache
209
220
  - mustache/data-model-header.mustache
@@ -220,9 +231,11 @@ files:
220
231
  - mustache/extend/extend_state.mustache
221
232
  - mustache/infrastructure-service-init.mustache
222
233
  - mustache/infrastructure-service-variables.mustache
234
+ - mustache/inherit/inherit_config.mustache
223
235
  - mustache/interface_processes.mustache
224
236
  - mustache/interface_stubs_dummy.mustache
225
237
  - mustache/interface_types.mustache
238
+ - mustache/interfaces/interface_mapper.mustache
226
239
  - mustache/invariant_activate.mustache
227
240
  - mustache/markdown-header.mustache
228
241
  - mustache/markdown-toc.mustache
@@ -233,6 +246,7 @@ files:
233
246
  - mustache/possibility/module_extends.mustache
234
247
  - mustache/possibility/module_footer.mustache
235
248
  - mustache/possibility/module_header.mustache
249
+ - mustache/possibility/operator_set_step_input.mustache
236
250
  - mustache/possibility/possibility_definition.mustache
237
251
  - mustache/possibility/possibility_directive.mustache
238
252
  - mustache/possibility/possility_setup.mustache
@@ -240,17 +254,9 @@ files:
240
254
  - mustache/resources/schedule_process_macro.tla
241
255
  - mustache/resources/schedule_process_procedure.tla
242
256
  - mustache/resources/schedule_throw.tla
243
- - mustache/setup/assumptions_activate.mustache
244
- - mustache/setup/domains_run.mustache
245
257
  - mustache/setup/module_footer.mustache
246
258
  - mustache/setup/module_header.mustache
247
- - mustache/setup/operator_run.mustache
248
- - mustache/setup/operator_tick.mustache
249
- - mustache/setup/steps_run.mustache
250
- - mustache/setup/steps_run_bind_rule.mustache
251
- - mustache/setup/steps_run_bind_set.mustache
252
- - mustache/setup/steps_run_parameterBind.mustache
253
- - mustache/setup/steps_run_parameterExact.mustache
259
+ - mustache/setup/operator_set_step_input.mustache
254
260
  - mustache/state_type_invariant-infrastructure-service.mustache
255
261
  - mustache/state_type_invariant_cfg.mustache
256
262
  - mustache/tla/const_def.mustache
@@ -368,6 +374,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
374
  - - "~>"
369
375
  - !ruby/object:Gem::Version
370
376
  version: '2'
377
+ - - ">="
378
+ - !ruby/object:Gem::Version
379
+ version: 2.3.1
371
380
  required_rubygems_version: !ruby/object:Gem::Requirement
372
381
  requirements:
373
382
  - - ">="
@@ -375,9 +384,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
375
384
  version: '0'
376
385
  requirements: []
377
386
  rubyforge_project:
378
- rubygems_version: 2.2.2
387
+ rubygems_version: 2.6.14
379
388
  signing_key:
380
389
  specification_version: 4
381
390
  summary: Specification builder for TLA+ language
382
391
  test_files: []
383
- has_rdoc:
@@ -1,23 +0,0 @@
1
-
2
- (******************************************************************
3
- Environment model running the steps
4
-
5
- {{META.desc}}
6
- - modelData {{META.modelData}}
7
- - template {{META.template}}
8
- ******************************************************************)
9
-
10
-
11
- RunSteps == <<
12
- {{#steps}}
13
-
14
- { [ process |-> "p_{{process}}"
15
- , bindRule |-> {{>setup/steps_run_bind_rule.mustache }}
16
- , bindSet |-> {{>setup/steps_run_bind_set.mustache }}
17
- , ctx |-> Nil
18
- ]
19
- } {{_comma}} (* interface/process : {{process}} *)
20
- {{/steps}}
21
-
22
- >>
23
-