app_archetype 1.2.8 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -1
  3. data/Gemfile.lock +102 -73
  4. data/README.md +166 -29
  5. data/app_archetype.gemspec +22 -19
  6. data/bin/app_archetype +20 -0
  7. data/bin/archetype +1 -1
  8. data/lib/app_archetype/cli.rb +171 -139
  9. data/lib/app_archetype/commands/delete_template.rb +58 -0
  10. data/lib/app_archetype/commands/find_templates.rb +66 -0
  11. data/lib/app_archetype/commands/list_templates.rb +49 -0
  12. data/lib/app_archetype/commands/new_template.rb +42 -0
  13. data/lib/app_archetype/commands/open_manifest.rb +48 -0
  14. data/lib/app_archetype/commands/print_path.rb +20 -0
  15. data/lib/app_archetype/commands/print_template_variables.rb +67 -0
  16. data/lib/app_archetype/commands/print_version.rb +19 -0
  17. data/lib/app_archetype/commands/render_template.rb +178 -0
  18. data/lib/app_archetype/commands.rb +13 -0
  19. data/lib/app_archetype/generators.rb +4 -3
  20. data/lib/app_archetype/template/manifest.rb +17 -1
  21. data/lib/app_archetype/template_manager.rb +13 -6
  22. data/lib/app_archetype/version.rb +1 -1
  23. data/lib/app_archetype.rb +40 -23
  24. data/lib/core_ext/string.rb +18 -12
  25. data/scripts/create_new_command +32 -0
  26. data/scripts/generators/command/manifest.json +15 -0
  27. data/scripts/generators/command/template/lib/app_archetype/commands/{{command_name.snake_case}}.rb.hbs +17 -0
  28. data/spec/app_archetype/cli/presenters_spec.rb +99 -99
  29. data/spec/app_archetype/cli/prompts_spec.rb +291 -291
  30. data/spec/app_archetype/cli_spec.rb +296 -65
  31. data/spec/app_archetype/commands/delete_template_spec.rb +132 -0
  32. data/spec/app_archetype/commands/find_templates_spec.rb +130 -0
  33. data/spec/app_archetype/commands/list_templates_spec.rb +55 -0
  34. data/spec/app_archetype/commands/new_template_spec.rb +84 -0
  35. data/spec/app_archetype/commands/open_manifest_spec.rb +113 -0
  36. data/spec/app_archetype/commands/print_path_spec.rb +22 -0
  37. data/spec/app_archetype/commands/print_template_variables_spec.rb +158 -0
  38. data/spec/app_archetype/commands/print_version_spec.rb +21 -0
  39. data/spec/app_archetype/commands/render_template_spec.rb +479 -0
  40. data/spec/app_archetype/generators_spec.rb +1 -1
  41. data/spec/app_archetype/template/manifest_spec.rb +31 -1
  42. data/spec/app_archetype/template_manager_spec.rb +32 -0
  43. data/spec/app_archetype_spec.rb +65 -0
  44. metadata +155 -80
  45. data/lib/app_archetype/cli/presenters.rb +0 -106
  46. data/lib/app_archetype/cli/prompts.rb +0 -152
metadata CHANGED
@@ -1,285 +1,328 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_archetype
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bigger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-26 00:00:00.000000000 Z
11
+ date: 2022-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cli-format
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0'
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: '0.2'
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: highline
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "~>"
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '2.0'
47
+ version: '0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "~>"
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '2.0'
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: json
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: '2.3'
61
+ version: '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: '2.3'
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: jsonnet
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 0.4.0
75
+ version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 0.4.0
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: json-schema
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '2.8'
89
+ version: '0'
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: '2.8'
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: logger
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 1.4.2
103
+ version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 1.4.2
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: os
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '1.1'
117
+ version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '1.1'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: ostruct
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '0.3'
131
+ version: '0'
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - "~>"
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '0.3'
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: ruby-handlebars
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '0.4'
145
+ version: '0'
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '0.4'
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: thor
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: tty-prompt
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: tty-table
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
144
186
  - !ruby/object:Gem::Version
145
- version: '1.0'
187
+ version: '0'
146
188
  type: :runtime
147
189
  prerelease: false
148
190
  version_requirements: !ruby/object:Gem::Requirement
149
191
  requirements:
150
- - - "~>"
192
+ - - ">="
151
193
  - !ruby/object:Gem::Version
152
- version: '1.0'
194
+ version: '0'
153
195
  - !ruby/object:Gem::Dependency
154
196
  name: bump
155
197
  requirement: !ruby/object:Gem::Requirement
156
198
  requirements:
157
- - - "~>"
199
+ - - ">="
158
200
  - !ruby/object:Gem::Version
159
- version: '0.9'
201
+ version: '0'
160
202
  type: :development
161
203
  prerelease: false
162
204
  version_requirements: !ruby/object:Gem::Requirement
163
205
  requirements:
164
- - - "~>"
206
+ - - ">="
165
207
  - !ruby/object:Gem::Version
166
- version: '0.9'
208
+ version: '0'
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: private_gem
169
211
  requirement: !ruby/object:Gem::Requirement
170
212
  requirements:
171
- - - "~>"
213
+ - - ">="
172
214
  - !ruby/object:Gem::Version
173
- version: '1.1'
215
+ version: '0'
174
216
  type: :development
175
217
  prerelease: false
176
218
  version_requirements: !ruby/object:Gem::Requirement
177
219
  requirements:
178
- - - "~>"
220
+ - - ">="
179
221
  - !ruby/object:Gem::Version
180
- version: '1.1'
222
+ version: '0'
181
223
  - !ruby/object:Gem::Dependency
182
224
  name: pry
183
225
  requirement: !ruby/object:Gem::Requirement
184
226
  requirements:
185
- - - "~>"
227
+ - - ">="
186
228
  - !ruby/object:Gem::Version
187
- version: '0.13'
229
+ version: '0'
188
230
  type: :development
189
231
  prerelease: false
190
232
  version_requirements: !ruby/object:Gem::Requirement
191
233
  requirements:
192
- - - "~>"
234
+ - - ">="
193
235
  - !ruby/object:Gem::Version
194
- version: '0.13'
236
+ version: '0'
195
237
  - !ruby/object:Gem::Dependency
196
238
  name: rake
197
239
  requirement: !ruby/object:Gem::Requirement
198
240
  requirements:
199
- - - "~>"
241
+ - - ">="
200
242
  - !ruby/object:Gem::Version
201
- version: '13.0'
243
+ version: '0'
202
244
  type: :development
203
245
  prerelease: false
204
246
  version_requirements: !ruby/object:Gem::Requirement
205
247
  requirements:
206
- - - "~>"
248
+ - - ">="
207
249
  - !ruby/object:Gem::Version
208
- version: '13.0'
250
+ version: '0'
209
251
  - !ruby/object:Gem::Dependency
210
252
  name: rspec
211
253
  requirement: !ruby/object:Gem::Requirement
212
254
  requirements:
213
- - - "~>"
255
+ - - ">="
214
256
  - !ruby/object:Gem::Version
215
- version: '3.9'
257
+ version: '0'
216
258
  type: :development
217
259
  prerelease: false
218
260
  version_requirements: !ruby/object:Gem::Requirement
219
261
  requirements:
220
- - - "~>"
262
+ - - ">="
221
263
  - !ruby/object:Gem::Version
222
- version: '3.9'
264
+ version: '0'
223
265
  - !ruby/object:Gem::Dependency
224
266
  name: rubocop
225
267
  requirement: !ruby/object:Gem::Requirement
226
268
  requirements:
227
- - - "~>"
269
+ - - ">="
228
270
  - !ruby/object:Gem::Version
229
- version: '0.92'
271
+ version: '0'
230
272
  type: :development
231
273
  prerelease: false
232
274
  version_requirements: !ruby/object:Gem::Requirement
233
275
  requirements:
234
- - - "~>"
276
+ - - ">="
235
277
  - !ruby/object:Gem::Version
236
- version: '0.92'
278
+ version: '0'
237
279
  - !ruby/object:Gem::Dependency
238
280
  name: rubycritic
239
281
  requirement: !ruby/object:Gem::Requirement
240
282
  requirements:
241
- - - "~>"
283
+ - - ">="
242
284
  - !ruby/object:Gem::Version
243
- version: '4.5'
285
+ version: '0'
244
286
  type: :development
245
287
  prerelease: false
246
288
  version_requirements: !ruby/object:Gem::Requirement
247
289
  requirements:
248
- - - "~>"
290
+ - - ">="
249
291
  - !ruby/object:Gem::Version
250
- version: '4.5'
292
+ version: '0'
251
293
  - !ruby/object:Gem::Dependency
252
294
  name: simplecov
253
295
  requirement: !ruby/object:Gem::Requirement
254
296
  requirements:
255
- - - "~>"
297
+ - - ">="
256
298
  - !ruby/object:Gem::Version
257
- version: '0.19'
299
+ version: '0'
258
300
  type: :development
259
301
  prerelease: false
260
302
  version_requirements: !ruby/object:Gem::Requirement
261
303
  requirements:
262
- - - "~>"
304
+ - - ">="
263
305
  - !ruby/object:Gem::Version
264
- version: '0.19'
306
+ version: '0'
265
307
  - !ruby/object:Gem::Dependency
266
308
  name: yard
267
309
  requirement: !ruby/object:Gem::Requirement
268
310
  requirements:
269
- - - "~>"
311
+ - - ">="
270
312
  - !ruby/object:Gem::Version
271
- version: '0.9'
313
+ version: '0'
272
314
  type: :development
273
315
  prerelease: false
274
316
  version_requirements: !ruby/object:Gem::Requirement
275
317
  requirements:
276
- - - "~>"
318
+ - - ">="
277
319
  - !ruby/object:Gem::Version
278
- version: '0.9'
320
+ version: '0'
279
321
  description:
280
322
  email:
281
323
  - andrew.bigger@gmail.com
282
324
  executables:
325
+ - app_archetype
283
326
  - archetype
284
327
  extensions: []
285
328
  extra_rdoc_files: []
@@ -296,11 +339,20 @@ files:
296
339
  - README.md
297
340
  - Rakefile
298
341
  - app_archetype.gemspec
342
+ - bin/app_archetype
299
343
  - bin/archetype
300
344
  - lib/app_archetype.rb
301
345
  - lib/app_archetype/cli.rb
302
- - lib/app_archetype/cli/presenters.rb
303
- - lib/app_archetype/cli/prompts.rb
346
+ - lib/app_archetype/commands.rb
347
+ - lib/app_archetype/commands/delete_template.rb
348
+ - lib/app_archetype/commands/find_templates.rb
349
+ - lib/app_archetype/commands/list_templates.rb
350
+ - lib/app_archetype/commands/new_template.rb
351
+ - lib/app_archetype/commands/open_manifest.rb
352
+ - lib/app_archetype/commands/print_path.rb
353
+ - lib/app_archetype/commands/print_template_variables.rb
354
+ - lib/app_archetype/commands/print_version.rb
355
+ - lib/app_archetype/commands/render_template.rb
304
356
  - lib/app_archetype/generators.rb
305
357
  - lib/app_archetype/logger.rb
306
358
  - lib/app_archetype/renderer.rb
@@ -314,9 +366,21 @@ files:
314
366
  - lib/app_archetype/template_manager.rb
315
367
  - lib/app_archetype/version.rb
316
368
  - lib/core_ext/string.rb
369
+ - scripts/create_new_command
370
+ - scripts/generators/command/manifest.json
371
+ - scripts/generators/command/template/lib/app_archetype/commands/{{command_name.snake_case}}.rb.hbs
317
372
  - spec/app_archetype/cli/presenters_spec.rb
318
373
  - spec/app_archetype/cli/prompts_spec.rb
319
374
  - spec/app_archetype/cli_spec.rb
375
+ - spec/app_archetype/commands/delete_template_spec.rb
376
+ - spec/app_archetype/commands/find_templates_spec.rb
377
+ - spec/app_archetype/commands/list_templates_spec.rb
378
+ - spec/app_archetype/commands/new_template_spec.rb
379
+ - spec/app_archetype/commands/open_manifest_spec.rb
380
+ - spec/app_archetype/commands/print_path_spec.rb
381
+ - spec/app_archetype/commands/print_template_variables_spec.rb
382
+ - spec/app_archetype/commands/print_version_spec.rb
383
+ - spec/app_archetype/commands/render_template_spec.rb
320
384
  - spec/app_archetype/generators_spec.rb
321
385
  - spec/app_archetype/logger_spec.rb
322
386
  - spec/app_archetype/renderer_spec.rb
@@ -327,6 +391,7 @@ files:
327
391
  - spec/app_archetype/template/variable_manager_spec.rb
328
392
  - spec/app_archetype/template/variable_spec.rb
329
393
  - spec/app_archetype/template_manager_spec.rb
394
+ - spec/app_archetype_spec.rb
330
395
  - spec/core_ext/string_spec.rb
331
396
  - spec/spec_helper.rb
332
397
  homepage: https://github.com/andrewbigger/app_archetype
@@ -356,6 +421,15 @@ test_files:
356
421
  - spec/app_archetype/cli/presenters_spec.rb
357
422
  - spec/app_archetype/cli/prompts_spec.rb
358
423
  - spec/app_archetype/cli_spec.rb
424
+ - spec/app_archetype/commands/delete_template_spec.rb
425
+ - spec/app_archetype/commands/find_templates_spec.rb
426
+ - spec/app_archetype/commands/list_templates_spec.rb
427
+ - spec/app_archetype/commands/new_template_spec.rb
428
+ - spec/app_archetype/commands/open_manifest_spec.rb
429
+ - spec/app_archetype/commands/print_path_spec.rb
430
+ - spec/app_archetype/commands/print_template_variables_spec.rb
431
+ - spec/app_archetype/commands/print_version_spec.rb
432
+ - spec/app_archetype/commands/render_template_spec.rb
359
433
  - spec/app_archetype/generators_spec.rb
360
434
  - spec/app_archetype/logger_spec.rb
361
435
  - spec/app_archetype/renderer_spec.rb
@@ -366,5 +440,6 @@ test_files:
366
440
  - spec/app_archetype/template/variable_manager_spec.rb
367
441
  - spec/app_archetype/template/variable_spec.rb
368
442
  - spec/app_archetype/template_manager_spec.rb
443
+ - spec/app_archetype_spec.rb
369
444
  - spec/core_ext/string_spec.rb
370
445
  - spec/spec_helper.rb
@@ -1,106 +0,0 @@
1
- require 'cli-format'
2
-
3
- module AppArchetype
4
- class CLI < ::Thor
5
- # CLI output presenters
6
- module Presenters
7
- ##
8
- # Output table header
9
- #
10
- RESULT_HEADER = %w[NAME VERSION].freeze
11
-
12
- ##
13
- # Variable table header
14
- #
15
- VARIABLE_HEADER = %w[NAME DESCRIPTION DEFAULT].freeze
16
-
17
- ##
18
- # Validation result table header
19
- #
20
- VALIDATION_HEADER = %w[ERROR].freeze
21
-
22
- class <<self
23
- ##
24
- # Creates a presenter for given data
25
- #
26
- # Accepts header row data and has configurable format.
27
- #
28
- # Header must be array of string
29
- #
30
- # Data is array of arrays where the inner array is a row.
31
- #
32
- # Format by default is a table, although can be 'csv'
33
- # or 'json'.
34
- #
35
- # @param header [Array]
36
- # @param data [Array]
37
- # @param format [String]
38
- #
39
- # @return [CliFormat::Presenter]
40
- #
41
- def table(header: [], data: [], format: 'table')
42
- has_header = header.any?
43
- opts = { header: has_header, format: format }
44
-
45
- presenter = CliFormat::Presenter.new(opts)
46
- presenter.header = header if has_header
47
-
48
- data.each { |row| presenter.rows << row }
49
-
50
- presenter
51
- end
52
-
53
- ##
54
- # Builds a table of manifest information
55
- #
56
- # @param [Array] manifests
57
- #
58
- def manifest_list(manifests)
59
- table(
60
- header: RESULT_HEADER,
61
- data: manifests.map do |manifest|
62
- [
63
- manifest.name,
64
- manifest.version
65
- ]
66
- end
67
- ).show
68
- end
69
-
70
- ##
71
- # Builds a table of variable information
72
- #
73
- # @param [Array] variables
74
- #
75
- def variable_list(variables)
76
- table(
77
- header: VARIABLE_HEADER,
78
- data: variables.map do |variable|
79
- [
80
- variable.name,
81
- variable.description,
82
- variable.default
83
- ]
84
- end
85
- ).show
86
- end
87
-
88
- ##
89
- # Builds a table for manifest validation results
90
- #
91
- # @param [Array] results
92
- #
93
- def validation_result(results)
94
- table(
95
- header: VALIDATION_HEADER,
96
- data: results.map do |result|
97
- [
98
- result
99
- ]
100
- end
101
- ).show
102
- end
103
- end
104
- end
105
- end
106
- end