rake-funnel 0.3.2.pre → 0.4.0.pre
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 +2 -2
- data/Gemfile +4 -0
- data/README.md +2 -2
- data/lib/rake/funnel/ambiguous_file_error.rb +31 -29
- data/lib/rake/funnel/execution_error.rb +28 -26
- data/lib/rake/funnel/extensions/case/camel_case.rb +24 -19
- data/lib/rake/funnel/extensions/case/pascal_case.rb +24 -19
- data/lib/rake/funnel/extensions/case.rb +3 -3
- data/lib/rake/funnel/extensions/common_path.rb +60 -52
- data/lib/rake/funnel/extensions/disable_colors.rb +33 -27
- data/lib/rake/funnel/extensions/rexml.rb +27 -23
- data/lib/rake/funnel/extensions/shell.rb +92 -56
- data/lib/rake/funnel/extensions/windows_path.rb +15 -11
- data/lib/rake/funnel/framework.rb +11 -16
- data/lib/rake/funnel/integration/progress_report.rb +72 -70
- data/lib/rake/funnel/integration/sync_output.rb +12 -8
- data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +61 -55
- data/lib/rake/funnel/integration/teamcity/progress_report.rb +39 -33
- data/lib/rake/funnel/integration/teamcity/service_messages.rb +46 -40
- data/lib/rake/funnel/integration/teamcity/teamcity.rb +19 -15
- data/lib/rake/funnel/integration/teamcity.rb +3 -5
- data/lib/rake/funnel/support/argument_mapper/key_value_pair.rb +16 -10
- data/lib/rake/funnel/support/argument_mapper/styles/default.rb +39 -31
- data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +41 -33
- data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +55 -47
- data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +41 -33
- data/lib/rake/funnel/support/argument_mapper/styles.rb +3 -5
- data/lib/rake/funnel/support/argument_mapper/switch.rb +16 -10
- data/lib/rake/funnel/support/argument_mapper/value.rb +16 -10
- data/lib/rake/funnel/support/assembly_version/from_version_files.rb +39 -35
- data/lib/rake/funnel/support/assembly_version/languages/cs +5 -5
- data/lib/rake/funnel/support/assembly_version/languages/fs +12 -12
- data/lib/rake/funnel/support/assembly_version/languages/vb +5 -5
- data/lib/rake/funnel/support/assembly_version_writer.rb +56 -52
- data/lib/rake/funnel/support/binary_version_reader.rb +37 -32
- data/lib/rake/funnel/support/copier.rb +31 -27
- data/lib/rake/funnel/support/environments/loader.rb +46 -40
- data/lib/rake/funnel/support/environments.rb +3 -3
- data/lib/rake/funnel/support/internal/finder.rb +55 -51
- data/lib/rake/funnel/support/internal/instantiate_symbol.rb +38 -34
- data/lib/rake/funnel/support/mapper.rb +57 -53
- data/lib/rake/funnel/support/mono.rb +21 -17
- data/lib/rake/funnel/support/msbuild/build_tool.rb +30 -24
- data/lib/rake/funnel/support/msbuild.rb +3 -3
- data/lib/rake/funnel/support/msdeploy/registry_patch.rb +90 -84
- data/lib/rake/funnel/support/msdeploy.rb +3 -3
- data/lib/rake/funnel/support/patch.rb +41 -37
- data/lib/rake/funnel/support/specs_remover.rb +66 -62
- data/lib/rake/funnel/support/template_engine.rb +30 -26
- data/lib/rake/funnel/support/timing/report.rb +95 -89
- data/lib/rake/funnel/support/timing/statistics.rb +32 -26
- data/lib/rake/funnel/support/timing.rb +3 -3
- data/lib/rake/funnel/support/version_info.rb +103 -72
- data/lib/rake/funnel/support/which.rb +19 -15
- data/lib/rake/funnel/support/zipper.rb +53 -49
- data/lib/rake/funnel/tasks/assembly_version.rb +44 -40
- data/lib/rake/funnel/tasks/bin_path.rb +45 -41
- data/lib/rake/funnel/tasks/copy.rb +43 -39
- data/lib/rake/funnel/tasks/environments.rb +89 -89
- data/lib/rake/funnel/tasks/msbuild.rb +55 -51
- data/lib/rake/funnel/tasks/msdeploy.rb +54 -50
- data/lib/rake/funnel/tasks/nunit.rb +52 -48
- data/lib/rake/funnel/tasks/paket.rb +51 -47
- data/lib/rake/funnel/tasks/quick_template.rb +53 -49
- data/lib/rake/funnel/tasks/side_by_side_specs.rb +41 -37
- data/lib/rake/funnel/tasks/timing.rb +108 -104
- data/lib/rake/funnel/tasks/zip.rb +46 -42
- data/lib/rake/funnel/version.rb +1 -1
- data/lib/rake/funnel.rb +7 -7
- data/rake-funnel.gemspec +12 -3
- data/spec/rake/funnel/execution_error_spec.rb +67 -67
- data/spec/rake/funnel/extensions/case/camel_case_spec.rb +17 -17
- data/spec/rake/funnel/extensions/case/pascal_case_spec.rb +17 -17
- data/spec/rake/funnel/extensions/common_path_spec.rb +56 -56
- data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -33
- data/spec/rake/funnel/extensions/rexml_spec.rb +20 -20
- data/spec/rake/funnel/extensions/shell_spec.rb +237 -237
- data/spec/rake/funnel/extensions/windows_path_spec.rb +5 -5
- data/spec/rake/funnel/integration/progress_report_spec.rb +149 -149
- data/spec/rake/funnel/integration/sync_output_spec.rb +16 -16
- data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +110 -110
- data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -174
- data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -136
- data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -34
- data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +222 -222
- data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +25 -25
- data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +214 -214
- data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +66 -61
- data/spec/rake/funnel/support/assembly_version_writer_spec.rb +140 -140
- data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -29
- data/spec/rake/funnel/support/copier_spec.rb +58 -58
- data/spec/rake/funnel/support/environments/loader_spec.rb +143 -143
- data/spec/rake/funnel/support/internal/finder_spec.rb +229 -229
- data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +182 -183
- data/spec/rake/funnel/support/mapper_spec.rb +87 -87
- data/spec/rake/funnel/support/mono_spec.rb +57 -57
- data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +21 -21
- data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +139 -139
- data/spec/rake/funnel/support/patch_spec.rb +108 -108
- data/spec/rake/funnel/support/specs_remover/Sample.csproj +28 -28
- data/spec/rake/funnel/support/specs_remover_spec.rb +116 -116
- data/spec/rake/funnel/support/template_engine_spec.rb +65 -65
- data/spec/rake/funnel/support/timing/report_spec.rb +129 -129
- data/spec/rake/funnel/support/version_info_spec.rb +333 -228
- data/spec/rake/funnel/support/which_spec.rb +65 -65
- data/spec/rake/funnel/support/zipper_spec.rb +77 -77
- data/spec/rake/funnel/tasks/assembly_version_spec.rb +45 -45
- data/spec/rake/funnel/tasks/bin_path_spec.rb +52 -52
- data/spec/rake/funnel/tasks/copy_spec.rb +44 -44
- data/spec/rake/funnel/tasks/environments_spec.rb +249 -247
- data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -91
- data/spec/rake/funnel/tasks/msdeploy_spec.rb +220 -220
- data/spec/rake/funnel/tasks/nunit_spec.rb +74 -74
- data/spec/rake/funnel/tasks/paket_spec.rb +140 -142
- data/spec/rake/funnel/tasks/quick_template_spec.rb +62 -62
- data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -58
- data/spec/rake/funnel/tasks/timing_spec.rb +133 -133
- data/spec/rake/funnel/tasks/zip_spec.rb +50 -50
- data/spec/spec_helper.rb +43 -33
- metadata +2 -3
- data/lib/rake/funnel/support/side_by_side_specs.rb +0 -3
@@ -1,21 +1,21 @@
|
|
1
|
-
describe Rake::Funnel::Support::MSBuild::BuildTool do
|
2
|
-
before {
|
3
|
-
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
4
|
-
}
|
5
|
-
|
6
|
-
context 'on Windows', platform: :win32 do
|
7
|
-
let(:windows?) { true }
|
8
|
-
|
9
|
-
it 'should find msbuild.exe' do
|
10
|
-
expect(described_class.find).to match(/msbuild\.exe$/)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'not on Windows' do
|
15
|
-
let(:windows?) { false }
|
16
|
-
|
17
|
-
it 'should find xbuild' do
|
18
|
-
expect(described_class.find).to eq('xbuild')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
describe Rake::Funnel::Support::MSBuild::BuildTool do
|
2
|
+
before {
|
3
|
+
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
4
|
+
}
|
5
|
+
|
6
|
+
context 'on Windows', platform: :win32 do
|
7
|
+
let(:windows?) { true }
|
8
|
+
|
9
|
+
it 'should find msbuild.exe' do
|
10
|
+
expect(described_class.find).to match(/msbuild\.exe$/)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'not on Windows' do
|
15
|
+
let(:windows?) { false }
|
16
|
+
|
17
|
+
it 'should find xbuild' do
|
18
|
+
expect(described_class.find).to eq('xbuild')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,139 +1,139 @@
|
|
1
|
-
describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
2
|
-
describe 'execution' do
|
3
|
-
it 'should yield block' do
|
4
|
-
result = 0
|
5
|
-
|
6
|
-
described_class.new do
|
7
|
-
result = 42
|
8
|
-
end
|
9
|
-
|
10
|
-
expect(result).to eq(42)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should work without block' do
|
14
|
-
expect { described_class.new }.not_to raise_error
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'patching' do
|
19
|
-
context 'not on Windows' do
|
20
|
-
before {
|
21
|
-
allow_any_instance_of(described_class).to receive(:require).with('win32/registry').and_raise(LoadError)
|
22
|
-
}
|
23
|
-
|
24
|
-
it 'should succeed' do
|
25
|
-
expect { described_class.new }.not_to raise_error
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'on Windows', platform: :win32 do
|
30
|
-
let(:root) { Win32::Registry::HKEY_LOCAL_MACHINE }
|
31
|
-
|
32
|
-
let(:keys) {
|
33
|
-
described_class::KEYS.map do |key|
|
34
|
-
instance_double(Win32::Registry, keyname: key)
|
35
|
-
end
|
36
|
-
}
|
37
|
-
|
38
|
-
def allow_open_or_create(key)
|
39
|
-
allow(root).to receive(:create).with(key.keyname).and_yield(key)
|
40
|
-
end
|
41
|
-
|
42
|
-
def allow_open_for_deletion(key)
|
43
|
-
allow(root).to receive(:create).with(File.dirname(key.keyname)).and_yield(key)
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'MSDeploy registry key and "Version" value does not exist' do
|
47
|
-
before {
|
48
|
-
keys.each do |key|
|
49
|
-
allow(key).to receive(:created?).and_return(true)
|
50
|
-
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
51
|
-
allow(key).to receive(:[]=)
|
52
|
-
allow(key).to receive(:delete_key)
|
53
|
-
end
|
54
|
-
}
|
55
|
-
|
56
|
-
before {
|
57
|
-
keys.each do |key|
|
58
|
-
allow_open_or_create(key)
|
59
|
-
allow_open_for_deletion(key)
|
60
|
-
end
|
61
|
-
}
|
62
|
-
|
63
|
-
before {
|
64
|
-
described_class.new
|
65
|
-
}
|
66
|
-
|
67
|
-
it 'should create the key' do
|
68
|
-
keys.each do |key|
|
69
|
-
expect(root).to have_received(:create).with(key.keyname)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'should create the version' do
|
74
|
-
keys.each do |key|
|
75
|
-
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should delete the key' do
|
80
|
-
keys.each do |key|
|
81
|
-
expect(key).to have_received(:delete_key).with(File.basename(key.keyname), true)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'MSDeploy registry key does exist' do
|
87
|
-
before {
|
88
|
-
keys.each do |key|
|
89
|
-
allow_open_or_create(key)
|
90
|
-
end
|
91
|
-
}
|
92
|
-
|
93
|
-
context '"Version" value does not exist' do
|
94
|
-
before {
|
95
|
-
keys.each do |key|
|
96
|
-
allow(key).to receive(:created?).and_return(false)
|
97
|
-
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
98
|
-
allow(key).to receive(:[]=)
|
99
|
-
allow(key).to receive(:delete_value)
|
100
|
-
end
|
101
|
-
}
|
102
|
-
|
103
|
-
before {
|
104
|
-
described_class.new
|
105
|
-
}
|
106
|
-
|
107
|
-
it 'should create the version' do
|
108
|
-
keys.each do |key|
|
109
|
-
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'should delete the version' do
|
114
|
-
keys.each do |key|
|
115
|
-
expect(key).to have_received(:delete_value).with(described_class::VERSION_VALUE)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context '"Version" value does exist' do
|
121
|
-
before {
|
122
|
-
keys.each do |key|
|
123
|
-
allow(key).to receive(:created?).and_return(false)
|
124
|
-
allow(key).to receive(:[])
|
125
|
-
end
|
126
|
-
}
|
127
|
-
|
128
|
-
before {
|
129
|
-
described_class.new
|
130
|
-
}
|
131
|
-
|
132
|
-
it 'should do nothing' do
|
133
|
-
expect(true).to eq(true)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
1
|
+
describe Rake::Funnel::Support::MSDeploy::RegistryPatch do
|
2
|
+
describe 'execution' do
|
3
|
+
it 'should yield block' do
|
4
|
+
result = 0
|
5
|
+
|
6
|
+
described_class.new do
|
7
|
+
result = 42
|
8
|
+
end
|
9
|
+
|
10
|
+
expect(result).to eq(42)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should work without block' do
|
14
|
+
expect { described_class.new }.not_to raise_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'patching' do
|
19
|
+
context 'not on Windows' do
|
20
|
+
before {
|
21
|
+
allow_any_instance_of(described_class).to receive(:require).with('win32/registry').and_raise(LoadError)
|
22
|
+
}
|
23
|
+
|
24
|
+
it 'should succeed' do
|
25
|
+
expect { described_class.new }.not_to raise_error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'on Windows', platform: :win32 do
|
30
|
+
let(:root) { Win32::Registry::HKEY_LOCAL_MACHINE }
|
31
|
+
|
32
|
+
let(:keys) {
|
33
|
+
described_class::KEYS.map do |key|
|
34
|
+
instance_double(Win32::Registry, keyname: key)
|
35
|
+
end
|
36
|
+
}
|
37
|
+
|
38
|
+
def allow_open_or_create(key)
|
39
|
+
allow(root).to receive(:create).with(key.keyname).and_yield(key)
|
40
|
+
end
|
41
|
+
|
42
|
+
def allow_open_for_deletion(key)
|
43
|
+
allow(root).to receive(:create).with(File.dirname(key.keyname)).and_yield(key)
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'MSDeploy registry key and "Version" value does not exist' do
|
47
|
+
before {
|
48
|
+
keys.each do |key|
|
49
|
+
allow(key).to receive(:created?).and_return(true)
|
50
|
+
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
51
|
+
allow(key).to receive(:[]=)
|
52
|
+
allow(key).to receive(:delete_key)
|
53
|
+
end
|
54
|
+
}
|
55
|
+
|
56
|
+
before {
|
57
|
+
keys.each do |key|
|
58
|
+
allow_open_or_create(key)
|
59
|
+
allow_open_for_deletion(key)
|
60
|
+
end
|
61
|
+
}
|
62
|
+
|
63
|
+
before {
|
64
|
+
described_class.new
|
65
|
+
}
|
66
|
+
|
67
|
+
it 'should create the key' do
|
68
|
+
keys.each do |key|
|
69
|
+
expect(root).to have_received(:create).with(key.keyname)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should create the version' do
|
74
|
+
keys.each do |key|
|
75
|
+
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should delete the key' do
|
80
|
+
keys.each do |key|
|
81
|
+
expect(key).to have_received(:delete_key).with(File.basename(key.keyname), true)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'MSDeploy registry key does exist' do
|
87
|
+
before {
|
88
|
+
keys.each do |key|
|
89
|
+
allow_open_or_create(key)
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
context '"Version" value does not exist' do
|
94
|
+
before {
|
95
|
+
keys.each do |key|
|
96
|
+
allow(key).to receive(:created?).and_return(false)
|
97
|
+
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
98
|
+
allow(key).to receive(:[]=)
|
99
|
+
allow(key).to receive(:delete_value)
|
100
|
+
end
|
101
|
+
}
|
102
|
+
|
103
|
+
before {
|
104
|
+
described_class.new
|
105
|
+
}
|
106
|
+
|
107
|
+
it 'should create the version' do
|
108
|
+
keys.each do |key|
|
109
|
+
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should delete the version' do
|
114
|
+
keys.each do |key|
|
115
|
+
expect(key).to have_received(:delete_value).with(described_class::VERSION_VALUE)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context '"Version" value does exist' do
|
121
|
+
before {
|
122
|
+
keys.each do |key|
|
123
|
+
allow(key).to receive(:created?).and_return(false)
|
124
|
+
allow(key).to receive(:[])
|
125
|
+
end
|
126
|
+
}
|
127
|
+
|
128
|
+
before {
|
129
|
+
described_class.new
|
130
|
+
}
|
131
|
+
|
132
|
+
it 'should do nothing' do
|
133
|
+
expect(true).to eq(true)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -1,108 +1,108 @@
|
|
1
|
-
describe Rake::Funnel::Support::Patch do
|
2
|
-
describe 'without definition' do
|
3
|
-
it 'should be applicable' do
|
4
|
-
subject.apply!
|
5
|
-
end
|
6
|
-
|
7
|
-
it 'should be revertable' do
|
8
|
-
subject.revert!
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should be applicable and revertable' do
|
12
|
-
subject.apply!.revert!
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'with definition' do
|
17
|
-
subject {
|
18
|
-
described_class.new do |p|
|
19
|
-
p.setup do
|
20
|
-
output.puts 'setup'
|
21
|
-
42
|
22
|
-
end
|
23
|
-
|
24
|
-
p.reset do |memo|
|
25
|
-
output.puts memo
|
26
|
-
end
|
27
|
-
end
|
28
|
-
}
|
29
|
-
|
30
|
-
let(:output) { double.as_null_object }
|
31
|
-
|
32
|
-
context 'when applying the patch' do
|
33
|
-
let!(:ret) { subject.apply! }
|
34
|
-
|
35
|
-
it 'should execute the setup' do
|
36
|
-
expect(output).to have_received(:puts).with('setup')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should return self' do
|
40
|
-
expect(ret).to eq(subject)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when reverting the patch' do
|
45
|
-
let!(:ret) {
|
46
|
-
subject.apply!
|
47
|
-
subject.revert!
|
48
|
-
}
|
49
|
-
|
50
|
-
it 'should execute the reset' do
|
51
|
-
expect(output).to have_received(:puts).with(42)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should return self' do
|
55
|
-
expect(ret).to eq(subject)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'when reverting an unapplied patch' do
|
60
|
-
before { subject.revert! }
|
61
|
-
|
62
|
-
it 'should not execute the reset' do
|
63
|
-
expect(output).to_not have_received(:puts).with(42)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when applying twice' do
|
68
|
-
before {
|
69
|
-
subject.apply!
|
70
|
-
subject.apply!
|
71
|
-
}
|
72
|
-
|
73
|
-
it 'should execute the setup once' do
|
74
|
-
expect(output).to have_received(:puts).with('setup').once
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'when reverting twice' do
|
79
|
-
before {
|
80
|
-
subject.apply!
|
81
|
-
subject.revert!
|
82
|
-
subject.revert!
|
83
|
-
}
|
84
|
-
|
85
|
-
it 'should execute the revert once' do
|
86
|
-
expect(output).to have_received(:puts).with(42).once
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe 'context' do
|
91
|
-
let(:context) { 42 }
|
92
|
-
|
93
|
-
subject {
|
94
|
-
described_class.new(context) do |p|
|
95
|
-
p.setup do |context|
|
96
|
-
output.puts context
|
97
|
-
end
|
98
|
-
end
|
99
|
-
}
|
100
|
-
|
101
|
-
before { subject.apply!.revert! }
|
102
|
-
|
103
|
-
it 'should be accessible from within the patch definition' do
|
104
|
-
expect(output).to have_received(:puts).with(42)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
1
|
+
describe Rake::Funnel::Support::Patch do
|
2
|
+
describe 'without definition' do
|
3
|
+
it 'should be applicable' do
|
4
|
+
subject.apply!
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'should be revertable' do
|
8
|
+
subject.revert!
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be applicable and revertable' do
|
12
|
+
subject.apply!.revert!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'with definition' do
|
17
|
+
subject {
|
18
|
+
described_class.new do |p|
|
19
|
+
p.setup do
|
20
|
+
output.puts 'setup'
|
21
|
+
42
|
22
|
+
end
|
23
|
+
|
24
|
+
p.reset do |memo|
|
25
|
+
output.puts memo
|
26
|
+
end
|
27
|
+
end
|
28
|
+
}
|
29
|
+
|
30
|
+
let(:output) { double.as_null_object }
|
31
|
+
|
32
|
+
context 'when applying the patch' do
|
33
|
+
let!(:ret) { subject.apply! }
|
34
|
+
|
35
|
+
it 'should execute the setup' do
|
36
|
+
expect(output).to have_received(:puts).with('setup')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return self' do
|
40
|
+
expect(ret).to eq(subject)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when reverting the patch' do
|
45
|
+
let!(:ret) {
|
46
|
+
subject.apply!
|
47
|
+
subject.revert!
|
48
|
+
}
|
49
|
+
|
50
|
+
it 'should execute the reset' do
|
51
|
+
expect(output).to have_received(:puts).with(42)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should return self' do
|
55
|
+
expect(ret).to eq(subject)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'when reverting an unapplied patch' do
|
60
|
+
before { subject.revert! }
|
61
|
+
|
62
|
+
it 'should not execute the reset' do
|
63
|
+
expect(output).to_not have_received(:puts).with(42)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when applying twice' do
|
68
|
+
before {
|
69
|
+
subject.apply!
|
70
|
+
subject.apply!
|
71
|
+
}
|
72
|
+
|
73
|
+
it 'should execute the setup once' do
|
74
|
+
expect(output).to have_received(:puts).with('setup').once
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when reverting twice' do
|
79
|
+
before {
|
80
|
+
subject.apply!
|
81
|
+
subject.revert!
|
82
|
+
subject.revert!
|
83
|
+
}
|
84
|
+
|
85
|
+
it 'should execute the revert once' do
|
86
|
+
expect(output).to have_received(:puts).with(42).once
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'context' do
|
91
|
+
let(:context) { 42 }
|
92
|
+
|
93
|
+
subject {
|
94
|
+
described_class.new(context) do |p|
|
95
|
+
p.setup do |context|
|
96
|
+
output.puts context
|
97
|
+
end
|
98
|
+
end
|
99
|
+
}
|
100
|
+
|
101
|
+
before { subject.apply!.revert! }
|
102
|
+
|
103
|
+
it 'should be accessible from within the patch definition' do
|
104
|
+
expect(output).to have_received(:puts).with(42)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
-
<ItemGroup>
|
4
|
-
<Reference Include="Sample-Ref-1">
|
5
|
-
<HintPath>somewhere\Sample-Ref-1.dll</HintPath>
|
6
|
-
</Reference>
|
7
|
-
<Reference Include="Sample-Ref-2" />
|
8
|
-
<Reference Include="System" />
|
9
|
-
</ItemGroup>
|
10
|
-
<ItemGroup>
|
11
|
-
<Compile Include="Specs.cs" />
|
12
|
-
<Compile Include="FooCode.cs" />
|
13
|
-
<Compile Include="FooSpecs.cs" />
|
14
|
-
<Compile Include="subdir\BarCode.cs" />
|
15
|
-
<Compile Include="subdir\BarSpecs.cs" />
|
16
|
-
</ItemGroup>
|
17
|
-
<Choose>
|
18
|
-
<When Condition="ignored">
|
19
|
-
<ItemGroup>
|
20
|
-
<Reference Include="Sample-Ref-3">
|
21
|
-
<HintPath>packages\sample\sample.dll</HintPath>
|
22
|
-
<Private>True</Private>
|
23
|
-
<Paket>True</Paket>
|
24
|
-
</Reference>
|
25
|
-
</ItemGroup>
|
26
|
-
</When>
|
27
|
-
</Choose>
|
28
|
-
</Project>
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
3
|
+
<ItemGroup>
|
4
|
+
<Reference Include="Sample-Ref-1">
|
5
|
+
<HintPath>somewhere\Sample-Ref-1.dll</HintPath>
|
6
|
+
</Reference>
|
7
|
+
<Reference Include="Sample-Ref-2" />
|
8
|
+
<Reference Include="System" />
|
9
|
+
</ItemGroup>
|
10
|
+
<ItemGroup>
|
11
|
+
<Compile Include="Specs.cs" />
|
12
|
+
<Compile Include="FooCode.cs" />
|
13
|
+
<Compile Include="FooSpecs.cs" />
|
14
|
+
<Compile Include="subdir\BarCode.cs" />
|
15
|
+
<Compile Include="subdir\BarSpecs.cs" />
|
16
|
+
</ItemGroup>
|
17
|
+
<Choose>
|
18
|
+
<When Condition="ignored">
|
19
|
+
<ItemGroup>
|
20
|
+
<Reference Include="Sample-Ref-3">
|
21
|
+
<HintPath>packages\sample\sample.dll</HintPath>
|
22
|
+
<Private>True</Private>
|
23
|
+
<Paket>True</Paket>
|
24
|
+
</Reference>
|
25
|
+
</ItemGroup>
|
26
|
+
</When>
|
27
|
+
</Choose>
|
28
|
+
</Project>
|