rake-funnel 0.18.0 → 0.19.0
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/.rspec +1 -0
- data/.simplecov +24 -0
- data/Gemfile +27 -19
- data/README.md +1 -1
- data/lib/rake/funnel/ambiguous_file_error.rb +1 -0
- data/lib/rake/funnel/execution_error.rb +1 -0
- data/lib/rake/funnel/extensions/common_path.rb +5 -4
- data/lib/rake/funnel/extensions/shell.rb +3 -2
- data/lib/rake/funnel/integration/progress_report.rb +3 -2
- data/lib/rake/funnel/integration/sync_output.rb +1 -0
- data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +2 -1
- data/lib/rake/funnel/integration/teamcity/progress_report.rb +1 -1
- data/lib/rake/funnel/integration/teamcity/service_messages.rb +8 -3
- data/lib/rake/funnel/integration/teamcity/teamcity.rb +5 -4
- data/lib/rake/funnel/support/argument_mapper/styles/default.rb +5 -4
- data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +6 -5
- data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +13 -12
- data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +6 -5
- data/lib/rake/funnel/support/assembly_version/from_version_files.rb +2 -1
- data/lib/rake/funnel/support/assembly_version_writer.rb +1 -0
- data/lib/rake/funnel/support/binary_version_reader.rb +14 -7
- data/lib/rake/funnel/support/copier.rb +1 -0
- data/lib/rake/funnel/support/environments/loader.rb +13 -8
- data/lib/rake/funnel/support/internal/finder.rb +2 -1
- data/lib/rake/funnel/support/internal/instantiate_symbol.rb +9 -4
- data/lib/rake/funnel/support/mapper.rb +7 -6
- data/lib/rake/funnel/support/mono.rb +1 -3
- data/lib/rake/funnel/support/msbuild/build_tool.rb +35 -12
- data/lib/rake/funnel/support/msdeploy/registry_patch.rb +14 -17
- data/lib/rake/funnel/support/patch.rb +1 -0
- data/lib/rake/funnel/support/specs_remover.rb +14 -11
- data/lib/rake/funnel/support/template_engine.rb +1 -0
- data/lib/rake/funnel/support/timing/report.rb +11 -10
- data/lib/rake/funnel/support/version_info.rb +8 -9
- data/lib/rake/funnel/support/zipper.rb +1 -0
- data/lib/rake/funnel/tasks/assembly_version.rb +4 -3
- data/lib/rake/funnel/tasks/bin_path.rb +3 -2
- data/lib/rake/funnel/tasks/copy.rb +2 -1
- data/lib/rake/funnel/tasks/environments.rb +13 -9
- data/lib/rake/funnel/tasks/msbuild.rb +4 -6
- data/lib/rake/funnel/tasks/msdeploy.rb +6 -5
- data/lib/rake/funnel/tasks/nunit.rb +3 -2
- data/lib/rake/funnel/tasks/paket.rb +2 -1
- data/lib/rake/funnel/tasks/quick_template.rb +3 -2
- data/lib/rake/funnel/tasks/side_by_side_specs.rb +2 -1
- data/lib/rake/funnel/tasks/timing.rb +7 -6
- data/lib/rake/funnel/tasks/zip.rb +3 -2
- data/lib/rake/funnel/version.rb +1 -1
- data/rake-funnel.gemspec +11 -11
- data/spec/rake/funnel/execution_error_spec.rb +2 -2
- data/spec/rake/funnel/extensions/rexml_spec.rb +5 -2
- data/spec/rake/funnel/extensions/shell_spec.rb +26 -17
- data/spec/rake/funnel/integration/progress_report_spec.rb +32 -36
- data/spec/rake/funnel/integration/sync_output_spec.rb +5 -5
- data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +32 -20
- data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +31 -25
- data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +56 -20
- data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +7 -5
- data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +2 -0
- data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +6 -4
- data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +76 -67
- data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +17 -19
- data/spec/rake/funnel/support/assembly_version_writer_spec.rb +49 -52
- data/spec/rake/funnel/support/binary_version_reader_spec.rb +2 -2
- data/spec/rake/funnel/support/copier_spec.rb +5 -5
- data/spec/rake/funnel/support/environments/loader_spec.rb +32 -32
- data/spec/rake/funnel/support/internal/finder_spec.rb +8 -6
- data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +27 -27
- data/spec/rake/funnel/support/mapper_spec.rb +4 -3
- data/spec/rake/funnel/support/mono_spec.rb +7 -7
- data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +13 -10
- data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +47 -41
- data/spec/rake/funnel/support/patch_spec.rb +11 -11
- data/spec/rake/funnel/support/specs_remover/project/paket.references +3 -3
- data/spec/rake/funnel/support/specs_remover/project/uncompiled-code/paket.references +3 -3
- data/spec/rake/funnel/support/specs_remover/project-specific paket.references/Sample.csproj.paket.references +3 -3
- data/spec/rake/funnel/support/specs_remover/project-specific paket.references/paket.references +3 -3
- data/spec/rake/funnel/support/specs_remover_spec.rb +31 -33
- data/spec/rake/funnel/support/template_engine_spec.rb +6 -3
- data/spec/rake/funnel/support/timing/report_spec.rb +19 -20
- data/spec/rake/funnel/support/trace_spec.rb +6 -6
- data/spec/rake/funnel/support/version_info_spec.rb +8 -6
- data/spec/rake/funnel/support/which_spec.rb +7 -7
- data/spec/rake/funnel/support/zipper_spec.rb +8 -8
- data/spec/rake/funnel/tasks/assembly_version_spec.rb +9 -9
- data/spec/rake/funnel/tasks/bin_path_spec.rb +23 -21
- data/spec/rake/funnel/tasks/copy_spec.rb +10 -10
- data/spec/rake/funnel/tasks/environments_spec.rb +48 -46
- data/spec/rake/funnel/tasks/msbuild_spec.rb +21 -17
- data/spec/rake/funnel/tasks/msdeploy_spec.rb +31 -31
- data/spec/rake/funnel/tasks/nunit_spec.rb +12 -10
- data/spec/rake/funnel/tasks/paket_spec.rb +25 -21
- data/spec/rake/funnel/tasks/quick_template_spec.rb +7 -7
- data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +12 -12
- data/spec/rake/funnel/tasks/timing_spec.rb +12 -12
- data/spec/rake/funnel/tasks/zip_spec.rb +16 -16
- data/spec/spec_helper.rb +5 -31
- metadata +7 -6
@@ -6,12 +6,10 @@ describe Rake::Funnel::Support::AssemblyVersion::FromVersionFiles do
|
|
6
6
|
its(:metadata) { should be_nil }
|
7
7
|
|
8
8
|
describe 'overriding defaults' do
|
9
|
-
subject
|
10
|
-
described_class.new(
|
11
|
-
|
12
|
-
|
13
|
-
})
|
14
|
-
}
|
9
|
+
subject do
|
10
|
+
described_class.new(search_pattern: 'search pattern',
|
11
|
+
metadata: {})
|
12
|
+
end
|
15
13
|
|
16
14
|
its(:search_pattern) { should == 'search pattern' }
|
17
15
|
its(:metadata) { should == {} }
|
@@ -28,35 +26,35 @@ describe Rake::Funnel::Support::AssemblyVersion::FromVersionFiles do
|
|
28
26
|
end
|
29
27
|
|
30
28
|
describe 'enumeration' do
|
31
|
-
let(:finder) {
|
29
|
+
let(:finder) { instance_double(Finder).as_null_object }
|
32
30
|
let(:files) { %w(1 2) }
|
33
31
|
|
34
|
-
before
|
32
|
+
before do
|
35
33
|
allow(finder).to receive(:all_or_default).and_return(files)
|
36
34
|
allow(Finder).to receive(:new).and_return(finder)
|
37
|
-
|
35
|
+
end
|
38
36
|
|
39
|
-
before
|
37
|
+
before do
|
40
38
|
allow(VersionInfo).to receive(:read_version_from).and_return(*files)
|
41
|
-
|
39
|
+
end
|
42
40
|
|
43
|
-
before
|
41
|
+
before do
|
44
42
|
allow(Rake).to receive(:rake_output_message)
|
45
|
-
|
43
|
+
end
|
46
44
|
|
47
|
-
subject
|
45
|
+
subject do
|
48
46
|
described_class.new(metadata: { pre: 'alpha', build: 42, sha: 'abc' })
|
49
|
-
|
47
|
+
end
|
50
48
|
|
51
49
|
it 'should yield source and version info for each file' do
|
52
50
|
args = files.map do |file|
|
53
51
|
{
|
54
52
|
source: file,
|
55
53
|
version_info: VersionInfo.parse(version: file, metadata: {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
pre: subject.metadata[:pre],
|
55
|
+
build: subject.metadata[:build],
|
56
|
+
sha: subject.metadata[:sha]
|
57
|
+
})
|
60
58
|
}
|
61
59
|
end
|
62
60
|
|
@@ -5,9 +5,9 @@ include Rake::Funnel::Support
|
|
5
5
|
describe Rake::Funnel::Support::AssemblyVersionWriter do
|
6
6
|
describe 'version source' do
|
7
7
|
describe 'default' do
|
8
|
-
before
|
9
|
-
allow_any_instance_of(described_class).to receive(:create)
|
10
|
-
|
8
|
+
before do
|
9
|
+
allow_any_instance_of(described_class).to receive(:create) # rubocop:disable RSpec/AnyInstance
|
10
|
+
end
|
11
11
|
|
12
12
|
it 'should create FromVersionFiles with empty args' do
|
13
13
|
expect(subject).to have_received(:create).with(:from_version_files, {})
|
@@ -18,13 +18,13 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
|
|
18
18
|
let(:source) { :custom }
|
19
19
|
let(:source_args) { { foo: 42 } }
|
20
20
|
|
21
|
-
before
|
22
|
-
allow_any_instance_of(described_class).to receive(:create)
|
23
|
-
|
21
|
+
before do
|
22
|
+
allow_any_instance_of(described_class).to receive(:create) # rubocop:disable RSpec/AnyInstance
|
23
|
+
end
|
24
24
|
|
25
|
-
subject
|
25
|
+
subject do
|
26
26
|
described_class.new(source, source_args)
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
29
|
it 'should create type with args' do
|
30
30
|
expect(subject).to have_received(:create).with(source, source_args)
|
@@ -32,23 +32,22 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe 'custom instance' do
|
35
|
-
let(:source)
|
35
|
+
let(:source) do
|
36
36
|
[
|
37
37
|
{
|
38
38
|
source: 'from e.g. gitversion',
|
39
39
|
version_info: VersionInfo.new(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
})
|
40
|
+
assembly_version: '1',
|
41
|
+
assembly_file_version: '1.2',
|
42
|
+
assembly_informational_version: '1.2-abc'
|
43
|
+
)
|
45
44
|
}
|
46
45
|
]
|
47
|
-
|
46
|
+
end
|
48
47
|
|
49
|
-
subject
|
48
|
+
subject do
|
50
49
|
described_class.new(source)
|
51
|
-
|
50
|
+
end
|
52
51
|
|
53
52
|
it 'should succeed' do
|
54
53
|
expect(subject).to be
|
@@ -57,53 +56,47 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
|
|
57
56
|
end
|
58
57
|
|
59
58
|
describe '#write' do
|
60
|
-
let(:source)
|
59
|
+
let(:source) do
|
61
60
|
[
|
62
61
|
{
|
63
62
|
source: 'one',
|
64
|
-
version_info: VersionInfo.new(
|
65
|
-
|
66
|
-
|
67
|
-
assembly_file_version: '1.2',
|
68
|
-
assembly_informational_version: '1.2-abc'
|
69
|
-
})
|
63
|
+
version_info: VersionInfo.new(assembly_version: '1',
|
64
|
+
assembly_file_version: '1.2',
|
65
|
+
assembly_informational_version: '1.2-abc')
|
70
66
|
},
|
71
67
|
{
|
72
68
|
source: 'two',
|
73
|
-
version_info: VersionInfo.new(
|
74
|
-
|
75
|
-
|
76
|
-
assembly_file_version: '2.3',
|
77
|
-
assembly_informational_version: '2.3-def'
|
78
|
-
})
|
69
|
+
version_info: VersionInfo.new(assembly_version: '2',
|
70
|
+
assembly_file_version: '2.3',
|
71
|
+
assembly_informational_version: '2.3-def')
|
79
72
|
}
|
80
73
|
]
|
81
|
-
|
74
|
+
end
|
82
75
|
|
83
|
-
let(:target_path) { double(Proc).as_null_object }
|
84
|
-
let(:languages) {
|
76
|
+
let(:target_path) { double(Proc).as_null_object } # rubocop:disable RSpec/VerifiedDoubles
|
77
|
+
let(:languages) { %i(vb cs fs) }
|
85
78
|
|
86
|
-
subject
|
79
|
+
subject do
|
87
80
|
described_class.new(source)
|
88
|
-
|
81
|
+
end
|
89
82
|
|
90
|
-
before
|
83
|
+
before do
|
91
84
|
allow(Rake).to receive(:rake_output_message)
|
92
|
-
|
85
|
+
end
|
93
86
|
|
94
|
-
before
|
87
|
+
before do
|
95
88
|
allow(ERB).to receive(:new).and_call_original
|
96
|
-
|
89
|
+
end
|
97
90
|
|
98
|
-
before
|
91
|
+
before do
|
99
92
|
allow(File).to receive(:read).and_call_original
|
100
93
|
allow(File).to receive(:write)
|
101
|
-
|
94
|
+
end
|
102
95
|
|
103
96
|
context 'supported languages' do
|
104
|
-
before
|
97
|
+
before do
|
105
98
|
subject.write(target_path, languages)
|
106
|
-
|
99
|
+
end
|
107
100
|
|
108
101
|
it 'should determine target path for each language in source' do
|
109
102
|
source.each do |src|
|
@@ -115,7 +108,7 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
|
|
115
108
|
|
116
109
|
it 'should read version info template for languages' do
|
117
110
|
languages.each do |language|
|
118
|
-
expect(File).to have_received(:read).with(%r
|
111
|
+
expect(File).to have_received(:read).with(%r{assembly_version/languages/#{language}}).at_least(:once)
|
119
112
|
end
|
120
113
|
end
|
121
114
|
|
@@ -132,24 +125,28 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
|
|
132
125
|
let(:languages) { :unsupported }
|
133
126
|
|
134
127
|
it 'should fail' do
|
135
|
-
expect { subject.write(target_path, languages) }.to
|
128
|
+
expect { subject.write(target_path, languages) }.to \
|
129
|
+
raise_error(/Language is not supported: unsupported/)
|
136
130
|
end
|
137
131
|
end
|
138
132
|
|
139
133
|
describe 'version modification' do
|
140
|
-
let(:target_path)
|
141
|
-
proc
|
134
|
+
let(:target_path) do
|
135
|
+
proc do |_language, version_info, _source|
|
142
136
|
version_info.assembly_informational_version = 'totally custom'
|
143
137
|
'file'
|
144
|
-
|
145
|
-
|
138
|
+
end
|
139
|
+
end
|
146
140
|
|
147
|
-
before
|
141
|
+
before do
|
148
142
|
subject.write(target_path, languages)
|
149
|
-
|
143
|
+
end
|
150
144
|
|
151
145
|
it 'should use modified version info to generate file' do
|
152
|
-
expect(File).to
|
146
|
+
expect(File).to \
|
147
|
+
have_received(:write)
|
148
|
+
.with('file', /AssemblyInformationalVersion\("totally custom"\)/)
|
149
|
+
.at_least(:once)
|
153
150
|
end
|
154
151
|
end
|
155
152
|
end
|
@@ -6,9 +6,9 @@ describe Rake::Funnel::Support::BinaryVersionReader do
|
|
6
6
|
|
7
7
|
let(:file) { 'some assembly' }
|
8
8
|
|
9
|
-
before
|
9
|
+
before do
|
10
10
|
allow(File).to receive(:binread).with(file).and_return(contents)
|
11
|
-
|
11
|
+
end
|
12
12
|
|
13
13
|
describe 'version can be read' do
|
14
14
|
let(:version) { %w(1 2 3 4) }
|
@@ -15,7 +15,7 @@ describe Rake::Funnel::Support::Copier do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe 'recursive copy' do
|
18
|
-
before
|
18
|
+
before do
|
19
19
|
allow(File).to receive(:directory?).and_return(false)
|
20
20
|
directories.each do |dir|
|
21
21
|
allow(File).to receive(:directory?).with(dir).and_return(true)
|
@@ -23,14 +23,14 @@ describe Rake::Funnel::Support::Copier do
|
|
23
23
|
|
24
24
|
allow(RakeFileUtils).to receive(:mkdir_p)
|
25
25
|
allow(RakeFileUtils).to receive(:cp)
|
26
|
-
|
26
|
+
end
|
27
27
|
|
28
|
-
before
|
28
|
+
before do
|
29
29
|
described_class.copy(source, target)
|
30
|
-
|
30
|
+
end
|
31
31
|
|
32
32
|
def no_prefix(file)
|
33
|
-
file.sub(%r
|
33
|
+
file.sub(%r{bin/}, '')
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should create target directories' do
|
@@ -1,36 +1,36 @@
|
|
1
1
|
describe Rake::Funnel::Support::Environments::Loader do
|
2
|
-
let(:store)
|
3
|
-
double(Configatron::
|
4
|
-
|
2
|
+
let(:store) do
|
3
|
+
double(Configatron::RootStore).as_null_object # rubocop:disable RSpec/VerifiedDoubles
|
4
|
+
end
|
5
5
|
|
6
6
|
let(:customizer) { nil }
|
7
7
|
|
8
|
-
let(:config)
|
8
|
+
let(:config) do
|
9
9
|
{
|
10
10
|
name: 'environment name',
|
11
11
|
config_files: config_files.keys.map(&:to_s)
|
12
12
|
}
|
13
|
-
|
13
|
+
end
|
14
14
|
|
15
|
-
before
|
15
|
+
before do
|
16
16
|
config_files.each do |file, content|
|
17
17
|
allow(File).to receive(:read).with(file.to_s).and_return(content)
|
18
18
|
end
|
19
19
|
|
20
20
|
allow(Rake).to receive(:rake_output_message)
|
21
|
-
|
21
|
+
end
|
22
22
|
|
23
23
|
describe 'loading configuration' do
|
24
|
-
let(:config_files)
|
24
|
+
let(:config_files) do
|
25
25
|
{
|
26
26
|
one: 'one: 23',
|
27
27
|
two: 'two: 42'
|
28
28
|
}
|
29
|
-
|
29
|
+
end
|
30
30
|
|
31
|
-
before
|
31
|
+
before do
|
32
32
|
described_class.load_configuration(config, store, customizer)
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
35
|
it 'should reinitialize the configatron store' do
|
36
36
|
expect(store).to have_received(:unlock!)
|
@@ -48,8 +48,8 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should add each config file's values to the store" do
|
51
|
-
expect(store).to have_received(:configure_from_hash).with(
|
52
|
-
expect(store).to have_received(:configure_from_hash).with(
|
51
|
+
expect(store).to have_received(:configure_from_hash).with('one' => 23)
|
52
|
+
expect(store).to have_received(:configure_from_hash).with('two' => 42)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should lock the store' do
|
@@ -57,7 +57,7 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
describe 'customization' do
|
60
|
-
let(:customizer) {
|
60
|
+
let(:customizer) { instance_double(Proc).as_null_object }
|
61
61
|
|
62
62
|
it 'should run the customizer' do
|
63
63
|
expect(customizer).to have_received(:call).with(store)
|
@@ -65,16 +65,16 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'config file with overriding values' do
|
68
|
-
let(:config_files)
|
68
|
+
let(:config_files) do
|
69
69
|
{
|
70
70
|
one: 'foo: bar',
|
71
71
|
two: 'foo: baz'
|
72
72
|
}
|
73
|
-
|
73
|
+
end
|
74
74
|
|
75
|
-
let(:store)
|
75
|
+
let(:store) do
|
76
76
|
Configatron::RootStore.new
|
77
|
-
|
77
|
+
end
|
78
78
|
|
79
79
|
it 'should merge config values' do
|
80
80
|
expect(store.foo).to eq('baz')
|
@@ -82,15 +82,15 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
context 'env also defined in config file' do
|
85
|
-
let(:config_files)
|
85
|
+
let(:config_files) do
|
86
86
|
{
|
87
87
|
with_env: 'env: foo'
|
88
88
|
}
|
89
|
-
|
89
|
+
end
|
90
90
|
|
91
|
-
let(:store)
|
91
|
+
let(:store) do
|
92
92
|
Configatron::RootStore.new
|
93
|
-
|
93
|
+
end
|
94
94
|
|
95
95
|
it 'should override env from config' do
|
96
96
|
expect(store.env).to eq('foo')
|
@@ -98,11 +98,11 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'empty config file' do
|
101
|
-
let(:config_files)
|
101
|
+
let(:config_files) do
|
102
102
|
{
|
103
103
|
empty: ''
|
104
104
|
}
|
105
|
-
|
105
|
+
end
|
106
106
|
|
107
107
|
it 'should configure with empty hash' do
|
108
108
|
expect(store).to have_received(:configure_from_hash).with({})
|
@@ -112,31 +112,31 @@ describe Rake::Funnel::Support::Environments::Loader do
|
|
112
112
|
|
113
113
|
describe 'config file with ERb' do
|
114
114
|
context 'ERb success' do
|
115
|
-
let(:config_files)
|
115
|
+
let(:config_files) do
|
116
116
|
{
|
117
117
|
with_erb: 'foo: <%= 40 + 2 %>'
|
118
118
|
}
|
119
|
-
|
119
|
+
end
|
120
120
|
|
121
|
-
before
|
121
|
+
before do
|
122
122
|
described_class.load_configuration(config, store)
|
123
|
-
|
123
|
+
end
|
124
124
|
|
125
125
|
it 'should evaluate ERb' do
|
126
|
-
expect(store).to have_received(:configure_from_hash).with(
|
126
|
+
expect(store).to have_received(:configure_from_hash).with('foo' => 42)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'ERb failure' do
|
131
|
-
let(:config_files)
|
131
|
+
let(:config_files) do
|
132
132
|
{
|
133
133
|
with_erb: 'bogus: <%= 42 + "a" %>'
|
134
134
|
}
|
135
|
-
|
135
|
+
end
|
136
136
|
|
137
137
|
it 'should report file name' do
|
138
138
|
expect { described_class.load_configuration(config, store) }
|
139
|
-
.to
|
139
|
+
.to(raise_error { |ex| expect(ex.backtrace.join("\n")).to match(/with_erb/) })
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# rubocop:disable RSpec/FilePath
|
2
|
+
|
1
3
|
require 'tmpdir'
|
2
4
|
|
3
5
|
include Rake::Funnel
|
@@ -7,22 +9,22 @@ describe Rake::Funnel::Support::Finder do
|
|
7
9
|
let(:generate) { [] }
|
8
10
|
let(:temp_dir) { Dir.mktmpdir }
|
9
11
|
|
10
|
-
before
|
12
|
+
before do
|
11
13
|
Dir.chdir(temp_dir) do
|
12
14
|
([] << generate).flatten.each do |file|
|
13
15
|
FileUtils.mkdir_p(File.dirname(file))
|
14
16
|
FileUtils.touch(file)
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
19
|
+
end
|
18
20
|
|
19
|
-
after
|
21
|
+
after do
|
20
22
|
FileUtils.rm_rf(temp_dir)
|
21
|
-
|
23
|
+
end
|
22
24
|
|
23
|
-
subject
|
25
|
+
subject do
|
24
26
|
described_class.new(pattern, OpenStruct.new(name: 'task name'), 'error message')
|
25
|
-
|
27
|
+
end
|
26
28
|
|
27
29
|
def map_temp(*files)
|
28
30
|
mapped = files.map { |f| File.join(temp_dir, f) }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# rubocop:disable RSpec/FilePath
|
2
|
+
|
1
3
|
describe Rake::Funnel::Support::InstantiateSymbol do
|
2
4
|
module Creatable
|
3
5
|
class One
|
@@ -29,7 +31,7 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
29
31
|
class SnakeCase
|
30
32
|
end
|
31
33
|
|
32
|
-
class Snake_Case
|
34
|
+
class Snake_Case # rubocop:disable Style/ClassAndModuleCamelCase
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
@@ -40,9 +42,9 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
40
42
|
end
|
41
43
|
|
42
44
|
describe 'module methods' do
|
43
|
-
subject
|
45
|
+
subject do
|
44
46
|
ExplicitModuleDefinition.new
|
45
|
-
|
47
|
+
end
|
46
48
|
|
47
49
|
describe 'instance methods' do
|
48
50
|
it 'should not be public' do
|
@@ -61,32 +63,32 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
61
63
|
|
62
64
|
describe 'inspection' do
|
63
65
|
context 'implicit module' do
|
64
|
-
subject
|
66
|
+
subject do
|
65
67
|
ImplicitModuleDefinition.new
|
66
|
-
|
68
|
+
end
|
67
69
|
|
68
70
|
it 'should yield constants in self' do
|
69
|
-
expect(subject.send(:available)).to eq(
|
71
|
+
expect(subject.send(:available)).to eq(%i(ClassMethods Nested))
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
75
|
context 'explicit module' do
|
74
|
-
subject
|
76
|
+
subject do
|
75
77
|
ExplicitModuleDefinition.new
|
76
|
-
|
78
|
+
end
|
77
79
|
|
78
80
|
it 'should yield sorted constants in module' do
|
79
|
-
expect(subject.send(:available)).to eq(
|
81
|
+
expect(subject.send(:available)).to eq(%i(One Three Two))
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
83
85
|
context 'multiple uses' do
|
84
|
-
subject
|
86
|
+
subject do
|
85
87
|
[
|
86
88
|
ExplicitModuleDefinition.new,
|
87
89
|
ImplicitModuleDefinition.new
|
88
90
|
]
|
89
|
-
|
91
|
+
end
|
90
92
|
|
91
93
|
it 'should not overlap' do
|
92
94
|
first = subject[0].send(:available)
|
@@ -98,9 +100,9 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
98
100
|
end
|
99
101
|
|
100
102
|
describe 'instantiation' do
|
101
|
-
subject
|
103
|
+
subject do
|
102
104
|
ExplicitModuleDefinition.new
|
103
|
-
|
105
|
+
end
|
104
106
|
|
105
107
|
context 'with instance' do
|
106
108
|
it 'should return instance' do
|
@@ -118,14 +120,15 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
118
120
|
|
119
121
|
context 'symbol not defined' do
|
120
122
|
it 'should fail' do
|
121
|
-
expect { subject.send(:create, :does_not_exist) }.to
|
123
|
+
expect { subject.send(:create, :does_not_exist) }.to \
|
124
|
+
raise_error('Unknown type to instantiate: :does_not_exist. Available types are: [:One, :Three, :Two]')
|
122
125
|
end
|
123
126
|
end
|
124
127
|
|
125
128
|
context 'snake cased symbol' do
|
126
|
-
subject
|
129
|
+
subject do
|
127
130
|
SnakeCaseModuleDefinition.new
|
128
|
-
|
131
|
+
end
|
129
132
|
|
130
133
|
it 'should return instance' do
|
131
134
|
expect(subject.send(:create, :snake_case)).to be_an_instance_of(SnakeCase::SnakeCase)
|
@@ -142,14 +145,14 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
142
145
|
|
143
146
|
class Failure
|
144
147
|
def initialize
|
145
|
-
|
148
|
+
raise 'BAM!'
|
146
149
|
end
|
147
150
|
end
|
148
151
|
end
|
149
152
|
|
150
|
-
subject
|
153
|
+
subject do
|
151
154
|
WillFail.new
|
152
|
-
|
155
|
+
end
|
153
156
|
|
154
157
|
it 'should fail' do
|
155
158
|
expect { subject.send(:create, :Failure) }.to raise_error 'BAM!'
|
@@ -165,18 +168,15 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
165
168
|
describe 'args' do
|
166
169
|
module CreatableWithArgs
|
167
170
|
class None
|
168
|
-
def initialize
|
169
|
-
end
|
171
|
+
def initialize; end
|
170
172
|
end
|
171
173
|
|
172
174
|
class Single
|
173
|
-
def initialize(_arg)
|
174
|
-
end
|
175
|
+
def initialize(_arg); end
|
175
176
|
end
|
176
177
|
|
177
178
|
class Multiple
|
178
|
-
def initialize(_arg1, _arg2)
|
179
|
-
end
|
179
|
+
def initialize(_arg1, _arg2); end
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
@@ -185,9 +185,9 @@ describe Rake::Funnel::Support::InstantiateSymbol do
|
|
185
185
|
instantiate CreatableWithArgs
|
186
186
|
end
|
187
187
|
|
188
|
-
subject
|
188
|
+
subject do
|
189
189
|
WithArgs.new
|
190
|
-
|
190
|
+
end
|
191
191
|
|
192
192
|
context 'no argument' do
|
193
193
|
it 'should not pass arg' do
|
@@ -9,8 +9,8 @@ describe Rake::Funnel::Support::Mapper do
|
|
9
9
|
enum_hash: [{ one: 1 }, { two: 2 }, { unset: nil }]
|
10
10
|
}
|
11
11
|
|
12
|
-
|
13
|
-
expect(
|
12
|
+
result = subject.map(args)
|
13
|
+
expect(result).not_to be_empty
|
14
14
|
|
15
15
|
skip('for manual testing only')
|
16
16
|
end
|
@@ -52,7 +52,8 @@ describe Rake::Funnel::Support::Mapper do
|
|
52
52
|
|
53
53
|
context 'nil mapper' do
|
54
54
|
it 'should fail' do
|
55
|
-
expect { described_class.new(nil) }.to
|
55
|
+
expect { described_class.new(nil) }.to \
|
56
|
+
raise_error(/You cannot use the 'nil' mapper style. Available mappers are:/)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|