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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -1
- data/Gemfile.lock +102 -73
- data/README.md +166 -29
- data/app_archetype.gemspec +22 -19
- data/bin/app_archetype +20 -0
- data/bin/archetype +1 -1
- data/lib/app_archetype/cli.rb +171 -139
- data/lib/app_archetype/commands/delete_template.rb +58 -0
- data/lib/app_archetype/commands/find_templates.rb +66 -0
- data/lib/app_archetype/commands/list_templates.rb +49 -0
- data/lib/app_archetype/commands/new_template.rb +42 -0
- data/lib/app_archetype/commands/open_manifest.rb +48 -0
- data/lib/app_archetype/commands/print_path.rb +20 -0
- data/lib/app_archetype/commands/print_template_variables.rb +67 -0
- data/lib/app_archetype/commands/print_version.rb +19 -0
- data/lib/app_archetype/commands/render_template.rb +178 -0
- data/lib/app_archetype/commands.rb +13 -0
- data/lib/app_archetype/generators.rb +4 -3
- data/lib/app_archetype/template/manifest.rb +17 -1
- data/lib/app_archetype/template_manager.rb +13 -6
- data/lib/app_archetype/version.rb +1 -1
- data/lib/app_archetype.rb +40 -23
- data/lib/core_ext/string.rb +18 -12
- data/scripts/create_new_command +32 -0
- data/scripts/generators/command/manifest.json +15 -0
- data/scripts/generators/command/template/lib/app_archetype/commands/{{command_name.snake_case}}.rb.hbs +17 -0
- data/spec/app_archetype/cli/presenters_spec.rb +99 -99
- data/spec/app_archetype/cli/prompts_spec.rb +291 -291
- data/spec/app_archetype/cli_spec.rb +296 -65
- data/spec/app_archetype/commands/delete_template_spec.rb +132 -0
- data/spec/app_archetype/commands/find_templates_spec.rb +130 -0
- data/spec/app_archetype/commands/list_templates_spec.rb +55 -0
- data/spec/app_archetype/commands/new_template_spec.rb +84 -0
- data/spec/app_archetype/commands/open_manifest_spec.rb +113 -0
- data/spec/app_archetype/commands/print_path_spec.rb +22 -0
- data/spec/app_archetype/commands/print_template_variables_spec.rb +158 -0
- data/spec/app_archetype/commands/print_version_spec.rb +21 -0
- data/spec/app_archetype/commands/render_template_spec.rb +479 -0
- data/spec/app_archetype/generators_spec.rb +1 -1
- data/spec/app_archetype/template/manifest_spec.rb +31 -1
- data/spec/app_archetype/template_manager_spec.rb +32 -0
- data/spec/app_archetype_spec.rb +65 -0
- metadata +155 -80
- data/lib/app_archetype/cli/presenters.rb +0 -106
- data/lib/app_archetype/cli/prompts.rb +0 -152
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|