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,247 +1,249 @@
|
|
1
|
-
require 'configatron'
|
2
|
-
|
3
|
-
include Rake
|
4
|
-
include Rake::Funnel::Support::Environments
|
5
|
-
include Rake::Funnel::Tasks
|
6
|
-
|
7
|
-
describe Rake::Funnel::Tasks::Environments do
|
8
|
-
include Rake::DSL
|
9
|
-
|
10
|
-
before {
|
11
|
-
Task.clear
|
12
|
-
}
|
13
|
-
|
14
|
-
let(:files) { [] }
|
15
|
-
|
16
|
-
before {
|
17
|
-
allow(Dir).to receive(:[]).and_return(files)
|
18
|
-
}
|
19
|
-
|
20
|
-
def disable_default_env_setup
|
21
|
-
allow_any_instance_of(described_class).to receive(:default_environment_setup)
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'defaults' do
|
25
|
-
before {
|
26
|
-
disable_default_env_setup
|
27
|
-
}
|
28
|
-
|
29
|
-
its(:store) { should == configatron }
|
30
|
-
its(:base_dir) { should == 'config' }
|
31
|
-
its(:default_env) { should be_nil }
|
32
|
-
its(:default_config) { should == 'default' }
|
33
|
-
its(:local_config) { should == 'local' }
|
34
|
-
its(:customizer) { should be_nil }
|
35
|
-
|
36
|
-
describe 'overriding defaults' do
|
37
|
-
let(:store) { OpenStruct.new }
|
38
|
-
|
39
|
-
subject {
|
40
|
-
described_class.new do |t|
|
41
|
-
t.store = store
|
42
|
-
t.base_dir = 'custom base_dir'
|
43
|
-
t.default_env = 'custom default_env'
|
44
|
-
t.default_config = 'custom default_config'
|
45
|
-
t.local_config = 'custom local_config'
|
46
|
-
t.customizer =
|
47
|
-
end
|
48
|
-
}
|
49
|
-
|
50
|
-
its(:store) { should == store }
|
51
|
-
its(:base_dir) { should == subject.base_dir }
|
52
|
-
its(:default_env) { should == subject.default_env }
|
53
|
-
its(:default_config) { should == subject.default_config }
|
54
|
-
its(:local_config) { should == subject.local_config }
|
55
|
-
its(:customizer) { should be_instance_of(Proc) }
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'definition' do
|
60
|
-
before {
|
61
|
-
disable_default_env_setup
|
62
|
-
}
|
63
|
-
|
64
|
-
before {
|
65
|
-
allow_any_instance_of(described_class).to receive(:task)
|
66
|
-
}
|
67
|
-
|
68
|
-
let(:files) {
|
69
|
-
%w(config/default.yaml config/local.yaml config/dev.yaml config/production.yaml)
|
70
|
-
}
|
71
|
-
|
72
|
-
it 'should define a task for each config file' do
|
73
|
-
expect(subject).to have_received(:task).with('dev')
|
74
|
-
expect(subject).to have_received(:task).with('production')
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should omit environment for the default config file' do
|
78
|
-
expect(subject).not_to have_received(:task).with('default')
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should omit environment for the local config file' do
|
82
|
-
expect(subject).not_to have_received(:task).with('local')
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'config files to load' do
|
87
|
-
let(:optional) { nil }
|
88
|
-
let(:files) {
|
89
|
-
%w(config/dev.yaml)
|
90
|
-
}
|
91
|
-
|
92
|
-
before {
|
93
|
-
allow(Loader).to receive(:load_configuration)
|
94
|
-
}
|
95
|
-
|
96
|
-
before {
|
97
|
-
allow(File).to receive(:
|
98
|
-
allow(File).to receive(:
|
99
|
-
}
|
100
|
-
|
101
|
-
subject! {
|
102
|
-
described_class.new do |t|
|
103
|
-
t.default_env = 'dev'
|
104
|
-
end
|
105
|
-
}
|
106
|
-
|
107
|
-
before {
|
108
|
-
Task['dev'].invoke
|
109
|
-
}
|
110
|
-
|
111
|
-
it 'should store configuration in configatron singleton' do
|
112
|
-
expect(Loader).to have_received(:load_configuration).with(anything, configatron, any_args)
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'default and local config files exist' do
|
116
|
-
let(:optional) { nil }
|
117
|
-
|
118
|
-
it 'should load all files' do
|
119
|
-
expect(Loader)
|
120
|
-
.to have_received(:load_configuration)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
end
|
1
|
+
require 'configatron'
|
2
|
+
|
3
|
+
include Rake
|
4
|
+
include Rake::Funnel::Support::Environments
|
5
|
+
include Rake::Funnel::Tasks
|
6
|
+
|
7
|
+
describe Rake::Funnel::Tasks::Environments do
|
8
|
+
include Rake::DSL
|
9
|
+
|
10
|
+
before {
|
11
|
+
Task.clear
|
12
|
+
}
|
13
|
+
|
14
|
+
let(:files) { [] }
|
15
|
+
|
16
|
+
before {
|
17
|
+
allow(Dir).to receive(:[]).and_return(files)
|
18
|
+
}
|
19
|
+
|
20
|
+
def disable_default_env_setup
|
21
|
+
allow_any_instance_of(described_class).to receive(:default_environment_setup)
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'defaults' do
|
25
|
+
before {
|
26
|
+
disable_default_env_setup
|
27
|
+
}
|
28
|
+
|
29
|
+
its(:store) { should == configatron }
|
30
|
+
its(:base_dir) { should == 'config' }
|
31
|
+
its(:default_env) { should be_nil }
|
32
|
+
its(:default_config) { should == 'default' }
|
33
|
+
its(:local_config) { should == 'local' }
|
34
|
+
its(:customizer) { should be_nil }
|
35
|
+
|
36
|
+
describe 'overriding defaults' do
|
37
|
+
let(:store) { OpenStruct.new }
|
38
|
+
|
39
|
+
subject {
|
40
|
+
described_class.new do |t|
|
41
|
+
t.store = store
|
42
|
+
t.base_dir = 'custom base_dir'
|
43
|
+
t.default_env = 'custom default_env'
|
44
|
+
t.default_config = 'custom default_config'
|
45
|
+
t.local_config = 'custom local_config'
|
46
|
+
t.customizer = proc {}
|
47
|
+
end
|
48
|
+
}
|
49
|
+
|
50
|
+
its(:store) { should == store }
|
51
|
+
its(:base_dir) { should == subject.base_dir }
|
52
|
+
its(:default_env) { should == subject.default_env }
|
53
|
+
its(:default_config) { should == subject.default_config }
|
54
|
+
its(:local_config) { should == subject.local_config }
|
55
|
+
its(:customizer) { should be_instance_of(Proc) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'definition' do
|
60
|
+
before {
|
61
|
+
disable_default_env_setup
|
62
|
+
}
|
63
|
+
|
64
|
+
before {
|
65
|
+
allow_any_instance_of(described_class).to receive(:task)
|
66
|
+
}
|
67
|
+
|
68
|
+
let(:files) {
|
69
|
+
%w(config/default.yaml config/local.yaml config/dev.yaml config/production.yaml)
|
70
|
+
}
|
71
|
+
|
72
|
+
it 'should define a task for each config file' do
|
73
|
+
expect(subject).to have_received(:task).with('dev')
|
74
|
+
expect(subject).to have_received(:task).with('production')
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should omit environment for the default config file' do
|
78
|
+
expect(subject).not_to have_received(:task).with('default')
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should omit environment for the local config file' do
|
82
|
+
expect(subject).not_to have_received(:task).with('local')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'config files to load' do
|
87
|
+
let(:optional) { nil }
|
88
|
+
let(:files) {
|
89
|
+
%w(config/dev.yaml)
|
90
|
+
}
|
91
|
+
|
92
|
+
before {
|
93
|
+
allow(Loader).to receive(:load_configuration)
|
94
|
+
}
|
95
|
+
|
96
|
+
before {
|
97
|
+
allow(File).to receive(:exist?).and_return(true)
|
98
|
+
allow(File).to receive(:exist?).with(optional).and_return(false)
|
99
|
+
}
|
100
|
+
|
101
|
+
subject! {
|
102
|
+
described_class.new do |t|
|
103
|
+
t.default_env = 'dev'
|
104
|
+
end
|
105
|
+
}
|
106
|
+
|
107
|
+
before {
|
108
|
+
Task['dev'].invoke
|
109
|
+
}
|
110
|
+
|
111
|
+
it 'should store configuration in configatron singleton' do
|
112
|
+
expect(Loader).to have_received(:load_configuration).with(anything, configatron, any_args)
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'default and local config files exist' do
|
116
|
+
let(:optional) { nil }
|
117
|
+
|
118
|
+
it 'should load all files' do
|
119
|
+
expect(Loader)
|
120
|
+
.to have_received(:load_configuration)
|
121
|
+
.with(hash_including({ config_files: %w(config/default.yaml config/dev.yaml config/local.yaml) }), any_args)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'default config file does not exist' do
|
126
|
+
let(:optional) { 'config/default.yaml' }
|
127
|
+
|
128
|
+
it 'should load environment file and local file' do
|
129
|
+
expect(Loader)
|
130
|
+
.to have_received(:load_configuration)
|
131
|
+
.with(hash_including({ config_files: %w(config/dev.yaml config/local.yaml) }), any_args)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'local config file does not exist' do
|
136
|
+
let(:optional) { 'config/local.yaml' }
|
137
|
+
|
138
|
+
it 'should load default file and environment file' do
|
139
|
+
expect(Loader)
|
140
|
+
.to have_received(:load_configuration).with(hash_including({ config_files: %w(config/default.yaml config/dev.yaml) }), any_args)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe 'customization' do
|
146
|
+
let(:customizer) { proc {} }
|
147
|
+
let(:files) {
|
148
|
+
%w(config/dev.yaml)
|
149
|
+
}
|
150
|
+
|
151
|
+
subject! {
|
152
|
+
described_class.new do |t|
|
153
|
+
t.customizer = customizer
|
154
|
+
end
|
155
|
+
}
|
156
|
+
|
157
|
+
before {
|
158
|
+
allow(Loader).to receive(:load_configuration)
|
159
|
+
}
|
160
|
+
|
161
|
+
before {
|
162
|
+
Task['dev'].invoke
|
163
|
+
}
|
164
|
+
|
165
|
+
it 'should pass customizer to loader' do
|
166
|
+
expect(Loader).to have_received(:load_configuration).with(anything, anything, customizer)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe 'automatic environment setup' do
|
171
|
+
let(:files) {
|
172
|
+
%w(config/dev.yaml config/production.yaml)
|
173
|
+
}
|
174
|
+
|
175
|
+
before {
|
176
|
+
Rake.application.top_level_tasks.clear
|
177
|
+
Rake.application.top_level_tasks.push(*top_level_tasks)
|
178
|
+
}
|
179
|
+
|
180
|
+
context 'environment task defined in top-level Rake namespace' do
|
181
|
+
subject! {
|
182
|
+
described_class.new do |t|
|
183
|
+
t.default_env = default_env
|
184
|
+
end
|
185
|
+
}
|
186
|
+
|
187
|
+
context 'no default environment configured' do
|
188
|
+
let(:default_env) { nil }
|
189
|
+
let(:top_level_tasks) { [] }
|
190
|
+
|
191
|
+
it 'should not add top-level environment tasks' do
|
192
|
+
expect(Rake.application.top_level_tasks).to be_empty
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'default environment configured' do
|
197
|
+
let(:default_env) { 'dev' }
|
198
|
+
|
199
|
+
context 'no top-level environment task' do
|
200
|
+
let(:top_level_tasks) { %w(foo) }
|
201
|
+
|
202
|
+
it 'should prepend default top-level environment task' do
|
203
|
+
expect(Rake.application.top_level_tasks).to eq([default_env] + top_level_tasks)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context 'top-level environment task' do
|
208
|
+
let(:top_level_tasks) { %w(foo production) }
|
209
|
+
|
210
|
+
it 'should move top-level environment task to front' do
|
211
|
+
expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'environment task defined in Rake namespace' do
|
218
|
+
subject! {
|
219
|
+
namespace :foo do
|
220
|
+
namespace :bar do
|
221
|
+
described_class.new do |t|
|
222
|
+
t.default_env = default_env
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
}
|
227
|
+
|
228
|
+
context 'default environment configured' do
|
229
|
+
let(:default_env) { 'dev' }
|
230
|
+
|
231
|
+
context 'no top-level environment task' do
|
232
|
+
let(:top_level_tasks) { %w(foo) }
|
233
|
+
|
234
|
+
it 'should prepend default top-level environment task' do
|
235
|
+
expect(Rake.application.top_level_tasks).to eq(["foo:bar:#{default_env}"] + top_level_tasks)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
context 'top-level environment task' do
|
240
|
+
let(:top_level_tasks) { %w(foo foo:bar:production) }
|
241
|
+
|
242
|
+
it 'should move top-level environment task to front' do
|
243
|
+
expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -1,91 +1,91 @@
|
|
1
|
-
include Rake
|
2
|
-
include Rake::Funnel
|
3
|
-
include Rake::Funnel::Support
|
4
|
-
include Rake::Funnel::Support::MSBuild
|
5
|
-
|
6
|
-
describe Rake::Funnel::Tasks::MSBuild do
|
7
|
-
before {
|
8
|
-
Task.clear
|
9
|
-
}
|
10
|
-
|
11
|
-
describe 'defaults' do
|
12
|
-
its(:name) { should == :compile }
|
13
|
-
its(:project_or_solution) { should be_instance_of(Finder) }
|
14
|
-
its(:args) { should == {} }
|
15
|
-
its(:search_pattern) { should == %w(**/*.sln) }
|
16
|
-
|
17
|
-
describe 'build tool' do
|
18
|
-
before {
|
19
|
-
allow(BuildTool).to receive(:find).and_return('build tool')
|
20
|
-
}
|
21
|
-
|
22
|
-
it 'should use build tool finder' do
|
23
|
-
expect(subject.msbuild).to eq('build tool')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'execution' do
|
29
|
-
let(:args) { {} }
|
30
|
-
|
31
|
-
let(:mapper) { double(Mapper).as_null_object }
|
32
|
-
let(:finder) { double(Finder).as_null_object }
|
33
|
-
|
34
|
-
before {
|
35
|
-
allow(subject).to receive(:sh)
|
36
|
-
|
37
|
-
allow(Mapper).to receive(:new).and_return(mapper)
|
38
|
-
allow(Finder).to receive(:new).and_return(finder)
|
39
|
-
}
|
40
|
-
|
41
|
-
before {
|
42
|
-
Task[subject.name].invoke
|
43
|
-
}
|
44
|
-
|
45
|
-
it 'should use solution finder' do
|
46
|
-
expect(finder).to have_received(:single)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should use MSBuild mapper' do
|
50
|
-
expect(Mapper).to have_received(:new).with(:MSBuild)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should map arguments' do
|
54
|
-
expect(mapper).to have_received(:map).with(args)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should run with sh' do
|
58
|
-
expect(subject).to have_received(:sh)
|
59
|
-
end
|
60
|
-
|
61
|
-
describe 'overriding defaults' do
|
62
|
-
context 'when msbuild executable is specified' do
|
63
|
-
subject {
|
64
|
-
described_class.new do |t|
|
65
|
-
t.msbuild = 'custom build tool.exe'
|
66
|
-
end
|
67
|
-
}
|
68
|
-
|
69
|
-
its(:msbuild) { should == 'custom build tool.exe' }
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'when project or solution is specified' do
|
73
|
-
before {
|
74
|
-
allow(Finder).to receive(:new).and_call_original
|
75
|
-
}
|
76
|
-
|
77
|
-
subject {
|
78
|
-
described_class.new do |t|
|
79
|
-
t.project_or_solution = 'project.sln'
|
80
|
-
end
|
81
|
-
}
|
82
|
-
|
83
|
-
its(:project_or_solution) { should be_instance_of(Finder) }
|
84
|
-
|
85
|
-
it 'should set project or solution' do
|
86
|
-
expect(Finder).to have_received(:new).with('project.sln', subject, 'No projects or more than one project found.')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel
|
3
|
+
include Rake::Funnel::Support
|
4
|
+
include Rake::Funnel::Support::MSBuild
|
5
|
+
|
6
|
+
describe Rake::Funnel::Tasks::MSBuild do
|
7
|
+
before {
|
8
|
+
Task.clear
|
9
|
+
}
|
10
|
+
|
11
|
+
describe 'defaults' do
|
12
|
+
its(:name) { should == :compile }
|
13
|
+
its(:project_or_solution) { should be_instance_of(Finder) }
|
14
|
+
its(:args) { should == {} }
|
15
|
+
its(:search_pattern) { should == %w(**/*.sln) }
|
16
|
+
|
17
|
+
describe 'build tool' do
|
18
|
+
before {
|
19
|
+
allow(BuildTool).to receive(:find).and_return('build tool')
|
20
|
+
}
|
21
|
+
|
22
|
+
it 'should use build tool finder' do
|
23
|
+
expect(subject.msbuild).to eq('build tool')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'execution' do
|
29
|
+
let(:args) { {} }
|
30
|
+
|
31
|
+
let(:mapper) { double(Mapper).as_null_object }
|
32
|
+
let(:finder) { double(Finder).as_null_object }
|
33
|
+
|
34
|
+
before {
|
35
|
+
allow(subject).to receive(:sh)
|
36
|
+
|
37
|
+
allow(Mapper).to receive(:new).and_return(mapper)
|
38
|
+
allow(Finder).to receive(:new).and_return(finder)
|
39
|
+
}
|
40
|
+
|
41
|
+
before {
|
42
|
+
Task[subject.name].invoke
|
43
|
+
}
|
44
|
+
|
45
|
+
it 'should use solution finder' do
|
46
|
+
expect(finder).to have_received(:single)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should use MSBuild mapper' do
|
50
|
+
expect(Mapper).to have_received(:new).with(:MSBuild)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should map arguments' do
|
54
|
+
expect(mapper).to have_received(:map).with(args)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should run with sh' do
|
58
|
+
expect(subject).to have_received(:sh)
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'overriding defaults' do
|
62
|
+
context 'when msbuild executable is specified' do
|
63
|
+
subject {
|
64
|
+
described_class.new do |t|
|
65
|
+
t.msbuild = 'custom build tool.exe'
|
66
|
+
end
|
67
|
+
}
|
68
|
+
|
69
|
+
its(:msbuild) { should == 'custom build tool.exe' }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when project or solution is specified' do
|
73
|
+
before {
|
74
|
+
allow(Finder).to receive(:new).and_call_original
|
75
|
+
}
|
76
|
+
|
77
|
+
subject {
|
78
|
+
described_class.new do |t|
|
79
|
+
t.project_or_solution = 'project.sln'
|
80
|
+
end
|
81
|
+
}
|
82
|
+
|
83
|
+
its(:project_or_solution) { should be_instance_of(Finder) }
|
84
|
+
|
85
|
+
it 'should set project or solution' do
|
86
|
+
expect(Finder).to have_received(:new).with('project.sln', subject, 'No projects or more than one project found.')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|