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
@@ -3,9 +3,9 @@ require 'tmpdir'
|
|
3
3
|
include Rake::Funnel::Support
|
4
4
|
|
5
5
|
describe Rake::Funnel::Support::Mono do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
8
|
-
|
8
|
+
end
|
9
9
|
|
10
10
|
context 'on Windows' do
|
11
11
|
let(:windows?) { true }
|
@@ -34,16 +34,16 @@ describe Rake::Funnel::Support::Mono do
|
|
34
34
|
context 'not on Windows' do
|
35
35
|
let(:windows?) { false }
|
36
36
|
|
37
|
-
before
|
37
|
+
before do
|
38
38
|
allow(Which).to receive(:which)
|
39
|
-
|
39
|
+
end
|
40
40
|
|
41
|
-
before
|
41
|
+
before do
|
42
42
|
@cmd = described_class.invocation('executable.exe')
|
43
|
-
|
43
|
+
end
|
44
44
|
|
45
45
|
it "should prepend 'mono'" do
|
46
|
-
expect(@cmd.first).to eq('mono')
|
46
|
+
expect(@cmd.first).to eq('mono') # rubocop:disable RSpec/InstanceVariable
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should resolve executable through which' do
|
@@ -1,14 +1,17 @@
|
|
1
|
+
# rubocop:disable RSpec/FilePath
|
2
|
+
|
1
3
|
describe Rake::Funnel::Support::MSBuild::BuildTool do
|
2
|
-
before
|
4
|
+
before do
|
3
5
|
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
4
|
-
|
6
|
+
end
|
5
7
|
|
6
|
-
context 'on Windows',
|
8
|
+
context 'on Windows',
|
9
|
+
skip: ('Windows Registry not available' unless defined?(::Win32::Registry)) do
|
7
10
|
let(:windows?) { true }
|
8
11
|
|
9
|
-
before
|
10
|
-
allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield(
|
11
|
-
|
12
|
+
before do
|
13
|
+
allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield('MSBuildToolsPath' => 'path')
|
14
|
+
end
|
12
15
|
|
13
16
|
it 'should search the registry for known MSBuild versions' do
|
14
17
|
described_class.find
|
@@ -16,9 +19,9 @@ describe Rake::Funnel::Support::MSBuild::BuildTool do
|
|
16
19
|
end
|
17
20
|
|
18
21
|
context 'MSBuild exists' do
|
19
|
-
before
|
22
|
+
before do
|
20
23
|
allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(true)
|
21
|
-
|
24
|
+
end
|
22
25
|
|
23
26
|
it 'should find msbuild.exe' do
|
24
27
|
expect(described_class.find).to eq('path/msbuild.exe')
|
@@ -26,9 +29,9 @@ describe Rake::Funnel::Support::MSBuild::BuildTool do
|
|
26
29
|
end
|
27
30
|
|
28
31
|
context 'MSBuild does not exist' do
|
29
|
-
before
|
32
|
+
before do
|
30
33
|
allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(false)
|
31
|
-
|
34
|
+
end
|
32
35
|
|
33
36
|
it 'should not find msbuild.exe' do
|
34
37
|
expect(described_class.find).to be_nil
|
@@ -1,7 +1,11 @@
|
|
1
|
+
# rubocop:disable RSpec/FilePath
|
2
|
+
|
1
3
|
describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
2
|
-
before
|
4
|
+
before do
|
5
|
+
# rubocop:disable RSpec/AnyInstance
|
3
6
|
allow_any_instance_of(described_class).to receive(:warn)
|
4
|
-
|
7
|
+
# rubocop:enable RSpec/AnyInstance
|
8
|
+
end
|
5
9
|
|
6
10
|
describe 'execution' do
|
7
11
|
it 'should yield block' do
|
@@ -21,23 +25,32 @@ describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
|
21
25
|
|
22
26
|
describe 'patching' do
|
23
27
|
context 'not on Windows' do
|
24
|
-
before
|
25
|
-
|
26
|
-
|
28
|
+
before do
|
29
|
+
# rubocop:disable RSpec/AnyInstance
|
30
|
+
allow_any_instance_of(described_class).to \
|
31
|
+
receive(:require).with('win32/registry').and_raise(LoadError)
|
32
|
+
# rubocop:enable RSpec/AnyInstance
|
33
|
+
end
|
27
34
|
|
28
35
|
it 'should succeed' do
|
29
36
|
expect { described_class.new }.not_to raise_error
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
33
|
-
context 'on Windows',
|
40
|
+
context 'on Windows', skip: ('Windows Registry not available' unless defined?(::Win32::Registry)) do
|
34
41
|
let(:root) { Win32::Registry::HKEY_LOCAL_MACHINE }
|
35
42
|
|
36
|
-
let(:keys)
|
43
|
+
let(:keys) do
|
37
44
|
described_class::KEYS.map do |key|
|
38
45
|
instance_double(Win32::Registry, keyname: key)
|
39
46
|
end
|
40
|
-
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:key_access_error) do
|
50
|
+
# rubocop:disable Performance/FixedSize
|
51
|
+
Win32::Registry::Error.new('value does not exist, so getting it raises'.length)
|
52
|
+
# rubocop:enable Performance/FixedSize
|
53
|
+
end
|
41
54
|
|
42
55
|
def allow_open_or_create(key)
|
43
56
|
allow(root).to receive(:create).with(key.keyname).and_yield(key)
|
@@ -48,25 +61,25 @@ describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
|
48
61
|
end
|
49
62
|
|
50
63
|
context 'MSDeploy registry key and "Version" value does not exist' do
|
51
|
-
before
|
64
|
+
before do
|
52
65
|
keys.each do |key|
|
53
66
|
allow(key).to receive(:created?).and_return(true)
|
54
|
-
allow(key).to receive(:[]).and_raise(
|
67
|
+
allow(key).to receive(:[]).and_raise(key_access_error)
|
55
68
|
allow(key).to receive(:[]=)
|
56
69
|
allow(key).to receive(:delete_key)
|
57
70
|
end
|
58
|
-
|
71
|
+
end
|
59
72
|
|
60
|
-
before
|
73
|
+
before do
|
61
74
|
keys.each do |key|
|
62
75
|
allow_open_or_create(key)
|
63
76
|
allow_open_for_deletion(key)
|
64
77
|
end
|
65
|
-
|
78
|
+
end
|
66
79
|
|
67
|
-
before
|
80
|
+
before do
|
68
81
|
described_class.new
|
69
|
-
|
82
|
+
end
|
70
83
|
|
71
84
|
it 'should create the key' do
|
72
85
|
keys.each do |key|
|
@@ -75,26 +88,24 @@ describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
|
75
88
|
end
|
76
89
|
|
77
90
|
it 'should create the version' do
|
78
|
-
keys.
|
79
|
-
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
80
|
-
end
|
91
|
+
expect(keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION))
|
81
92
|
end
|
82
93
|
|
83
94
|
it 'should delete the key' do
|
84
|
-
keys.each do |key|
|
95
|
+
keys.each do |key| # rubocop:disable RSpec/IteratedExpectation
|
85
96
|
expect(key).to have_received(:delete_key).with(File.basename(key.keyname), true)
|
86
97
|
end
|
87
98
|
end
|
88
99
|
end
|
89
100
|
|
90
101
|
context 'registry access is denied' do
|
91
|
-
before
|
102
|
+
before do
|
92
103
|
allow(root).to receive(:create).and_raise(::Win32::Registry::Error.new(5))
|
93
|
-
|
104
|
+
end
|
94
105
|
|
95
|
-
before
|
106
|
+
before do
|
96
107
|
described_class.new
|
97
|
-
|
108
|
+
end
|
98
109
|
|
99
110
|
it 'should warn' do
|
100
111
|
expect(subject).to have_received(:warn).with(/Could not patch registry to pretend MSDeploy is installed/)
|
@@ -102,53 +113,48 @@ describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
|
102
113
|
end
|
103
114
|
|
104
115
|
context 'MSDeploy registry key does exist' do
|
105
|
-
before
|
116
|
+
before do
|
106
117
|
keys.each do |key|
|
107
118
|
allow_open_or_create(key)
|
108
119
|
end
|
109
|
-
|
120
|
+
end
|
110
121
|
|
111
122
|
context '"Version" value does not exist' do
|
112
|
-
before
|
123
|
+
before do
|
113
124
|
keys.each do |key|
|
114
125
|
allow(key).to receive(:created?).and_return(false)
|
115
|
-
allow(key).to receive(:[]).and_raise(
|
126
|
+
allow(key).to receive(:[]).and_raise(key_access_error)
|
116
127
|
allow(key).to receive(:[]=)
|
117
128
|
allow(key).to receive(:delete_value)
|
118
129
|
end
|
119
|
-
|
130
|
+
end
|
120
131
|
|
121
|
-
before
|
132
|
+
before do
|
122
133
|
described_class.new
|
123
|
-
|
134
|
+
end
|
124
135
|
|
125
136
|
it 'should create the version' do
|
126
|
-
keys.
|
127
|
-
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
128
|
-
end
|
137
|
+
expect(keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION))
|
129
138
|
end
|
130
139
|
|
131
140
|
it 'should delete the version' do
|
132
|
-
keys.
|
133
|
-
expect(key).to have_received(:delete_value).with(described_class::VERSION_VALUE)
|
134
|
-
end
|
141
|
+
expect(keys).to all(have_received(:delete_value).with(described_class::VERSION_VALUE))
|
135
142
|
end
|
136
143
|
end
|
137
144
|
|
138
145
|
context '"Version" value does exist' do
|
139
|
-
before
|
146
|
+
before do
|
140
147
|
keys.each do |key|
|
141
148
|
allow(key).to receive(:created?).and_return(false)
|
142
149
|
allow(key).to receive(:[])
|
143
150
|
end
|
144
|
-
|
151
|
+
end
|
145
152
|
|
146
|
-
before
|
153
|
+
before do
|
147
154
|
described_class.new
|
148
|
-
|
155
|
+
end
|
149
156
|
|
150
157
|
it 'should do nothing' do
|
151
|
-
expect(true).to eq(true)
|
152
158
|
end
|
153
159
|
end
|
154
160
|
end
|
@@ -14,7 +14,7 @@ describe Rake::Funnel::Support::Patch do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'with definition' do
|
17
|
-
subject
|
17
|
+
subject do
|
18
18
|
described_class.new do |p|
|
19
19
|
p.setup do
|
20
20
|
output.puts 'setup'
|
@@ -25,7 +25,7 @@ describe Rake::Funnel::Support::Patch do
|
|
25
25
|
output.puts memo
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
end
|
29
29
|
|
30
30
|
let(:output) { double.as_null_object }
|
31
31
|
|
@@ -42,10 +42,10 @@ describe Rake::Funnel::Support::Patch do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when reverting the patch' do
|
45
|
-
let!(:ret)
|
45
|
+
let!(:ret) do
|
46
46
|
subject.apply!
|
47
47
|
subject.revert!
|
48
|
-
|
48
|
+
end
|
49
49
|
|
50
50
|
it 'should execute the reset' do
|
51
51
|
expect(output).to have_received(:puts).with(42)
|
@@ -60,15 +60,15 @@ describe Rake::Funnel::Support::Patch do
|
|
60
60
|
before { subject.revert! }
|
61
61
|
|
62
62
|
it 'should not execute the reset' do
|
63
|
-
expect(output).
|
63
|
+
expect(output).not_to have_received(:puts).with(42)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'when applying twice' do
|
68
|
-
before
|
68
|
+
before do
|
69
69
|
subject.apply!
|
70
70
|
subject.apply!
|
71
|
-
|
71
|
+
end
|
72
72
|
|
73
73
|
it 'should execute the setup once' do
|
74
74
|
expect(output).to have_received(:puts).with('setup').once
|
@@ -76,11 +76,11 @@ describe Rake::Funnel::Support::Patch do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
context 'when reverting twice' do
|
79
|
-
before
|
79
|
+
before do
|
80
80
|
subject.apply!
|
81
81
|
subject.revert!
|
82
82
|
subject.revert!
|
83
|
-
|
83
|
+
end
|
84
84
|
|
85
85
|
it 'should execute the revert once' do
|
86
86
|
expect(output).to have_received(:puts).with(42).once
|
@@ -90,13 +90,13 @@ describe Rake::Funnel::Support::Patch do
|
|
90
90
|
describe 'context' do
|
91
91
|
let(:context) { 42 }
|
92
92
|
|
93
|
-
subject
|
93
|
+
subject do
|
94
94
|
described_class.new(context) do |p|
|
95
95
|
p.setup do |context|
|
96
96
|
output.puts context
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
end
|
100
100
|
|
101
101
|
before { subject.apply!.revert! }
|
102
102
|
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Paket-Ref
|
2
|
-
Explicitly-Removed-Package
|
3
|
-
Untouched
|
1
|
+
Paket-Ref
|
2
|
+
Explicitly-Removed-Package
|
3
|
+
Untouched
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Paket-Ref
|
2
|
-
Explicitly-Removed-Package
|
3
|
-
Untouched
|
1
|
+
Paket-Ref
|
2
|
+
Explicitly-Removed-Package
|
3
|
+
Untouched
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Paket-Ref
|
2
|
-
Explicitly-Removed-Package
|
3
|
-
Untouched
|
1
|
+
Paket-Ref
|
2
|
+
Explicitly-Removed-Package
|
3
|
+
Untouched
|
data/spec/rake/funnel/support/specs_remover/project-specific paket.references/paket.references
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
Paket-Ref
|
2
|
-
Explicitly-Removed-Package
|
3
|
-
Untouched
|
1
|
+
Paket-Ref
|
2
|
+
Explicitly-Removed-Package
|
3
|
+
Untouched
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe Rake::Funnel::Support::SpecsRemover do
|
2
|
-
before
|
2
|
+
before do
|
3
3
|
allow(Rake::Funnel::Support::Trace).to receive(:message)
|
4
|
-
|
4
|
+
end
|
5
5
|
|
6
6
|
describe 'removal' do
|
7
7
|
let(:projects) {}
|
@@ -9,25 +9,24 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
9
9
|
let(:specs) {}
|
10
10
|
let(:packages) {}
|
11
11
|
|
12
|
-
before
|
12
|
+
before do
|
13
13
|
allow(File).to receive(:open)
|
14
14
|
allow(File).to receive(:write)
|
15
15
|
allow(RakeFileUtils).to receive(:rm)
|
16
|
-
|
16
|
+
end
|
17
17
|
|
18
18
|
describe 'arguments' do
|
19
|
-
before
|
19
|
+
before do
|
20
20
|
described_class.remove(projects: projects,
|
21
21
|
references: references,
|
22
22
|
specs: specs,
|
23
23
|
packages: packages)
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
26
|
context 'string projects' do
|
27
27
|
let(:projects) { '**/*.??proj' }
|
28
28
|
|
29
29
|
it 'should succeed' do
|
30
|
-
expect(true).to be(true)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
@@ -36,7 +35,6 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
36
35
|
let(:references) { 'Reference' }
|
37
36
|
|
38
37
|
it 'should succeed' do
|
39
|
-
expect(true).to be(true)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
@@ -45,7 +43,6 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
45
43
|
let(:specs) { '*Specs.cs' }
|
46
44
|
|
47
45
|
it 'should succeed' do
|
48
|
-
expect(true).to be(true)
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
@@ -53,7 +50,6 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
53
50
|
let(:packages) { 'SomePackage' }
|
54
51
|
|
55
52
|
it 'should succeed' do
|
56
|
-
expect(true).to be(true)
|
57
53
|
end
|
58
54
|
end
|
59
55
|
end
|
@@ -62,14 +58,14 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
62
58
|
describe Rake::Funnel::Support::SpecsRemover::ProjectFiles do
|
63
59
|
let(:projects) { '**/*.??proj' }
|
64
60
|
|
65
|
-
before
|
61
|
+
before do
|
66
62
|
allow(Dir).to receive(:[]).and_return([:some])
|
67
63
|
allow(File).to receive(:read).and_return('<root></root>')
|
68
|
-
|
64
|
+
end
|
69
65
|
|
70
|
-
before
|
66
|
+
before do
|
71
67
|
described_class.remove_specs_and_references(projects, [], [])
|
72
|
-
|
68
|
+
end
|
73
69
|
|
74
70
|
it 'should not write the project file' do
|
75
71
|
expect(File).not_to have_received(:open)
|
@@ -79,15 +75,15 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
79
75
|
describe Rake::Funnel::Support::SpecsRemover::PaketReferences do
|
80
76
|
let(:projects) { %w(project.proj) }
|
81
77
|
|
82
|
-
before
|
78
|
+
before do
|
83
79
|
allow(Dir).to receive(:[]).and_return([:some])
|
84
80
|
allow(File).to receive(:exist?).and_return(true)
|
85
81
|
allow(File).to receive(:read).and_return('SomePackage')
|
86
|
-
|
82
|
+
end
|
87
83
|
|
88
|
-
before
|
84
|
+
before do
|
89
85
|
described_class.remove_packages(projects, [])
|
90
|
-
|
86
|
+
end
|
91
87
|
|
92
88
|
it 'should not write the project file' do
|
93
89
|
expect(File).not_to have_received(:write)
|
@@ -112,29 +108,29 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
112
108
|
|
113
109
|
let(:temp_dir) { Dir.mktmpdir }
|
114
110
|
|
115
|
-
before
|
111
|
+
before do
|
116
112
|
allow($stderr).to receive(:puts)
|
117
|
-
|
113
|
+
end
|
118
114
|
|
119
|
-
before
|
115
|
+
before do
|
120
116
|
FileUtils.cp_r(File.join(example_dir(example), '.'), temp_dir)
|
121
|
-
|
117
|
+
end
|
122
118
|
|
123
|
-
after
|
119
|
+
after do
|
124
120
|
FileUtils.rm_rf(temp_dir)
|
125
|
-
|
121
|
+
end
|
126
122
|
|
127
123
|
context 'project' do
|
128
124
|
let(:example) { 'project' }
|
129
125
|
|
130
|
-
before
|
126
|
+
before do
|
131
127
|
Dir.chdir(temp_dir) do
|
132
128
|
described_class.remove(projects: projects,
|
133
129
|
references: references,
|
134
130
|
specs: specs,
|
135
131
|
packages: packages)
|
136
132
|
end
|
137
|
-
|
133
|
+
end
|
138
134
|
|
139
135
|
describe 'code files' do
|
140
136
|
describe 'production code' do
|
@@ -165,7 +161,9 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
165
161
|
end
|
166
162
|
|
167
163
|
it 'should remove compiled specs' do
|
168
|
-
expect(content('Sample.csproj')).not_to include(
|
164
|
+
expect(content('Sample.csproj')).not_to include('Specs.cs')
|
165
|
+
expect(content('Sample.csproj')).not_to include('SampleSpecs.cs')
|
166
|
+
expect(content('Sample.csproj')).not_to include('DoesNotExistSpecs.cs')
|
169
167
|
end
|
170
168
|
end
|
171
169
|
|
@@ -194,14 +192,14 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
194
192
|
context 'project-specific paket.references' do
|
195
193
|
let(:example) { 'project-specific paket.references' }
|
196
194
|
|
197
|
-
before
|
195
|
+
before do
|
198
196
|
Dir.chdir(temp_dir) do
|
199
197
|
described_class.remove(projects: projects,
|
200
198
|
references: references,
|
201
199
|
specs: specs,
|
202
200
|
packages: packages)
|
203
201
|
end
|
204
|
-
|
202
|
+
end
|
205
203
|
|
206
204
|
describe 'paket.references' do
|
207
205
|
describe 'for project' do
|
@@ -228,14 +226,14 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
228
226
|
context 'multiple projects' do
|
229
227
|
let(:example) { 'multiple projects' }
|
230
228
|
|
231
|
-
before
|
229
|
+
before do
|
232
230
|
Dir.chdir(temp_dir) do
|
233
231
|
described_class.remove(projects: projects,
|
234
232
|
references: references,
|
235
233
|
specs: specs,
|
236
234
|
packages: packages)
|
237
235
|
end
|
238
|
-
|
236
|
+
end
|
239
237
|
|
240
238
|
describe 'projects' do
|
241
239
|
it 'should remove references' do
|
@@ -244,8 +242,8 @@ describe Rake::Funnel::Support::SpecsRemover do
|
|
244
242
|
end
|
245
243
|
|
246
244
|
it 'should remove compiled specs' do
|
247
|
-
expect(content('Sample1.csproj')).not_to include(
|
248
|
-
expect(content('Sample2.csproj')).not_to include(
|
245
|
+
expect(content('Sample1.csproj')).not_to include('Specs.cs')
|
246
|
+
expect(content('Sample2.csproj')).not_to include('Specs.cs')
|
249
247
|
end
|
250
248
|
end
|
251
249
|
end
|
@@ -16,17 +16,21 @@ describe Rake::Funnel::Support::TemplateEngine do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should omit newlines for pure ruby lines' do
|
19
|
+
# rubocop:disable Style/IndentHeredoc
|
19
20
|
template = <<-EOF
|
20
21
|
<%= 42 %>
|
21
22
|
EOF
|
23
|
+
# rubocop:enable Style/IndentHeredoc
|
22
24
|
|
23
25
|
expect(described_class.render(template)).to eq('42')
|
24
26
|
end
|
25
27
|
|
26
28
|
it 'should not omit newlines for mixed ruby lines' do
|
29
|
+
# rubocop:disable Style/IndentHeredoc
|
27
30
|
template = <<-EOF
|
28
31
|
12 <%= 34 %> 56
|
29
32
|
EOF
|
33
|
+
# rubocop:enable Style/IndentHeredoc
|
30
34
|
|
31
35
|
expect(described_class.render(template)).to eq("12 34 56\n")
|
32
36
|
end
|
@@ -38,8 +42,7 @@ describe Rake::Funnel::Support::TemplateEngine do
|
|
38
42
|
describe 'binding' do
|
39
43
|
context 'without binding' do
|
40
44
|
it 'should not support contextual variables' do
|
41
|
-
|
42
|
-
template = '<%= var %>'
|
45
|
+
template = '<%= undefined_variable %>'
|
43
46
|
|
44
47
|
expect { described_class.render(template) }.to raise_error(NameError)
|
45
48
|
end
|
@@ -60,6 +63,6 @@ describe Rake::Funnel::Support::TemplateEngine do
|
|
60
63
|
|
61
64
|
it 'should report errors with file name' do
|
62
65
|
expect { described_class.render('<%= undefined %>', 'file.template') }
|
63
|
-
.to
|
66
|
+
.to(raise_error { |ex| expect(ex.backtrace.join("\n")).to match(/file\.template/) })
|
64
67
|
end
|
65
68
|
end
|