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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/Gemfile +4 -0
  4. data/README.md +2 -2
  5. data/lib/rake/funnel/ambiguous_file_error.rb +31 -29
  6. data/lib/rake/funnel/execution_error.rb +28 -26
  7. data/lib/rake/funnel/extensions/case/camel_case.rb +24 -19
  8. data/lib/rake/funnel/extensions/case/pascal_case.rb +24 -19
  9. data/lib/rake/funnel/extensions/case.rb +3 -3
  10. data/lib/rake/funnel/extensions/common_path.rb +60 -52
  11. data/lib/rake/funnel/extensions/disable_colors.rb +33 -27
  12. data/lib/rake/funnel/extensions/rexml.rb +27 -23
  13. data/lib/rake/funnel/extensions/shell.rb +92 -56
  14. data/lib/rake/funnel/extensions/windows_path.rb +15 -11
  15. data/lib/rake/funnel/framework.rb +11 -16
  16. data/lib/rake/funnel/integration/progress_report.rb +72 -70
  17. data/lib/rake/funnel/integration/sync_output.rb +12 -8
  18. data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +61 -55
  19. data/lib/rake/funnel/integration/teamcity/progress_report.rb +39 -33
  20. data/lib/rake/funnel/integration/teamcity/service_messages.rb +46 -40
  21. data/lib/rake/funnel/integration/teamcity/teamcity.rb +19 -15
  22. data/lib/rake/funnel/integration/teamcity.rb +3 -5
  23. data/lib/rake/funnel/support/argument_mapper/key_value_pair.rb +16 -10
  24. data/lib/rake/funnel/support/argument_mapper/styles/default.rb +39 -31
  25. data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +41 -33
  26. data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +55 -47
  27. data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +41 -33
  28. data/lib/rake/funnel/support/argument_mapper/styles.rb +3 -5
  29. data/lib/rake/funnel/support/argument_mapper/switch.rb +16 -10
  30. data/lib/rake/funnel/support/argument_mapper/value.rb +16 -10
  31. data/lib/rake/funnel/support/assembly_version/from_version_files.rb +39 -35
  32. data/lib/rake/funnel/support/assembly_version/languages/cs +5 -5
  33. data/lib/rake/funnel/support/assembly_version/languages/fs +12 -12
  34. data/lib/rake/funnel/support/assembly_version/languages/vb +5 -5
  35. data/lib/rake/funnel/support/assembly_version_writer.rb +56 -52
  36. data/lib/rake/funnel/support/binary_version_reader.rb +37 -32
  37. data/lib/rake/funnel/support/copier.rb +31 -27
  38. data/lib/rake/funnel/support/environments/loader.rb +46 -40
  39. data/lib/rake/funnel/support/environments.rb +3 -3
  40. data/lib/rake/funnel/support/internal/finder.rb +55 -51
  41. data/lib/rake/funnel/support/internal/instantiate_symbol.rb +38 -34
  42. data/lib/rake/funnel/support/mapper.rb +57 -53
  43. data/lib/rake/funnel/support/mono.rb +21 -17
  44. data/lib/rake/funnel/support/msbuild/build_tool.rb +30 -24
  45. data/lib/rake/funnel/support/msbuild.rb +3 -3
  46. data/lib/rake/funnel/support/msdeploy/registry_patch.rb +90 -84
  47. data/lib/rake/funnel/support/msdeploy.rb +3 -3
  48. data/lib/rake/funnel/support/patch.rb +41 -37
  49. data/lib/rake/funnel/support/specs_remover.rb +66 -62
  50. data/lib/rake/funnel/support/template_engine.rb +30 -26
  51. data/lib/rake/funnel/support/timing/report.rb +95 -89
  52. data/lib/rake/funnel/support/timing/statistics.rb +32 -26
  53. data/lib/rake/funnel/support/timing.rb +3 -3
  54. data/lib/rake/funnel/support/version_info.rb +103 -72
  55. data/lib/rake/funnel/support/which.rb +19 -15
  56. data/lib/rake/funnel/support/zipper.rb +53 -49
  57. data/lib/rake/funnel/tasks/assembly_version.rb +44 -40
  58. data/lib/rake/funnel/tasks/bin_path.rb +45 -41
  59. data/lib/rake/funnel/tasks/copy.rb +43 -39
  60. data/lib/rake/funnel/tasks/environments.rb +89 -89
  61. data/lib/rake/funnel/tasks/msbuild.rb +55 -51
  62. data/lib/rake/funnel/tasks/msdeploy.rb +54 -50
  63. data/lib/rake/funnel/tasks/nunit.rb +52 -48
  64. data/lib/rake/funnel/tasks/paket.rb +51 -47
  65. data/lib/rake/funnel/tasks/quick_template.rb +53 -49
  66. data/lib/rake/funnel/tasks/side_by_side_specs.rb +41 -37
  67. data/lib/rake/funnel/tasks/timing.rb +108 -104
  68. data/lib/rake/funnel/tasks/zip.rb +46 -42
  69. data/lib/rake/funnel/version.rb +1 -1
  70. data/lib/rake/funnel.rb +7 -7
  71. data/rake-funnel.gemspec +12 -3
  72. data/spec/rake/funnel/execution_error_spec.rb +67 -67
  73. data/spec/rake/funnel/extensions/case/camel_case_spec.rb +17 -17
  74. data/spec/rake/funnel/extensions/case/pascal_case_spec.rb +17 -17
  75. data/spec/rake/funnel/extensions/common_path_spec.rb +56 -56
  76. data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -33
  77. data/spec/rake/funnel/extensions/rexml_spec.rb +20 -20
  78. data/spec/rake/funnel/extensions/shell_spec.rb +237 -237
  79. data/spec/rake/funnel/extensions/windows_path_spec.rb +5 -5
  80. data/spec/rake/funnel/integration/progress_report_spec.rb +149 -149
  81. data/spec/rake/funnel/integration/sync_output_spec.rb +16 -16
  82. data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +110 -110
  83. data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -174
  84. data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -136
  85. data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -34
  86. data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +222 -222
  87. data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +25 -25
  88. data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +214 -214
  89. data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +66 -61
  90. data/spec/rake/funnel/support/assembly_version_writer_spec.rb +140 -140
  91. data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -29
  92. data/spec/rake/funnel/support/copier_spec.rb +58 -58
  93. data/spec/rake/funnel/support/environments/loader_spec.rb +143 -143
  94. data/spec/rake/funnel/support/internal/finder_spec.rb +229 -229
  95. data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +182 -183
  96. data/spec/rake/funnel/support/mapper_spec.rb +87 -87
  97. data/spec/rake/funnel/support/mono_spec.rb +57 -57
  98. data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +21 -21
  99. data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +139 -139
  100. data/spec/rake/funnel/support/patch_spec.rb +108 -108
  101. data/spec/rake/funnel/support/specs_remover/Sample.csproj +28 -28
  102. data/spec/rake/funnel/support/specs_remover_spec.rb +116 -116
  103. data/spec/rake/funnel/support/template_engine_spec.rb +65 -65
  104. data/spec/rake/funnel/support/timing/report_spec.rb +129 -129
  105. data/spec/rake/funnel/support/version_info_spec.rb +333 -228
  106. data/spec/rake/funnel/support/which_spec.rb +65 -65
  107. data/spec/rake/funnel/support/zipper_spec.rb +77 -77
  108. data/spec/rake/funnel/tasks/assembly_version_spec.rb +45 -45
  109. data/spec/rake/funnel/tasks/bin_path_spec.rb +52 -52
  110. data/spec/rake/funnel/tasks/copy_spec.rb +44 -44
  111. data/spec/rake/funnel/tasks/environments_spec.rb +249 -247
  112. data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -91
  113. data/spec/rake/funnel/tasks/msdeploy_spec.rb +220 -220
  114. data/spec/rake/funnel/tasks/nunit_spec.rb +74 -74
  115. data/spec/rake/funnel/tasks/paket_spec.rb +140 -142
  116. data/spec/rake/funnel/tasks/quick_template_spec.rb +62 -62
  117. data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -58
  118. data/spec/rake/funnel/tasks/timing_spec.rb +133 -133
  119. data/spec/rake/funnel/tasks/zip_spec.rb +50 -50
  120. data/spec/spec_helper.rb +43 -33
  121. metadata +2 -3
  122. 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 = Proc.new {}
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(:exists?).and_return(true)
98
- allow(File).to receive(:exists?).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).with(hash_including({ config_files: %w(config/default.yaml config/dev.yaml config/local.yaml) }), any_args)
121
- end
122
- end
123
-
124
- context 'default config file does not exist' do
125
- let(:optional) { 'config/default.yaml' }
126
-
127
- it 'should load environment file and local file' do
128
- expect(Loader)
129
- .to have_received(:load_configuration).with(hash_including({ config_files: %w(config/dev.yaml config/local.yaml) }), any_args)
130
- end
131
- end
132
-
133
- context 'local config file does not exist' do
134
- let(:optional) { 'config/local.yaml' }
135
-
136
- it 'should load default file and environment file' do
137
- expect(Loader)
138
- .to have_received(:load_configuration).with(hash_including({ config_files: %w(config/default.yaml config/dev.yaml) }), any_args)
139
- end
140
- end
141
- end
142
-
143
- describe 'customization' do
144
- let(:customizer) { Proc.new {} }
145
- let(:files) {
146
- %w(config/dev.yaml)
147
- }
148
-
149
- subject! {
150
- described_class.new do |t|
151
- t.customizer = customizer
152
- end
153
- }
154
-
155
- before {
156
- allow(Loader).to receive(:load_configuration)
157
- }
158
-
159
- before {
160
- Task['dev'].invoke
161
- }
162
-
163
- it 'should pass customizer to loader' do
164
- expect(Loader).to have_received(:load_configuration).with(anything, anything, customizer)
165
- end
166
- end
167
-
168
- describe 'automatic environment setup' do
169
- let(:files) {
170
- %w(config/dev.yaml config/production.yaml)
171
- }
172
-
173
- before {
174
- Rake.application.top_level_tasks.clear
175
- Rake.application.top_level_tasks.push(*top_level_tasks)
176
- }
177
-
178
- context 'environment task defined in top-level Rake namespace' do
179
- subject! {
180
- described_class.new do |t|
181
- t.default_env = default_env
182
- end
183
- }
184
-
185
- context 'no default environment configured' do
186
- let(:default_env) { nil }
187
- let(:top_level_tasks) { [] }
188
-
189
- it 'should not add top-level environment tasks' do
190
- expect(Rake.application.top_level_tasks).to be_empty
191
- end
192
- end
193
-
194
- context 'default environment configured' do
195
- let(:default_env) { 'dev' }
196
-
197
- context 'no top-level environment task' do
198
- let(:top_level_tasks) { %w(foo) }
199
-
200
- it 'should prepend default top-level environment task' do
201
- expect(Rake.application.top_level_tasks).to eq([default_env] + top_level_tasks)
202
- end
203
- end
204
-
205
- context 'top-level environment task' do
206
- let(:top_level_tasks) { %w(foo production) }
207
-
208
- it 'should move top-level environment task to front' do
209
- expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
210
- end
211
- end
212
- end
213
- end
214
-
215
- context 'environment task defined in Rake namespace' do
216
- subject! {
217
- namespace :foo do
218
- namespace :bar do
219
- described_class.new do |t|
220
- t.default_env = default_env
221
- end
222
- end
223
- end
224
- }
225
-
226
- context 'default environment configured' do
227
- let(:default_env) { 'dev' }
228
-
229
- context 'no top-level environment task' do
230
- let(:top_level_tasks) { %w(foo) }
231
-
232
- it 'should prepend default top-level environment task' do
233
- expect(Rake.application.top_level_tasks).to eq(["foo:bar:#{default_env}"] + top_level_tasks)
234
- end
235
- end
236
-
237
- context 'top-level environment task' do
238
- let(:top_level_tasks) { %w(foo foo:bar:production) }
239
-
240
- it 'should move top-level environment task to front' do
241
- expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
242
- end
243
- end
244
- end
245
- end
246
- end
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