app_archetype 1.2.8 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,99 +1,99 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe AppArchetype::CLI::Presenters do
4
- describe '.manifest_list' do
5
- let(:manifest) do
6
- double(
7
- AppArchetype::Template::Manifest,
8
- name: 'test_manifest',
9
- version: '1.0.0'
10
- )
11
- end
12
- let(:manifest_list_row) { ['test_manifest', '1.0.0'] }
13
-
14
- let(:presenter) { double(CliFormat::Presenter) }
15
- let(:manifests) { [manifest, manifest] }
16
-
17
- before do
18
- allow(presenter).to receive(:show)
19
- allow(subject).to receive(:table).and_return(presenter)
20
-
21
- described_class.manifest_list(manifests)
22
- end
23
-
24
- it 'builds table presenter' do
25
- expect(subject).to have_received(:table).with(
26
- header: AppArchetype::CLI::Presenters::RESULT_HEADER,
27
- data: [manifest_list_row, manifest_list_row]
28
- )
29
- end
30
-
31
- it 'shows table' do
32
- expect(presenter).to have_received(:show)
33
- end
34
- end
35
-
36
- describe '.variable_list' do
37
- let(:variable) do
38
- double(
39
- AppArchetype::Template::Variable,
40
- name: 'foo',
41
- description: 'a foo',
42
- default: 'yolo',
43
- value: 'bar'
44
- )
45
- end
46
- let(:variable_row) { ['foo', 'a foo', 'yolo'] }
47
-
48
- let(:presenter) { double(CliFormat::Presenter) }
49
- let(:variables) { [variable, variable] }
50
-
51
- before do
52
- allow(presenter).to receive(:show)
53
- allow(subject).to receive(:table).and_return(presenter)
54
-
55
- described_class.variable_list(variables)
56
- end
57
-
58
- it 'builds table presenter' do
59
- expect(subject).to have_received(:table).with(
60
- header: AppArchetype::CLI::Presenters::VARIABLE_HEADER,
61
- data: [variable_row, variable_row]
62
- )
63
- end
64
-
65
- it 'shows table' do
66
- expect(presenter).to have_received(:show)
67
- end
68
- end
69
-
70
- describe '.validation_results' do
71
- let(:results) do
72
- [
73
- 'something went wrong',
74
- 'something went wrong'
75
- ]
76
- end
77
-
78
- let(:result_row) { ['something went wrong'] }
79
- let(:presenter) { double(CliFormat::Presenter) }
80
-
81
- before do
82
- allow(presenter).to receive(:show)
83
- allow(subject).to receive(:table).and_return(presenter)
84
-
85
- described_class.validation_result(results)
86
- end
87
-
88
- it 'builds table presenter' do
89
- expect(subject).to have_received(:table).with(
90
- header: AppArchetype::CLI::Presenters::VALIDATION_HEADER,
91
- data: [result_row, result_row]
92
- )
93
- end
94
-
95
- it 'shows table' do
96
- expect(presenter).to have_received(:show)
97
- end
98
- end
99
- end
1
+ # require 'spec_helper'
2
+
3
+ # RSpec.xdescribe AppArchetype::CLI::Presenters do
4
+ # describe '.manifest_list' do
5
+ # let(:manifest) do
6
+ # double(
7
+ # AppArchetype::Template::Manifest,
8
+ # name: 'test_manifest',
9
+ # version: '1.0.0'
10
+ # )
11
+ # end
12
+ # let(:manifest_list_row) { ['test_manifest', '1.0.0'] }
13
+
14
+ # let(:presenter) { double(CliFormat::Presenter) }
15
+ # let(:manifests) { [manifest, manifest] }
16
+
17
+ # before do
18
+ # allow(presenter).to receive(:show)
19
+ # allow(subject).to receive(:table).and_return(presenter)
20
+
21
+ # described_class.manifest_list(manifests)
22
+ # end
23
+
24
+ # it 'builds table presenter' do
25
+ # expect(subject).to have_received(:table).with(
26
+ # header: AppArchetype::CLI::Presenters::RESULT_HEADER,
27
+ # data: [manifest_list_row, manifest_list_row]
28
+ # )
29
+ # end
30
+
31
+ # it 'shows table' do
32
+ # expect(presenter).to have_received(:show)
33
+ # end
34
+ # end
35
+
36
+ # describe '.variable_list' do
37
+ # let(:variable) do
38
+ # double(
39
+ # AppArchetype::Template::Variable,
40
+ # name: 'foo',
41
+ # description: 'a foo',
42
+ # default: 'yolo',
43
+ # value: 'bar'
44
+ # )
45
+ # end
46
+ # let(:variable_row) { ['foo', 'a foo', 'yolo'] }
47
+
48
+ # let(:presenter) { double(CliFormat::Presenter) }
49
+ # let(:variables) { [variable, variable] }
50
+
51
+ # before do
52
+ # allow(presenter).to receive(:show)
53
+ # allow(subject).to receive(:table).and_return(presenter)
54
+
55
+ # described_class.variable_list(variables)
56
+ # end
57
+
58
+ # it 'builds table presenter' do
59
+ # expect(subject).to have_received(:table).with(
60
+ # header: AppArchetype::CLI::Presenters::VARIABLE_HEADER,
61
+ # data: [variable_row, variable_row]
62
+ # )
63
+ # end
64
+
65
+ # it 'shows table' do
66
+ # expect(presenter).to have_received(:show)
67
+ # end
68
+ # end
69
+
70
+ # describe '.validation_results' do
71
+ # let(:results) do
72
+ # [
73
+ # 'something went wrong',
74
+ # 'something went wrong'
75
+ # ]
76
+ # end
77
+
78
+ # let(:result_row) { ['something went wrong'] }
79
+ # let(:presenter) { double(CliFormat::Presenter) }
80
+
81
+ # before do
82
+ # allow(presenter).to receive(:show)
83
+ # allow(subject).to receive(:table).and_return(presenter)
84
+
85
+ # described_class.validation_result(results)
86
+ # end
87
+
88
+ # it 'builds table presenter' do
89
+ # expect(subject).to have_received(:table).with(
90
+ # header: AppArchetype::CLI::Presenters::VALIDATION_HEADER,
91
+ # data: [result_row, result_row]
92
+ # )
93
+ # end
94
+
95
+ # it 'shows table' do
96
+ # expect(presenter).to have_received(:show)
97
+ # end
98
+ # end
99
+ # end