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,214 +1,214 @@
1
- include Rake::Funnel::Support::ArgumentMapper
2
-
3
- Styles.constants.reject { |x| x == :MSDeploy }.each do |style|
4
- style_path = Styles.const_get(style)
5
- describe style_path do
6
- subject {
7
- Mapper.new(style)
8
- }
9
-
10
- let (:style) {
11
- Styles.const_get(style).new
12
- }
13
-
14
- def styled(switch, key = nil, value = nil)
15
- unless style.respond_to?(:separator)
16
- styled = [
17
- [
18
- style.prefix,
19
- switch
20
- ],
21
- [
22
- key && key,
23
- value && style.value_separator,
24
- value && value
25
- ]
26
- ]
27
- else
28
- styled = [
29
- [
30
- style.prefix,
31
- switch,
32
- key && style.separator,
33
- key && key,
34
- value && style.value_separator,
35
- value && value
36
- ]
37
- ]
38
- end
39
-
40
- styled.map(&:join).reject(&:empty?)
41
- end
42
-
43
- describe 'no arguments' do
44
- it 'should convert no args to []' do
45
- expect(subject.map).to match_array([])
46
- end
47
-
48
- it 'should convert {} to []' do
49
- expect(subject.map({})).to match_array([])
50
- end
51
- end
52
-
53
- describe 'truthy arguments' do
54
- it 'should convert switch => <true>' do
55
- args = { switch: true }
56
- expect(subject.map(args)).to match_array(styled('switch', 'true'))
57
- end
58
-
59
- it 'should convert switch => <truthy>' do
60
- args = { switch: 1 }
61
- expect(subject.map(args)).to match_array(styled('switch', '1'))
62
- end
63
-
64
- it 'should convert switch => <symbol>' do
65
- args = { switch: :one }
66
- expect(subject.map(args)).to match_array(styled('switch', 'one'))
67
- end
68
-
69
- it 'should convert switch => <string>' do
70
- args = { switch: 'one' }
71
- expect(subject.map(args)).to match_array(styled('switch', 'one'))
72
- end
73
-
74
- it 'should convert switch => <truthy> enumerable' do
75
- args = { switch: [true, 1] }
76
- expect(subject.map(args)).to match_array(
77
- [
78
- *styled('switch', 'true'),
79
- *styled('switch', '1')
80
- ])
81
- end
82
-
83
- it 'should convert hash values' do
84
- args = { switch: { foo: true, bar: true } }
85
- expect(subject.map(args)).to match_array(
86
- [
87
- *styled('switch', 'foo', 'true'),
88
- *styled('switch', 'bar', 'true')
89
- ])
90
- end
91
-
92
- it 'should convert enumerable hash values' do
93
- args = { switch: [{ foo: true, bar: 1 }, { baz: :baz, foobar: 'foobar' }] }
94
- expect(subject.map(args)).to match_array(
95
- [
96
- *styled('switch', 'foo', 'true'),
97
- *styled('switch', 'bar', '1'),
98
- *styled('switch', 'baz', 'baz'),
99
- *styled('switch', 'foobar', 'foobar'),
100
- ])
101
- end
102
- end
103
-
104
- describe 'falsy arguments' do
105
- it 'should convert switch => <false>' do
106
- args = { switch: false }
107
- expect(subject.map(args)).to match_array(styled('switch', 'false'))
108
- end
109
-
110
- it 'should convert switch => <falsy>' do
111
- args = { switch: nil }
112
- expect(subject.map(args)).to match_array(styled('switch'))
113
- end
114
-
115
- it 'should convert switch => <falsy> enumerable' do
116
- args = { switch: [false, nil] }
117
- expect(subject.map(args)).to match_array(
118
- [
119
- *styled('switch', 'false'),
120
- *styled('switch')
121
- ])
122
- end
123
-
124
- it 'should convert hash values' do
125
- args = { switch: { foo: false, bar: nil } }
126
- expect(subject.map(args)).to match_array(
127
- [
128
- *styled('switch', 'foo', 'false'),
129
- *styled('switch', 'bar')
130
- ])
131
- end
132
-
133
- it 'should convert enumerable hash values' do
134
- args = { switch: [{ foo: false }, { bar: nil }] }
135
- expect(subject.map(args)).to match_array(
136
- [
137
- *styled('switch', 'foo', 'false'),
138
- *styled('switch', 'bar')
139
- ])
140
- end
141
- end
142
-
143
- describe 'complex types' do
144
- it 'should convert switch => <enumerable>' do
145
- args = { switch: [1, 'two'] }
146
- expect(subject.map(args)).to match_array(
147
- [
148
- *styled('switch', '1'),
149
- *styled('switch', 'two')
150
- ])
151
- end
152
-
153
- it 'should convert switch => <hash>' do
154
- args = { switch: { one: 1, two: 2 } }
155
- expect(subject.map(args)).to match_array(
156
- [
157
- *styled('switch', 'one', '1'),
158
- *styled('switch', 'two', '2')
159
- ])
160
- end
161
-
162
- it 'should convert switch => <enumerable of hash>' do
163
- args = { switch: [{ one: 1 }, { two: 2 }] }
164
- expect(subject.map(args)).to match_array(
165
- [
166
- *styled('switch', 'one', '1'),
167
- *styled('switch', 'two', '2')
168
- ])
169
- end
170
- end
171
-
172
- describe 'snake case to camel case conversion' do
173
- it 'should convert symbols keys' do
174
- args = { some_switch: 1 }
175
- expect(subject.map(args)).to match_array(styled('someSwitch', '1'))
176
- end
177
-
178
- it 'should convert symbol values' do
179
- args = { switch: :some_value }
180
- expect(subject.map(args)).to match_array(styled('switch', 'someValue'))
181
- end
182
-
183
- it 'should convert enumerable values' do
184
- args = { switch: [:some_value] }
185
- expect(subject.map(args)).to match_array(styled('switch', 'someValue'))
186
- end
187
-
188
- it 'should convert hash values' do
189
- args = { switch: { key: :some_value } }
190
- expect(subject.map(args)).to match_array(styled('switch', 'key', 'someValue'))
191
- end
192
-
193
- it 'should convert hash keys' do
194
- args = { switch: { some_key: true } }
195
- expect(subject.map(args)).to match_array(styled('switch', 'someKey', 'true'))
196
- end
197
-
198
- it 'should convert enumerable hash values' do
199
- args = { switch: [{ key: :some_value }] }
200
- expect(subject.map(args)).to match_array(styled('switch', 'key', 'someValue'))
201
- end
202
-
203
- it 'should convert enumerable hash keys' do
204
- args = { switch: [{ some_key: true }] }
205
- expect(subject.map(args)).to match_array(styled('switch', 'someKey', 'true'))
206
- end
207
-
208
- it 'should not convert strings' do
209
- args = { 'some_switch' => 'some_value' }
210
- expect(subject.map(args)).to match_array(styled('some_switch', 'some_value'))
211
- end
212
- end
213
- end
214
- end
1
+ include Rake::Funnel::Support::ArgumentMapper
2
+
3
+ Styles.constants.reject { |x| x == :MSDeploy }.each do |style|
4
+ style_path = Styles.const_get(style)
5
+ describe style_path do
6
+ subject {
7
+ Mapper.new(style)
8
+ }
9
+
10
+ let (:style) {
11
+ Styles.const_get(style).new
12
+ }
13
+
14
+ def styled(switch, key = nil, value = nil)
15
+ unless style.respond_to?(:separator)
16
+ styled = [
17
+ [
18
+ style.prefix,
19
+ switch
20
+ ],
21
+ [
22
+ key && key,
23
+ value && style.value_separator,
24
+ value && value
25
+ ]
26
+ ]
27
+ else
28
+ styled = [
29
+ [
30
+ style.prefix,
31
+ switch,
32
+ key && style.separator,
33
+ key && key,
34
+ value && style.value_separator,
35
+ value && value
36
+ ]
37
+ ]
38
+ end
39
+
40
+ styled.map(&:join).reject(&:empty?)
41
+ end
42
+
43
+ describe 'no arguments' do
44
+ it 'should convert no args to []' do
45
+ expect(subject.map).to match_array([])
46
+ end
47
+
48
+ it 'should convert {} to []' do
49
+ expect(subject.map({})).to match_array([])
50
+ end
51
+ end
52
+
53
+ describe 'truthy arguments' do
54
+ it 'should convert switch => <true>' do
55
+ args = { switch: true }
56
+ expect(subject.map(args)).to match_array(styled('switch', 'true'))
57
+ end
58
+
59
+ it 'should convert switch => <truthy>' do
60
+ args = { switch: 1 }
61
+ expect(subject.map(args)).to match_array(styled('switch', '1'))
62
+ end
63
+
64
+ it 'should convert switch => <symbol>' do
65
+ args = { switch: :one }
66
+ expect(subject.map(args)).to match_array(styled('switch', 'one'))
67
+ end
68
+
69
+ it 'should convert switch => <string>' do
70
+ args = { switch: 'one' }
71
+ expect(subject.map(args)).to match_array(styled('switch', 'one'))
72
+ end
73
+
74
+ it 'should convert switch => <truthy> enumerable' do
75
+ args = { switch: [true, 1] }
76
+ expect(subject.map(args)).to match_array(
77
+ [
78
+ *styled('switch', 'true'),
79
+ *styled('switch', '1')
80
+ ])
81
+ end
82
+
83
+ it 'should convert hash values' do
84
+ args = { switch: { foo: true, bar: true } }
85
+ expect(subject.map(args)).to match_array(
86
+ [
87
+ *styled('switch', 'foo', 'true'),
88
+ *styled('switch', 'bar', 'true')
89
+ ])
90
+ end
91
+
92
+ it 'should convert enumerable hash values' do
93
+ args = { switch: [{ foo: true, bar: 1 }, { baz: :baz, foobar: 'foobar' }] }
94
+ expect(subject.map(args)).to match_array(
95
+ [
96
+ *styled('switch', 'foo', 'true'),
97
+ *styled('switch', 'bar', '1'),
98
+ *styled('switch', 'baz', 'baz'),
99
+ *styled('switch', 'foobar', 'foobar'),
100
+ ])
101
+ end
102
+ end
103
+
104
+ describe 'falsy arguments' do
105
+ it 'should convert switch => <false>' do
106
+ args = { switch: false }
107
+ expect(subject.map(args)).to match_array(styled('switch', 'false'))
108
+ end
109
+
110
+ it 'should convert switch => <falsy>' do
111
+ args = { switch: nil }
112
+ expect(subject.map(args)).to match_array(styled('switch'))
113
+ end
114
+
115
+ it 'should convert switch => <falsy> enumerable' do
116
+ args = { switch: [false, nil] }
117
+ expect(subject.map(args)).to match_array(
118
+ [
119
+ *styled('switch', 'false'),
120
+ *styled('switch')
121
+ ])
122
+ end
123
+
124
+ it 'should convert hash values' do
125
+ args = { switch: { foo: false, bar: nil } }
126
+ expect(subject.map(args)).to match_array(
127
+ [
128
+ *styled('switch', 'foo', 'false'),
129
+ *styled('switch', 'bar')
130
+ ])
131
+ end
132
+
133
+ it 'should convert enumerable hash values' do
134
+ args = { switch: [{ foo: false }, { bar: nil }] }
135
+ expect(subject.map(args)).to match_array(
136
+ [
137
+ *styled('switch', 'foo', 'false'),
138
+ *styled('switch', 'bar')
139
+ ])
140
+ end
141
+ end
142
+
143
+ describe 'complex types' do
144
+ it 'should convert switch => <enumerable>' do
145
+ args = { switch: [1, 'two'] }
146
+ expect(subject.map(args)).to match_array(
147
+ [
148
+ *styled('switch', '1'),
149
+ *styled('switch', 'two')
150
+ ])
151
+ end
152
+
153
+ it 'should convert switch => <hash>' do
154
+ args = { switch: { one: 1, two: 2 } }
155
+ expect(subject.map(args)).to match_array(
156
+ [
157
+ *styled('switch', 'one', '1'),
158
+ *styled('switch', 'two', '2')
159
+ ])
160
+ end
161
+
162
+ it 'should convert switch => <enumerable of hash>' do
163
+ args = { switch: [{ one: 1 }, { two: 2 }] }
164
+ expect(subject.map(args)).to match_array(
165
+ [
166
+ *styled('switch', 'one', '1'),
167
+ *styled('switch', 'two', '2')
168
+ ])
169
+ end
170
+ end
171
+
172
+ describe 'snake case to camel case conversion' do
173
+ it 'should convert symbols keys' do
174
+ args = { some_switch: 1 }
175
+ expect(subject.map(args)).to match_array(styled('someSwitch', '1'))
176
+ end
177
+
178
+ it 'should convert symbol values' do
179
+ args = { switch: :some_value }
180
+ expect(subject.map(args)).to match_array(styled('switch', 'someValue'))
181
+ end
182
+
183
+ it 'should convert enumerable values' do
184
+ args = { switch: [:some_value] }
185
+ expect(subject.map(args)).to match_array(styled('switch', 'someValue'))
186
+ end
187
+
188
+ it 'should convert hash values' do
189
+ args = { switch: { key: :some_value } }
190
+ expect(subject.map(args)).to match_array(styled('switch', 'key', 'someValue'))
191
+ end
192
+
193
+ it 'should convert hash keys' do
194
+ args = { switch: { some_key: true } }
195
+ expect(subject.map(args)).to match_array(styled('switch', 'someKey', 'true'))
196
+ end
197
+
198
+ it 'should convert enumerable hash values' do
199
+ args = { switch: [{ key: :some_value }] }
200
+ expect(subject.map(args)).to match_array(styled('switch', 'key', 'someValue'))
201
+ end
202
+
203
+ it 'should convert enumerable hash keys' do
204
+ args = { switch: [{ some_key: true }] }
205
+ expect(subject.map(args)).to match_array(styled('switch', 'someKey', 'true'))
206
+ end
207
+
208
+ it 'should not convert strings' do
209
+ args = { 'some_switch' => 'some_value' }
210
+ expect(subject.map(args)).to match_array(styled('some_switch', 'some_value'))
211
+ end
212
+ end
213
+ end
214
+ end
@@ -1,61 +1,66 @@
1
- include Rake::Funnel::Support
2
-
3
- describe Rake::Funnel::Support::AssemblyVersion::FromVersionFiles do
4
- describe 'defaults' do
5
- its(:search_pattern) { should == %w(**/VERSION) }
6
- its(:build_number) { should be_nil }
7
- its(:sha) { should be_nil }
8
-
9
- describe 'overriding defaults' do
10
- subject {
11
- described_class.new({
12
- search_pattern: 'search pattern',
13
- build_number: 42,
14
- sha: 'abc'
15
- })
16
- }
17
-
18
- its(:search_pattern) { should == 'search pattern' }
19
- its(:build_number) { should == 42 }
20
- its(:sha) { should == 'abc' }
21
- end
22
- end
23
-
24
- describe 'enumerable' do
25
- it { is_expected.to be_kind_of(Enumerable) }
26
- it { is_expected.to respond_to(:each) }
27
-
28
- it 'should yield enumerator' do
29
- expect(subject.each).to be_kind_of(Enumerator)
30
- end
31
- end
32
-
33
- describe 'enumeration' do
34
- let(:finder) { double(Finder).as_null_object }
35
- let(:files) { %w(1 2) }
36
-
37
- before {
38
- allow(finder).to receive(:all_or_default).and_return(files)
39
- allow(Finder).to receive(:new).and_return(finder)
40
- }
41
-
42
- before {
43
- allow(VersionInfo).to receive(:read_version_from).and_return(*files)
44
- }
45
-
46
- before {
47
- allow(Rake).to receive(:rake_output_message)
48
- }
49
-
50
- subject {
51
- described_class.new({ build_number: 42, sha: 'abc' })
52
- }
53
-
54
- it 'should yield source and version info for each file' do
55
- expect { |b| subject.each(&b) }.to yield_successive_args(
56
- { source: '1', version_info: VersionInfo.new({ assembly_version: '1', assembly_file_version: '1.42', assembly_informational_version: '1.42-abc' }) },
57
- { source: '2', version_info: VersionInfo.new({ assembly_version: '2', assembly_file_version: '2.42', assembly_informational_version: '2.42-abc' }) }
58
- )
59
- end
60
- end
61
- end
1
+ include Rake::Funnel::Support
2
+
3
+ describe Rake::Funnel::Support::AssemblyVersion::FromVersionFiles do
4
+ describe 'defaults' do
5
+ its(:search_pattern) { should == %w(**/VERSION) }
6
+ its(:metadata) { should be_nil }
7
+
8
+ describe 'overriding defaults' do
9
+ subject {
10
+ described_class.new({
11
+ search_pattern: 'search pattern',
12
+ metadata: {},
13
+ })
14
+ }
15
+
16
+ its(:search_pattern) { should == 'search pattern' }
17
+ its(:metadata) { should == {} }
18
+ end
19
+ end
20
+
21
+ describe 'enumerable' do
22
+ it { is_expected.to be_kind_of(Enumerable) }
23
+ it { is_expected.to respond_to(:each) }
24
+
25
+ it 'should yield enumerator' do
26
+ expect(subject.each).to be_kind_of(Enumerator)
27
+ end
28
+ end
29
+
30
+ describe 'enumeration' do
31
+ let(:finder) { double(Finder).as_null_object }
32
+ let(:files) { %w(1 2) }
33
+
34
+ before {
35
+ allow(finder).to receive(:all_or_default).and_return(files)
36
+ allow(Finder).to receive(:new).and_return(finder)
37
+ }
38
+
39
+ before {
40
+ allow(VersionInfo).to receive(:read_version_from).and_return(*files)
41
+ }
42
+
43
+ before {
44
+ allow(Rake).to receive(:rake_output_message)
45
+ }
46
+
47
+ subject {
48
+ described_class.new(metadata: { pre: 'alpha', build: 42, sha: 'abc' })
49
+ }
50
+
51
+ it 'should yield source and version info for each file' do
52
+ args = files.map do |file|
53
+ {
54
+ source: file,
55
+ version_info: VersionInfo.parse(version: file, metadata: {
56
+ pre: subject.metadata[:pre],
57
+ build: subject.metadata[:build],
58
+ sha: subject.metadata[:sha]
59
+ })
60
+ }
61
+ end
62
+
63
+ expect { |b| subject.each(&b) }.to yield_successive_args(*args)
64
+ end
65
+ end
66
+ end