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,183 +1,182 @@
1
- describe Rake::Funnel::Support::InstantiateSymbol do
2
- module Creatable
3
- class One
4
- end
5
-
6
- class Two
7
- end
8
-
9
- class Three
10
- end
11
- end
12
-
13
- class ExplicitModuleDefinition
14
- include Rake::Funnel::Support::InstantiateSymbol
15
- instantiate Creatable
16
-
17
- class Nested
18
- end
19
- end
20
-
21
- class ImplicitModuleDefinition
22
- include Rake::Funnel::Support::InstantiateSymbol
23
-
24
- class Nested
25
- end
26
- end
27
-
28
- describe 'module methods' do
29
- subject {
30
- ExplicitModuleDefinition.new
31
- }
32
-
33
- describe 'instance methods' do
34
- it 'should not be public' do
35
- expect(subject).not_to respond_to(:create)
36
- expect(subject).not_to respond_to(:available)
37
- end
38
- end
39
-
40
- describe 'class methods' do
41
- it 'should not be public' do
42
- expect(subject.class).not_to respond_to(:instantiate)
43
- end
44
- end
45
- end
46
-
47
- describe 'inspection' do
48
- context 'implicit module' do
49
- subject {
50
- ImplicitModuleDefinition.new
51
- }
52
-
53
- it 'should yield constants in self' do
54
- expect(subject.send(:available)).to eq([:ClassMethods, :Nested])
55
- end
56
- end
57
-
58
- context 'explicit module' do
59
- subject {
60
- ExplicitModuleDefinition.new
61
- }
62
-
63
- it 'should yield sorted constants in module' do
64
- expect(subject.send(:available)).to eq([:One, :Three, :Two])
65
- end
66
- end
67
-
68
- context 'multiple uses' do
69
- subject {
70
- [
71
- ExplicitModuleDefinition.new,
72
- ImplicitModuleDefinition.new
73
- ]
74
- }
75
-
76
- it 'should not overlap' do
77
- first = subject[0].send(:available)
78
- second = subject[1].send(:available)
79
-
80
- expect(first).not_to include(second)
81
- end
82
- end
83
- end
84
-
85
- describe 'instantiation' do
86
- subject {
87
- ExplicitModuleDefinition.new
88
- }
89
-
90
- context 'with instance' do
91
- it 'should return instance' do
92
- instance = Object.new
93
-
94
- expect(subject.send(:create, instance)).to eq(instance)
95
- end
96
- end
97
-
98
-
99
- context 'with nil' do
100
- it 'should return nil' do
101
- expect(subject.send(:create, nil)).to eq(nil)
102
- end
103
- end
104
-
105
- context 'symbol not defined' do
106
- it 'should fail' do
107
- expect { subject.send(:create, :does_not_exist) }.to raise_error 'Unknown type to instantiate: :does_not_exist. Available types are: [:One, :Three, :Two]'
108
- end
109
- end
110
-
111
- context 'instantiation fails' do
112
- class WillFail
113
- include Rake::Funnel::Support::InstantiateSymbol
114
-
115
- class Failure
116
- def initialize
117
- raise "BAM!"
118
- end
119
- end
120
- end
121
-
122
- subject {
123
- WillFail.new
124
- }
125
-
126
- it 'should fail' do
127
- expect { subject.send(:create, :Failure) }.to raise_error "BAM!"
128
- end
129
- end
130
-
131
- context 'instantiation succeeds' do
132
- it 'should return instance' do
133
- expect(subject.send(:create, :One)).to be_an_instance_of(Creatable::One)
134
- end
135
- end
136
-
137
- describe 'args' do
138
- module CreatableWithArgs
139
- class None
140
- def initialize
141
- end
142
- end
143
-
144
- class Single
145
- def initialize(arg)
146
- end
147
- end
148
-
149
- class Multiple
150
- def initialize(arg1, arg2)
151
- end
152
- end
153
- end
154
-
155
- class WithArgs
156
- include Rake::Funnel::Support::InstantiateSymbol
157
- instantiate CreatableWithArgs
158
- end
159
-
160
- subject {
161
- WithArgs.new
162
- }
163
-
164
- context 'no argument' do
165
- it 'should not pass arg' do
166
- expect(subject.send(:create, :None)).to be_an_instance_of(CreatableWithArgs::None)
167
- end
168
- end
169
-
170
- context 'single argument' do
171
- it 'should pass arg' do
172
- expect(subject.send(:create, :Single, 1)).to be_an_instance_of(CreatableWithArgs::Single)
173
- end
174
- end
175
-
176
- context 'multiple argument' do
177
- it 'should pass args' do
178
- expect(subject.send(:create, :Multiple, 1, 2)).to be_an_instance_of(CreatableWithArgs::Multiple)
179
- end
180
- end
181
- end
182
- end
183
- end
1
+ describe Rake::Funnel::Support::InstantiateSymbol do
2
+ module Creatable
3
+ class One
4
+ end
5
+
6
+ class Two
7
+ end
8
+
9
+ class Three
10
+ end
11
+ end
12
+
13
+ class ExplicitModuleDefinition
14
+ include Rake::Funnel::Support::InstantiateSymbol
15
+ instantiate Creatable
16
+
17
+ class Nested
18
+ end
19
+ end
20
+
21
+ class ImplicitModuleDefinition
22
+ include Rake::Funnel::Support::InstantiateSymbol
23
+
24
+ class Nested
25
+ end
26
+ end
27
+
28
+ describe 'module methods' do
29
+ subject {
30
+ ExplicitModuleDefinition.new
31
+ }
32
+
33
+ describe 'instance methods' do
34
+ it 'should not be public' do
35
+ expect(subject).not_to respond_to(:create)
36
+ expect(subject).not_to respond_to(:available)
37
+ end
38
+ end
39
+
40
+ describe 'class methods' do
41
+ it 'should not be public' do
42
+ expect(subject.class).not_to respond_to(:instantiate)
43
+ end
44
+ end
45
+ end
46
+
47
+ describe 'inspection' do
48
+ context 'implicit module' do
49
+ subject {
50
+ ImplicitModuleDefinition.new
51
+ }
52
+
53
+ it 'should yield constants in self' do
54
+ expect(subject.send(:available)).to eq([:ClassMethods, :Nested])
55
+ end
56
+ end
57
+
58
+ context 'explicit module' do
59
+ subject {
60
+ ExplicitModuleDefinition.new
61
+ }
62
+
63
+ it 'should yield sorted constants in module' do
64
+ expect(subject.send(:available)).to eq([:One, :Three, :Two])
65
+ end
66
+ end
67
+
68
+ context 'multiple uses' do
69
+ subject {
70
+ [
71
+ ExplicitModuleDefinition.new,
72
+ ImplicitModuleDefinition.new
73
+ ]
74
+ }
75
+
76
+ it 'should not overlap' do
77
+ first = subject[0].send(:available)
78
+ second = subject[1].send(:available)
79
+
80
+ expect(first).not_to include(second)
81
+ end
82
+ end
83
+ end
84
+
85
+ describe 'instantiation' do
86
+ subject {
87
+ ExplicitModuleDefinition.new
88
+ }
89
+
90
+ context 'with instance' do
91
+ it 'should return instance' do
92
+ instance = Object.new
93
+
94
+ expect(subject.send(:create, instance)).to eq(instance)
95
+ end
96
+ end
97
+
98
+ context 'with nil' do
99
+ it 'should return nil' do
100
+ expect(subject.send(:create, nil)).to eq(nil)
101
+ end
102
+ end
103
+
104
+ context 'symbol not defined' do
105
+ it 'should fail' do
106
+ expect { subject.send(:create, :does_not_exist) }.to raise_error 'Unknown type to instantiate: :does_not_exist. Available types are: [:One, :Three, :Two]'
107
+ end
108
+ end
109
+
110
+ context 'instantiation fails' do
111
+ class WillFail
112
+ include Rake::Funnel::Support::InstantiateSymbol
113
+
114
+ class Failure
115
+ def initialize
116
+ fail 'BAM!'
117
+ end
118
+ end
119
+ end
120
+
121
+ subject {
122
+ WillFail.new
123
+ }
124
+
125
+ it 'should fail' do
126
+ expect { subject.send(:create, :Failure) }.to raise_error 'BAM!'
127
+ end
128
+ end
129
+
130
+ context 'instantiation succeeds' do
131
+ it 'should return instance' do
132
+ expect(subject.send(:create, :One)).to be_an_instance_of(Creatable::One)
133
+ end
134
+ end
135
+
136
+ describe 'args' do
137
+ module CreatableWithArgs
138
+ class None
139
+ def initialize
140
+ end
141
+ end
142
+
143
+ class Single
144
+ def initialize(_arg)
145
+ end
146
+ end
147
+
148
+ class Multiple
149
+ def initialize(_arg1, _arg2)
150
+ end
151
+ end
152
+ end
153
+
154
+ class WithArgs
155
+ include Rake::Funnel::Support::InstantiateSymbol
156
+ instantiate CreatableWithArgs
157
+ end
158
+
159
+ subject {
160
+ WithArgs.new
161
+ }
162
+
163
+ context 'no argument' do
164
+ it 'should not pass arg' do
165
+ expect(subject.send(:create, :None)).to be_an_instance_of(CreatableWithArgs::None)
166
+ end
167
+ end
168
+
169
+ context 'single argument' do
170
+ it 'should pass arg' do
171
+ expect(subject.send(:create, :Single, 1)).to be_an_instance_of(CreatableWithArgs::Single)
172
+ end
173
+ end
174
+
175
+ context 'multiple argument' do
176
+ it 'should pass args' do
177
+ expect(subject.send(:create, :Multiple, 1, 2)).to be_an_instance_of(CreatableWithArgs::Multiple)
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -1,87 +1,87 @@
1
- describe Rake::Funnel::Support::Mapper do
2
- describe 'Manual debugging test case' do
3
- it 'should work' do
4
- args = {
5
- unset: nil,
6
- simple: 1,
7
- array: [1, 2, nil],
8
- hash: { one: 1, two: 2, unset: nil },
9
- enum_hash: [{ one: 1 }, { two: 2 }, { unset: nil }]
10
- }
11
-
12
- _ = subject.map(args)
13
- expect(_).not_to be_empty
14
-
15
- skip('for manual testing only')
16
- end
17
- end
18
-
19
- class CustomMapper
20
- def generate_from(_)
21
- [
22
- ['-', 'switch'],
23
- ['-', :some_switch],
24
- ['-', :another_switch, '=', :some_value],
25
- ['-string switch', '=', 'string value']
26
- ]
27
- end
28
- end
29
-
30
- describe 'mapping' do
31
- it 'should support nil args' do
32
- expect(subject.map(nil)).to be_empty
33
- end
34
-
35
- it 'should support empty args' do
36
- expect(subject.map({})).to be_empty
37
- end
38
- end
39
-
40
- describe 'mapper style' do
41
- context 'default mapper' do
42
- it 'should use default mapper' do
43
- expect(described_class.new).to be
44
- end
45
- end
46
-
47
- context 'unknown mapper' do
48
- it 'should fail' do
49
- expect { described_class.new(:unknown) }.to raise_error(NameError)
50
- end
51
- end
52
-
53
- context 'nil mapper' do
54
- it 'should fail' do
55
- expect { described_class.new(nil) }.to raise_error(/You cannot use the 'nil' mapper style. Available mappers are:/)
56
- end
57
- end
58
-
59
- context 'custom mapper' do
60
- it 'should take custom mapper instance' do
61
- expect(described_class.new(CustomMapper.new)).to be
62
- end
63
- end
64
- end
65
-
66
- describe 'mapper output' do
67
- subject { described_class.new(CustomMapper.new) }
68
-
69
- it 'should join nested arrays' do
70
- expect(subject.map).to include('-switch')
71
- end
72
-
73
- describe 'snake case to camel case conversion' do
74
- it 'should convert symbols keys' do
75
- expect(subject.map).to include('-someSwitch')
76
- end
77
-
78
- it 'should convert symbol values' do
79
- expect(subject.map).to include('-anotherSwitch=someValue')
80
- end
81
-
82
- it 'should not convert strings' do
83
- expect(subject.map).to include('-string switch=string value')
84
- end
85
- end
86
- end
87
- end
1
+ describe Rake::Funnel::Support::Mapper do
2
+ describe 'Manual debugging test case' do
3
+ it 'should work' do
4
+ args = {
5
+ unset: nil,
6
+ simple: 1,
7
+ array: [1, 2, nil],
8
+ hash: { one: 1, two: 2, unset: nil },
9
+ enum_hash: [{ one: 1 }, { two: 2 }, { unset: nil }]
10
+ }
11
+
12
+ _ = subject.map(args)
13
+ expect(_).not_to be_empty
14
+
15
+ skip('for manual testing only')
16
+ end
17
+ end
18
+
19
+ class CustomMapper
20
+ def generate_from(_)
21
+ [
22
+ ['-', 'switch'],
23
+ ['-', :some_switch],
24
+ ['-', :another_switch, '=', :some_value],
25
+ ['-string switch', '=', 'string value']
26
+ ]
27
+ end
28
+ end
29
+
30
+ describe 'mapping' do
31
+ it 'should support nil args' do
32
+ expect(subject.map(nil)).to be_empty
33
+ end
34
+
35
+ it 'should support empty args' do
36
+ expect(subject.map({})).to be_empty
37
+ end
38
+ end
39
+
40
+ describe 'mapper style' do
41
+ context 'default mapper' do
42
+ it 'should use default mapper' do
43
+ expect(described_class.new).to be
44
+ end
45
+ end
46
+
47
+ context 'unknown mapper' do
48
+ it 'should fail' do
49
+ expect { described_class.new(:unknown) }.to raise_error(NameError)
50
+ end
51
+ end
52
+
53
+ context 'nil mapper' do
54
+ it 'should fail' do
55
+ expect { described_class.new(nil) }.to raise_error(/You cannot use the 'nil' mapper style. Available mappers are:/)
56
+ end
57
+ end
58
+
59
+ context 'custom mapper' do
60
+ it 'should take custom mapper instance' do
61
+ expect(described_class.new(CustomMapper.new)).to be
62
+ end
63
+ end
64
+ end
65
+
66
+ describe 'mapper output' do
67
+ subject { described_class.new(CustomMapper.new) }
68
+
69
+ it 'should join nested arrays' do
70
+ expect(subject.map).to include('-switch')
71
+ end
72
+
73
+ describe 'snake case to camel case conversion' do
74
+ it 'should convert symbols keys' do
75
+ expect(subject.map).to include('-someSwitch')
76
+ end
77
+
78
+ it 'should convert symbol values' do
79
+ expect(subject.map).to include('-anotherSwitch=someValue')
80
+ end
81
+
82
+ it 'should not convert strings' do
83
+ expect(subject.map).to include('-string switch=string value')
84
+ end
85
+ end
86
+ end
87
+ end
@@ -1,57 +1,57 @@
1
- require 'tmpdir'
2
-
3
- include Rake::Funnel::Support
4
-
5
- describe Rake::Funnel::Support::Mono do
6
- before {
7
- allow(Rake::Win32).to receive(:windows?).and_return(windows?)
8
- }
9
-
10
- context 'on Windows' do
11
- let(:windows?) { true }
12
-
13
- it 'should return executable' do
14
- expect(described_class.invocation('executable.exe')).to eq(%w(executable.exe))
15
- end
16
-
17
- it 'should return executable with args' do
18
- expect(described_class.invocation('executable.exe', 'arg1', 'arg2')).to eq(%w(executable.exe arg1 arg2))
19
- end
20
-
21
- it 'should return array executable with args' do
22
- expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(executable.exe arg1 arg2))
23
- end
24
-
25
- it 'should reject nil in array' do
26
- expect(described_class.invocation(%w(executable.exe arg1) << nil)).to eq(%w(executable.exe arg1))
27
- end
28
-
29
- it 'should reject nil as arg' do
30
- expect(described_class.invocation('executable.exe', nil)).to eq(%w(executable.exe))
31
- end
32
- end
33
-
34
- context 'not on Windows' do
35
- let(:windows?) { false }
36
-
37
- before {
38
- allow(Which).to receive(:which)
39
- }
40
-
41
- before {
42
- @cmd = described_class.invocation('executable.exe')
43
- }
44
-
45
- it "should prepend 'mono'" do
46
- expect(@cmd.first).to eq('mono')
47
- end
48
-
49
- it 'should resolve executable through which' do
50
- expect(Which).to have_received(:which).with('executable.exe')
51
- end
52
-
53
- it 'should support args' do
54
- expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(mono executable.exe arg1 arg2))
55
- end
56
- end
57
- end
1
+ require 'tmpdir'
2
+
3
+ include Rake::Funnel::Support
4
+
5
+ describe Rake::Funnel::Support::Mono do
6
+ before {
7
+ allow(Rake::Win32).to receive(:windows?).and_return(windows?)
8
+ }
9
+
10
+ context 'on Windows' do
11
+ let(:windows?) { true }
12
+
13
+ it 'should return executable' do
14
+ expect(described_class.invocation('executable.exe')).to eq(%w(executable.exe))
15
+ end
16
+
17
+ it 'should return executable with args' do
18
+ expect(described_class.invocation('executable.exe', 'arg1', 'arg2')).to eq(%w(executable.exe arg1 arg2))
19
+ end
20
+
21
+ it 'should return array executable with args' do
22
+ expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(executable.exe arg1 arg2))
23
+ end
24
+
25
+ it 'should reject nil in array' do
26
+ expect(described_class.invocation(%w(executable.exe arg1) << nil)).to eq(%w(executable.exe arg1))
27
+ end
28
+
29
+ it 'should reject nil as arg' do
30
+ expect(described_class.invocation('executable.exe', nil)).to eq(%w(executable.exe))
31
+ end
32
+ end
33
+
34
+ context 'not on Windows' do
35
+ let(:windows?) { false }
36
+
37
+ before {
38
+ allow(Which).to receive(:which)
39
+ }
40
+
41
+ before {
42
+ @cmd = described_class.invocation('executable.exe')
43
+ }
44
+
45
+ it "should prepend 'mono'" do
46
+ expect(@cmd.first).to eq('mono')
47
+ end
48
+
49
+ it 'should resolve executable through which' do
50
+ expect(Which).to have_received(:which).with('executable.exe')
51
+ end
52
+
53
+ it 'should support args' do
54
+ expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(mono executable.exe arg1 arg2))
55
+ end
56
+ end
57
+ end