teuton 2.1.10 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -12
  3. data/bin/check_teuton +0 -2
  4. data/docs/changelog/ideas.md +132 -0
  5. data/docs/changelog/v2.1.md +14 -122
  6. data/docs/changelog/v2.2.md +52 -28
  7. data/docs/changelog/version2.1.md +4 -0
  8. data/docs/commands/README.md +58 -15
  9. data/docs/commands/example_check.md +0 -4
  10. data/docs/commands/example_run.md +0 -4
  11. data/docs/dsl/README.md +1 -1
  12. data/docs/dsl/definition/result.md +1 -0
  13. data/docs/dsl/definition/run_remote.md +12 -6
  14. data/docs/dsl/definition/target.md +9 -10
  15. data/docs/dsl/execution/export.md +27 -20
  16. data/docs/install/README.md +13 -18
  17. data/docs/install/vagrant_docker.md +1 -1
  18. data/docs/learn/README.md +8 -8
  19. data/docs/learn/example-01-target.md +25 -25
  20. data/docs/learn/example-02-config.md +38 -49
  21. data/docs/learn/example-03-remote-hosts.md +22 -22
  22. data/docs/learn/{example-11-first-test.md → example-04-new-test.md} +23 -24
  23. data/docs/learn/{example-04-use.md → example-05-use.md} +6 -6
  24. data/docs/learn/{example-05-debug.md → example-06-debug.md} +8 -8
  25. data/docs/learn/{example-06-log.md → example-07-log.md} +7 -7
  26. data/docs/learn/example-08-readme.md +59 -0
  27. data/docs/learn/example-09-preserve.md +41 -0
  28. data/docs/videos.md +19 -0
  29. data/lib/teuton/application.rb +22 -3
  30. data/lib/teuton/case_manager/case/builtin/main.rb +3 -19
  31. data/lib/teuton/case_manager/case/builtin/package.rb +7 -6
  32. data/lib/teuton/case_manager/case/builtin/service.rb +9 -8
  33. data/lib/teuton/case_manager/case/builtin/teuton_file.rb +28 -0
  34. data/lib/teuton/case_manager/case/builtin/teuton_host.rb +31 -0
  35. data/lib/teuton/case_manager/case/builtin/user.rb +8 -7
  36. data/lib/teuton/case_manager/case/case.rb +1 -1
  37. data/lib/teuton/case_manager/case/dsl/goto.rb +2 -2
  38. data/lib/teuton/case_manager/case/dsl/log.rb +1 -1
  39. data/lib/teuton/case_manager/case/dsl/macro.rb +4 -1
  40. data/lib/teuton/case_manager/case/dsl/send.rb +2 -1
  41. data/lib/teuton/case_manager/case/play.rb +2 -0
  42. data/lib/teuton/case_manager/case/result/ext_compare.rb +16 -0
  43. data/lib/teuton/case_manager/case/result/result.rb +1 -1
  44. data/lib/teuton/case_manager/case/runner.rb +30 -4
  45. data/lib/teuton/case_manager/case_manager.rb +1 -1
  46. data/lib/teuton/case_manager/dsl.rb +10 -0
  47. data/lib/teuton/case_manager/export_manager.rb +24 -5
  48. data/lib/teuton/case_manager/utils.rb +1 -1
  49. data/lib/teuton/{project/laboratory → check}/builtin.rb +0 -0
  50. data/lib/teuton/{project/laboratory → check}/dsl.rb +40 -28
  51. data/lib/teuton/{project/laboratory → check}/laboratory.rb +3 -8
  52. data/lib/teuton/{project/laboratory → check}/show.rb +53 -59
  53. data/lib/teuton/cli.rb +85 -14
  54. data/lib/teuton/{project/readme → readme}/dsl.rb +0 -0
  55. data/lib/teuton/{project/readme → readme}/lang.rb +1 -1
  56. data/lib/teuton/{project/readme → readme}/readme.rb +22 -18
  57. data/lib/teuton/report/formatter/array_formatter.rb +13 -1
  58. data/lib/teuton/report/formatter/base_formatter.rb +18 -5
  59. data/lib/teuton/{project/skeleton.rb → skeleton.rb} +7 -18
  60. data/lib/teuton/utils/configfile_reader.rb +121 -0
  61. data/lib/teuton/{project → utils}/name_file_finder.rb +46 -26
  62. data/lib/teuton/version.rb +8 -0
  63. data/lib/teuton.rb +39 -32
  64. metadata +109 -62
  65. data/lib/teuton/case_manager/case/dsl/deprecated.rb +0 -14
  66. data/lib/teuton/cli/check.rb +0 -38
  67. data/lib/teuton/cli/main.rb +0 -6
  68. data/lib/teuton/cli/play.rb +0 -38
  69. data/lib/teuton/cli/readme.rb +0 -26
  70. data/lib/teuton/cli/version.rb +0 -12
  71. data/lib/teuton/files/gitignore +0 -2
  72. data/lib/teuton/project/configfile_reader.rb +0 -49
  73. data/lib/teuton/project/project.rb +0 -80
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2022-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json_pure
14
+ name: colorize
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.2'
19
+ version: 0.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.2'
26
+ version: 0.8.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rainbow
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: net-sftp
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '5.2'
61
+ version: '5.0'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '5.2'
68
+ version: '5.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: net-telnet
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +81,33 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.1'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rainbow
84
+ name: os
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '3.0'
89
+ version: '1.1'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '3.0'
96
+ version: '1.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json_pure
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.2'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.2'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: thor
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +164,20 @@ dependencies:
136
164
  - - "~>"
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0.74'
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.9'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.9'
139
181
  description: |2
140
182
  Intrastructure test, useful for:
141
183
  (1) Sysadmin teachers to evaluate students remote machines.
@@ -153,42 +195,47 @@ extensions: []
153
195
  extra_rdoc_files:
154
196
  - README.md
155
197
  - LICENSE
156
- - docs/learn/example-03-remote-hosts.md
157
- - docs/learn/example-05-debug.md
158
- - docs/learn/example-02-config.md
159
- - docs/learn/example-11-first-test.md
160
- - docs/learn/videos.md
161
- - docs/learn/example-06-log.md
162
- - docs/learn/example-04-use.md
163
- - docs/learn/example-01-target.md
164
- - docs/learn/README.md
165
- - docs/changelog/v2.1.md
166
- - docs/changelog/v2.2.md
167
- - docs/changelog/contributions.md
168
- - docs/changelog/servidor-de-retos.md
169
- - docs/changelog/v2.0.md
170
- - docs/commands/example_run.md
171
198
  - docs/commands/README.md
172
199
  - docs/commands/example_check.md
200
+ - docs/commands/example_run.md
201
+ - docs/learn/README.md
202
+ - docs/learn/example-01-target.md
203
+ - docs/learn/example-02-config.md
204
+ - docs/learn/example-03-remote-hosts.md
205
+ - docs/learn/example-04-new-test.md
206
+ - docs/learn/example-05-use.md
207
+ - docs/learn/example-06-debug.md
208
+ - docs/learn/example-07-log.md
209
+ - docs/learn/example-08-readme.md
210
+ - docs/learn/example-09-preserve.md
211
+ - docs/learn/videos.md
212
+ - docs/dsl/README.md
213
+ - docs/dsl/setting/get.md
214
+ - docs/dsl/setting/set.md
173
215
  - docs/dsl/definition/result.md
174
- - docs/dsl/definition/target.md
175
- - docs/dsl/definition/group.md
176
216
  - docs/dsl/definition/expect.md
177
- - docs/dsl/definition/run_local.md
217
+ - docs/dsl/definition/group.md
178
218
  - docs/dsl/definition/run_remote.md
219
+ - docs/dsl/definition/run_local.md
220
+ - docs/dsl/definition/target.md
179
221
  - docs/dsl/execution/export.md
180
222
  - docs/dsl/execution/play.md
181
223
  - docs/dsl/execution/send.md
182
224
  - docs/dsl/execution/show.md
183
- - docs/dsl/setting/set.md
184
- - docs/dsl/setting/get.md
185
- - docs/dsl/README.md
186
225
  - docs/Challenge-Server-Project.md
187
- - docs/install/modes_of_use.md
188
- - docs/install/vagrant_docker.md
189
- - docs/install/scripts.md
226
+ - docs/videos.md
190
227
  - docs/install/README.md
191
228
  - docs/install/manual.md
229
+ - docs/install/modes_of_use.md
230
+ - docs/install/scripts.md
231
+ - docs/install/vagrant_docker.md
232
+ - docs/changelog/v2.2.md
233
+ - docs/changelog/v2.0.md
234
+ - docs/changelog/servidor-de-retos.md
235
+ - docs/changelog/contributions.md
236
+ - docs/changelog/v2.1.md
237
+ - docs/changelog/ideas.md
238
+ - docs/changelog/version2.1.md
192
239
  files:
193
240
  - LICENSE
194
241
  - README.md
@@ -196,10 +243,12 @@ files:
196
243
  - bin/teuton
197
244
  - docs/Challenge-Server-Project.md
198
245
  - docs/changelog/contributions.md
246
+ - docs/changelog/ideas.md
199
247
  - docs/changelog/servidor-de-retos.md
200
248
  - docs/changelog/v2.0.md
201
249
  - docs/changelog/v2.1.md
202
250
  - docs/changelog/v2.2.md
251
+ - docs/changelog/version2.1.md
203
252
  - docs/commands/README.md
204
253
  - docs/commands/example_check.md
205
254
  - docs/commands/example_run.md
@@ -225,21 +274,25 @@ files:
225
274
  - docs/learn/example-01-target.md
226
275
  - docs/learn/example-02-config.md
227
276
  - docs/learn/example-03-remote-hosts.md
228
- - docs/learn/example-04-use.md
229
- - docs/learn/example-05-debug.md
230
- - docs/learn/example-06-log.md
231
- - docs/learn/example-11-first-test.md
277
+ - docs/learn/example-04-new-test.md
278
+ - docs/learn/example-05-use.md
279
+ - docs/learn/example-06-debug.md
280
+ - docs/learn/example-07-log.md
281
+ - docs/learn/example-08-readme.md
282
+ - docs/learn/example-09-preserve.md
232
283
  - docs/learn/videos.md
284
+ - docs/videos.md
233
285
  - lib/teuton.rb
234
286
  - lib/teuton/application.rb
235
287
  - lib/teuton/case_manager/case/builtin/main.rb
236
288
  - lib/teuton/case_manager/case/builtin/package.rb
237
289
  - lib/teuton/case_manager/case/builtin/service.rb
290
+ - lib/teuton/case_manager/case/builtin/teuton_file.rb
291
+ - lib/teuton/case_manager/case/builtin/teuton_host.rb
238
292
  - lib/teuton/case_manager/case/builtin/user.rb
239
293
  - lib/teuton/case_manager/case/case.rb
240
294
  - lib/teuton/case_manager/case/close.rb
241
295
  - lib/teuton/case_manager/case/config.rb
242
- - lib/teuton/case_manager/case/dsl/deprecated.rb
243
296
  - lib/teuton/case_manager/case/dsl/expect.rb
244
297
  - lib/teuton/case_manager/case/dsl/getset.rb
245
298
  - lib/teuton/case_manager/case/dsl/goto.rb
@@ -265,29 +318,19 @@ files:
265
318
  - lib/teuton/case_manager/report.rb
266
319
  - lib/teuton/case_manager/show.rb
267
320
  - lib/teuton/case_manager/utils.rb
321
+ - lib/teuton/check/builtin.rb
322
+ - lib/teuton/check/dsl.rb
323
+ - lib/teuton/check/laboratory.rb
324
+ - lib/teuton/check/show.rb
268
325
  - lib/teuton/cli.rb
269
- - lib/teuton/cli/check.rb
270
- - lib/teuton/cli/main.rb
271
- - lib/teuton/cli/play.rb
272
- - lib/teuton/cli/readme.rb
273
- - lib/teuton/cli/version.rb
274
326
  - lib/teuton/files/README.md
275
327
  - lib/teuton/files/config.yaml
276
- - lib/teuton/files/gitignore
277
328
  - lib/teuton/files/start.rb
278
329
  - lib/teuton/files/template/case.html
279
330
  - lib/teuton/files/template/resume.html
280
- - lib/teuton/project/configfile_reader.rb
281
- - lib/teuton/project/laboratory/builtin.rb
282
- - lib/teuton/project/laboratory/dsl.rb
283
- - lib/teuton/project/laboratory/laboratory.rb
284
- - lib/teuton/project/laboratory/show.rb
285
- - lib/teuton/project/name_file_finder.rb
286
- - lib/teuton/project/project.rb
287
- - lib/teuton/project/readme/dsl.rb
288
- - lib/teuton/project/readme/lang.rb
289
- - lib/teuton/project/readme/readme.rb
290
- - lib/teuton/project/skeleton.rb
331
+ - lib/teuton/readme/dsl.rb
332
+ - lib/teuton/readme/lang.rb
333
+ - lib/teuton/readme/readme.rb
291
334
  - lib/teuton/report/close.rb
292
335
  - lib/teuton/report/formatter/array_formatter.rb
293
336
  - lib/teuton/report/formatter/base_formatter.rb
@@ -308,12 +351,16 @@ files:
308
351
  - lib/teuton/report/formatter/yaml_formatter.rb
309
352
  - lib/teuton/report/report.rb
310
353
  - lib/teuton/report/show.rb
354
+ - lib/teuton/skeleton.rb
355
+ - lib/teuton/utils/configfile_reader.rb
356
+ - lib/teuton/utils/name_file_finder.rb
311
357
  - lib/teuton/utils/verbose.rb
312
- homepage: https://github.com/teuton-software/teuton/tree/devel
358
+ - lib/teuton/version.rb
359
+ homepage: https://github.com/teuton-software/teuton
313
360
  licenses:
314
361
  - GPL-3.0
315
362
  metadata: {}
316
- post_install_message: Thanks for installing!
363
+ post_install_message:
317
364
  rdoc_options: []
318
365
  require_paths:
319
366
  - lib
@@ -321,15 +368,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
321
368
  requirements:
322
369
  - - ">="
323
370
  - !ruby/object:Gem::Version
324
- version: 2.5.0
371
+ version: 2.5.9
325
372
  required_rubygems_version: !ruby/object:Gem::Requirement
326
373
  requirements:
327
374
  - - ">="
328
375
  - !ruby/object:Gem::Version
329
376
  version: '0'
330
377
  requirements: []
331
- rubygems_version: 3.1.2
332
- signing_key:
378
+ rubygems_version: 3.1.6
379
+ signing_key:
333
380
  specification_version: 4
334
381
  summary: Teuton (Teuton Software)
335
382
  test_files: []
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # DSL#request, DSL#target2
4
- module DSL
5
- def request(text)
6
- raise "Deprecated request #{text}"
7
- # do nothing by now
8
- end
9
-
10
- def command(p_command, args = {})
11
- @action[:command] = p_command
12
- tempfile(args[:tempfile]) if args[:tempfile]
13
- end
14
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # CLI#test
4
- class CLI < Thor
5
- map ['t', '-t', '--test', 'test'] => 'check'
6
- option :c, type: :boolean
7
- option :cname, type: :string
8
- option :cpath, type: :string
9
- desc 'check [OPTIONS] DIRECTORY',
10
- 'Test or check challenge contents'
11
- long_desc <<-LONGDESC
12
-
13
- (1) teuton test path/to/dir/foo
14
- , Test content of start.rb and config.yaml files.
15
-
16
- (2) teuton test path/to/dir/foo -c
17
- , Only test CONFIG information from config.yaml.
18
-
19
- (3) teuton test path/to/dir/foo --cname=demo
20
- , Test content of start.rb and demo.yaml files.
21
-
22
- (4) teuton test path/to/file/foo.rb
23
- , Test content of foo.rb and foo.yaml files.
24
-
25
- (5) teuton test path/to/file/foo.rb -c
26
- , Only test CONFIG information from foo.yaml.
27
-
28
- (6) teuton test path/to/file/foo.rb --cname=demo
29
- , Test content of foo.rb and demo.yaml files.
30
-
31
- LONGDESC
32
- ##
33
- # Verify or test Teuton test units syntax
34
- # @param path_to_rb_file [String] Route to main rb Teuton file
35
- def check(path_to_rb_file)
36
- Project.check(path_to_rb_file, options)
37
- end
38
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'check'
4
- require_relative 'play'
5
- require_relative 'readme'
6
- require_relative 'version'
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # CLI#play
4
- class CLI < Thor
5
- map ['p', '-p', 'play', '--play', '--run', 'run'] => 'play'
6
- option :export, type: :string
7
- option :cname, type: :string
8
- option :cpath, type: :string
9
- option :case, type: :string
10
- option :color, type: :boolean
11
- option :quiet, type: :boolean
12
- desc '[run] [OPTIONS] DIRECTORY',
13
- 'Run challenge from directory'
14
- long_desc <<-LONGDESC
15
- This function execute challenge from specified directory.
16
- By default, show progress on the screen.
17
-
18
- Let's see others options:
19
-
20
- (1) teuton foo, run challenge from foo/start.rb with foo/config.yaml config file.
21
-
22
- (2) teuton play foo, same as (1).
23
-
24
- (3) teuton play --export=json foo, run challenge and export using json format.
25
- Others output formats availables are: txt, colored_text, json, yaml.
26
-
27
- (4) teuton play --cname=demo foo, run challenge from foo/start.rb with foo/demo.yaml config file.
28
-
29
- (5) teuton foo/demo.rb, Run challenge from foo/demo.rb with foo/demo.yaml config file.
30
-
31
- LONGDESC
32
- ##
33
- # Execute Teuton test unit
34
- # @param filepath [String] Route to main: rb file or folder
35
- def play(filepath)
36
- Project.play(filepath, options)
37
- end
38
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # CLI#readme
4
- class CLI < Thor
5
- map ['--readme'] => 'readme'
6
- option :lang, type: :string
7
- desc 'readme DIRECTORY',
8
- 'Create README.md file from challenge contents'
9
- long_desc <<-LONGDESC
10
-
11
- (1) teuton readme foo
12
- , Create README.md from foo/start.rb.
13
-
14
- (2) teuton readme foo/demo.rb
15
- , Create README.md from foo/demo.rb.
16
-
17
- By default lang=es, but It's available lang=en too.
18
-
19
- LONGDESC
20
- ##
21
- # Create README from teuton test
22
- # @param path_to_rb_file [String] Route to main rb Teuton file
23
- def readme(path_to_rb_file)
24
- Project.readme(path_to_rb_file, options)
25
- end
26
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Class method Teuton#version
4
- class CLI < Thor
5
- map ['v', '-v', '--version'] => 'version'
6
- desc 'version', 'Show the program version'
7
- ##
8
- # Display version
9
- def version
10
- puts "#{Application::NAME} (version #{Application::VERSION})"
11
- end
12
- end
@@ -1,2 +0,0 @@
1
- *.yaml
2
- *.json
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'yaml'
4
- require 'json/pure'
5
-
6
- # Functions that read data from ConfigFile using formats YAML and JSON
7
- # * read
8
- # * read_yaml
9
- # * read_json
10
- module ConfigFileReader
11
- def self.read(filepath)
12
- unless File.exist?(filepath)
13
- data = {}
14
- data[:global] = {}
15
- data[:alias] = {}
16
- data[:cases] = [{ tt_members: 'anonymous' }]
17
- return data
18
- end
19
- return read_yaml(filepath) if File.extname(filepath) == '.yaml'
20
-
21
- return read_json(filepath) if File.extname(filepath) == '.json'
22
-
23
- raise "[ERROR] ConfigFileReader: #{filepath}"
24
- end
25
-
26
- def self.read_yaml(filepath)
27
- begin
28
- data = YAML.load(File.open(filepath))
29
- rescue StandardError => e
30
- puts "\n" + ('=' * 80)
31
- puts "[ERROR] ConfigFileReader#read <#{filepath}>"
32
- puts ' I suggest to revise file format!'
33
- puts " #{e.message}\n" + ('=' * 80)
34
- raise "[ERROR] ConfigFileReader <#{e}>"
35
- end
36
- data[:global] = data[:global] || {}
37
- data[:alias] = data[:alias] || {}
38
- data[:cases] = data[:cases] || []
39
- data
40
- end
41
-
42
- def self.read_json(filepath)
43
- data = JSON.parse(File.read(filepath), symbolize_names: true)
44
- data[:global] = data[:global] || {}
45
- data[:alias] = data[:alias] || {}
46
- data[:cases] = data[:cases] || []
47
- data
48
- end
49
- end
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../application'
4
- require_relative 'name_file_finder'
5
-
6
- # Project functions invoked by CLI project tool
7
- # * test
8
- # * play
9
- # * process_input_case_option
10
- # * readme
11
- # * require_dsl_and_script
12
- module Project ##
13
- ##
14
- # Check teuton test syntax
15
- # @param projectpath (String) Path to teuton test
16
- # @param options (Array) Array of input options
17
- def self.check(projectpath, options)
18
- Application.instance.options.merge! options
19
- NameFileFinder.find_filenames_for(projectpath)
20
- NameFileFinder.puts_input_info_on_screen
21
- require_dsl_and_script('laboratory/laboratory') # Define DSL keywords
22
-
23
- app = Application.instance
24
- lab = Laboratory.new(app.script_path, app.config_path)
25
- # lab.show_requests if options[:r]
26
- lab.show_config if options[:c]
27
- lab.show_dsl unless options[:r] || options[:c]
28
- end
29
-
30
- ##
31
- # Run test
32
- # @param projectpath (String) Path to teuton test
33
- # @param options (Array) Array of input options
34
- def self.play(projectpath, options)
35
- Application.instance.options.merge! options
36
- process_input_options
37
- NameFileFinder.find_filenames_for(projectpath)
38
- NameFileFinder.puts_input_info_on_screen
39
- require_dsl_and_script('../case_manager/dsl') # Define DSL keywords
40
- end
41
-
42
- ##
43
- # Preprocess input options:
44
- # * Convert input case options String to an Array of integers
45
- # * Read color input option
46
- def self.process_input_options
47
- options = Application.instance.options
48
- options['color'] = true if options['color'].nil?
49
- Rainbow.enabled = options['color']
50
- return if options['case'].nil?
51
-
52
- a = options['case'].split(',')
53
- options['case'] = a.collect!(&:to_i)
54
- end
55
-
56
- ##
57
- # Create Readme file for a test
58
- # @param projectpath (String) Path to teuton test
59
- # @param options (Array) Array of input options
60
- def self.readme(projectpath, options)
61
- Application.instance.options.merge! options
62
- NameFileFinder.find_filenames_for(projectpath)
63
- require_dsl_and_script('readme/readme') # Define DSL keywords
64
-
65
- app = Application.instance
66
- readme = Readme.new(app.script_path, app.config_path)
67
- readme.show
68
- end
69
-
70
- def self.require_dsl_and_script(dslpath)
71
- app = Application.instance
72
- require_relative dslpath
73
- begin
74
- require_relative app.script_path
75
- rescue SyntaxError => e
76
- puts e.to_s
77
- puts Rainbow.new("[ERROR] SyntaxError into file #{app.script_path}").red
78
- end
79
- end
80
- end