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,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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
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
|