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,142 +1,140 @@
|
|
|
1
|
-
include Rake
|
|
2
|
-
include Rake::Funnel::Support
|
|
3
|
-
|
|
4
|
-
describe Rake::Funnel::Tasks::Paket do
|
|
5
|
-
before {
|
|
6
|
-
Task.clear
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe 'defaults' do
|
|
10
|
-
its(:name) { should == :paket }
|
|
11
|
-
its(:paket) { should == '.paket/paket.exe' }
|
|
12
|
-
its(:paket_args) { should == 'restore' }
|
|
13
|
-
its(:bootstrapper) { should == '.paket/paket.bootstrapper.exe' }
|
|
14
|
-
its(:bootstrapper_args) { should
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'execution' do
|
|
18
|
-
before {
|
|
19
|
-
allow(subject).to receive(:sh)
|
|
20
|
-
allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
|
|
21
|
-
args.compact
|
|
22
|
-
end
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
context 'overriding defaults' do
|
|
26
|
-
subject {
|
|
27
|
-
described_class.new do |t|
|
|
28
|
-
t.bootstrapper = 'custom bootstrapper.exe'
|
|
29
|
-
t.bootstrapper_args = %w(arg1 arg2)
|
|
30
|
-
t.paket = 'custom paket.exe'
|
|
31
|
-
t.paket_args = %w(arg1 arg2)
|
|
32
|
-
end
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
before {
|
|
36
|
-
allow(File).to receive(:exist?).and_return(false)
|
|
37
|
-
allow(subject).to receive(:sh)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
before {
|
|
41
|
-
Task[subject.name].invoke
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
it 'should use custom bootstrapper' do
|
|
45
|
-
expect(subject).to have_received(:sh).with(subject.bootstrapper, subject.bootstrapper_args)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'should use custom paket' do
|
|
49
|
-
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 'mono invocation' do
|
|
54
|
-
before {
|
|
55
|
-
Task[subject.name].invoke
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
it 'should use mono invocation for bootstrapper' do
|
|
59
|
-
expect(Mono).to have_received(:invocation).with(subject.bootstrapper, subject.bootstrapper_args)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it 'should use mono invocation for paket' do
|
|
63
|
-
expect(Mono).to have_received(:invocation).with(subject.paket, subject.paket_args)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe 'optional download' do
|
|
68
|
-
before {
|
|
69
|
-
allow(File).to receive(:exist?).with(subject.paket).and_return(paket_exists)
|
|
70
|
-
allow(subject).to receive(:sh).with(subject.bootstrapper)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
context 'success' do
|
|
74
|
-
before {
|
|
75
|
-
Task[subject.name].invoke
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
context 'paket.exe exists' do
|
|
79
|
-
let(:paket_exists) { true }
|
|
80
|
-
|
|
81
|
-
it 'should not run bootstrapper' do
|
|
82
|
-
expect(subject).not_to have_received(:sh).with(subject.bootstrapper)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it 'should run paket' do
|
|
86
|
-
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
context 'paket.exe does not exist' do
|
|
91
|
-
let(:paket_exists) { false }
|
|
92
|
-
|
|
93
|
-
it 'should run bootstrapper' do
|
|
94
|
-
expect(subject).to have_received(:sh).with(subject.bootstrapper)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
it 'should run paket' do
|
|
98
|
-
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
context 'failure' do
|
|
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
|
-
end
|
|
142
|
-
end
|
|
1
|
+
include Rake
|
|
2
|
+
include Rake::Funnel::Support
|
|
3
|
+
|
|
4
|
+
describe Rake::Funnel::Tasks::Paket do
|
|
5
|
+
before {
|
|
6
|
+
Task.clear
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe 'defaults' do
|
|
10
|
+
its(:name) { should == :paket }
|
|
11
|
+
its(:paket) { should == '.paket/paket.exe' }
|
|
12
|
+
its(:paket_args) { should == 'restore' }
|
|
13
|
+
its(:bootstrapper) { should == '.paket/paket.bootstrapper.exe' }
|
|
14
|
+
its(:bootstrapper_args) { should be_nil }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe 'execution' do
|
|
18
|
+
before {
|
|
19
|
+
allow(subject).to receive(:sh)
|
|
20
|
+
allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
|
|
21
|
+
args.compact
|
|
22
|
+
end
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
context 'overriding defaults' do
|
|
26
|
+
subject {
|
|
27
|
+
described_class.new do |t|
|
|
28
|
+
t.bootstrapper = 'custom bootstrapper.exe'
|
|
29
|
+
t.bootstrapper_args = %w(arg1 arg2)
|
|
30
|
+
t.paket = 'custom paket.exe'
|
|
31
|
+
t.paket_args = %w(arg1 arg2)
|
|
32
|
+
end
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
before {
|
|
36
|
+
allow(File).to receive(:exist?).and_return(false)
|
|
37
|
+
allow(subject).to receive(:sh)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
before {
|
|
41
|
+
Task[subject.name].invoke
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
it 'should use custom bootstrapper' do
|
|
45
|
+
expect(subject).to have_received(:sh).with(subject.bootstrapper, subject.bootstrapper_args)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'should use custom paket' do
|
|
49
|
+
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe 'mono invocation' do
|
|
54
|
+
before {
|
|
55
|
+
Task[subject.name].invoke
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
it 'should use mono invocation for bootstrapper' do
|
|
59
|
+
expect(Mono).to have_received(:invocation).with(subject.bootstrapper, subject.bootstrapper_args)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'should use mono invocation for paket' do
|
|
63
|
+
expect(Mono).to have_received(:invocation).with(subject.paket, subject.paket_args)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe 'optional download' do
|
|
68
|
+
before {
|
|
69
|
+
allow(File).to receive(:exist?).with(subject.paket).and_return(paket_exists)
|
|
70
|
+
allow(subject).to receive(:sh).with(subject.bootstrapper)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
context 'success' do
|
|
74
|
+
before {
|
|
75
|
+
Task[subject.name].invoke
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
context 'paket.exe exists' do
|
|
79
|
+
let(:paket_exists) { true }
|
|
80
|
+
|
|
81
|
+
it 'should not run bootstrapper' do
|
|
82
|
+
expect(subject).not_to have_received(:sh).with(subject.bootstrapper)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it 'should run paket' do
|
|
86
|
+
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'paket.exe does not exist' do
|
|
91
|
+
let(:paket_exists) { false }
|
|
92
|
+
|
|
93
|
+
it 'should run bootstrapper' do
|
|
94
|
+
expect(subject).to have_received(:sh).with(subject.bootstrapper)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'should run paket' do
|
|
98
|
+
expect(subject).to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
context 'failure' do
|
|
104
|
+
context 'paket.exe exists' do
|
|
105
|
+
let(:paket_exists) { true }
|
|
106
|
+
|
|
107
|
+
context 'paket failed' do
|
|
108
|
+
before {
|
|
109
|
+
allow(subject).to receive(:sh).with(subject.paket, anything).and_raise
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
it 'should fail' do
|
|
113
|
+
expect { Task[subject.name].invoke }.to raise_error
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
context 'paket.exe does not exist' do
|
|
119
|
+
let(:paket_exists) { false }
|
|
120
|
+
|
|
121
|
+
context 'bootstrapper failed' do
|
|
122
|
+
before {
|
|
123
|
+
allow(subject).to receive(:sh).with(subject.bootstrapper).and_raise
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
it 'should not run paket' do
|
|
127
|
+
Task[subject.name].invoke rescue nil
|
|
128
|
+
|
|
129
|
+
expect(subject).not_to have_received(:sh).with(subject.paket, subject.paket_args)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'should fail' do
|
|
133
|
+
expect { Task[subject.name].invoke }.to raise_error
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
require 'tmpdir'
|
|
2
|
-
|
|
3
|
-
include Rake
|
|
4
|
-
include Rake::Funnel::Support
|
|
5
|
-
|
|
6
|
-
describe Rake::Funnel::Tasks::QuickTemplate do
|
|
7
|
-
before {
|
|
8
|
-
Task.clear
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe 'defaults' do
|
|
12
|
-
its(:name) { should == :template }
|
|
13
|
-
its(:search_pattern) { should eq(%w(**/*.erb)) }
|
|
14
|
-
its(:context) { should
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'execution' do
|
|
18
|
-
let(:templates) { %w(1.template two/2.template) }
|
|
19
|
-
|
|
20
|
-
let(:finder) { double(Finder).as_null_object }
|
|
21
|
-
let(:engine) { TemplateEngine }
|
|
22
|
-
|
|
23
|
-
before {
|
|
24
|
-
allow(finder).to receive(:all_or_default).and_return(templates)
|
|
25
|
-
allow(Finder).to receive(:new).and_return(finder)
|
|
26
|
-
allow(engine).to receive(:render).and_return('file content')
|
|
27
|
-
allow(Rake).to receive(:rake_output_message)
|
|
28
|
-
allow(File).to receive(:read).and_return('template content')
|
|
29
|
-
allow(File).to receive(:write)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
subject! { described_class.new }
|
|
33
|
-
|
|
34
|
-
before {
|
|
35
|
-
Task[subject.name].invoke
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
it 'should report created files' do
|
|
39
|
-
templates.each do |template|
|
|
40
|
-
expect(Rake).to have_received(:rake_output_message).with("Creating file #{template.ext}")
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it 'should read all templates' do
|
|
45
|
-
templates.each do |template|
|
|
46
|
-
expect(File).to have_received(:read).with(template)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it 'should render all templates' do
|
|
51
|
-
templates.each do |template|
|
|
52
|
-
expect(engine).to have_received(:render).with('template content', template, subject.context)
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it 'should write all files' do
|
|
57
|
-
templates.each do |template|
|
|
58
|
-
expect(File).to have_received(:write).with(template.ext, 'file content')
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
1
|
+
require 'tmpdir'
|
|
2
|
+
|
|
3
|
+
include Rake
|
|
4
|
+
include Rake::Funnel::Support
|
|
5
|
+
|
|
6
|
+
describe Rake::Funnel::Tasks::QuickTemplate do
|
|
7
|
+
before {
|
|
8
|
+
Task.clear
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe 'defaults' do
|
|
12
|
+
its(:name) { should == :template }
|
|
13
|
+
its(:search_pattern) { should eq(%w(**/*.erb)) }
|
|
14
|
+
its(:context) { should be_an_instance_of(Binding) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe 'execution' do
|
|
18
|
+
let(:templates) { %w(1.template two/2.template) }
|
|
19
|
+
|
|
20
|
+
let(:finder) { double(Finder).as_null_object }
|
|
21
|
+
let(:engine) { TemplateEngine }
|
|
22
|
+
|
|
23
|
+
before {
|
|
24
|
+
allow(finder).to receive(:all_or_default).and_return(templates)
|
|
25
|
+
allow(Finder).to receive(:new).and_return(finder)
|
|
26
|
+
allow(engine).to receive(:render).and_return('file content')
|
|
27
|
+
allow(Rake).to receive(:rake_output_message)
|
|
28
|
+
allow(File).to receive(:read).and_return('template content')
|
|
29
|
+
allow(File).to receive(:write)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
subject! { described_class.new }
|
|
33
|
+
|
|
34
|
+
before {
|
|
35
|
+
Task[subject.name].invoke
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
it 'should report created files' do
|
|
39
|
+
templates.each do |template|
|
|
40
|
+
expect(Rake).to have_received(:rake_output_message).with("Creating file #{template.ext}")
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should read all templates' do
|
|
45
|
+
templates.each do |template|
|
|
46
|
+
expect(File).to have_received(:read).with(template)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should render all templates' do
|
|
51
|
+
templates.each do |template|
|
|
52
|
+
expect(engine).to have_received(:render).with('template content', template, subject.context)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'should write all files' do
|
|
57
|
+
templates.each do |template|
|
|
58
|
+
expect(File).to have_received(:write).with(template.ext, 'file content')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
require 'tmpdir'
|
|
2
|
-
|
|
3
|
-
include Rake
|
|
4
|
-
include Rake::Funnel::Support
|
|
5
|
-
|
|
6
|
-
describe Rake::Funnel::Tasks::SideBySideSpecs do
|
|
7
|
-
before {
|
|
8
|
-
Task.clear
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe 'defaults' do
|
|
12
|
-
its(:name) { should == :compile }
|
|
13
|
-
its(:projects) { should == %w(**/*.csproj **/*.vbproj **/*.fsproj) }
|
|
14
|
-
its(:references) { should == [] }
|
|
15
|
-
its(:specs) { should == %w(*Specs.cs **/*Specs.cs *Tests.cs **/*Tests.cs) }
|
|
16
|
-
its(:enabled) { should == false }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe 'execution' do
|
|
20
|
-
subject {
|
|
21
|
-
described_class.new do |t|
|
|
22
|
-
t.projects = %w(**/*.??proj)
|
|
23
|
-
t.references = %w(Ref-1)
|
|
24
|
-
t.specs = %w(*Specs.cs **/*Specs.cs)
|
|
25
|
-
t.enabled = enabled
|
|
26
|
-
end
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
before {
|
|
30
|
-
allow(SpecsRemover).to receive(:remove)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
before {
|
|
34
|
-
Task[subject.name].invoke
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
context 'enabled' do
|
|
38
|
-
let(:enabled) { true }
|
|
39
|
-
|
|
40
|
-
it 'should use remover' do
|
|
41
|
-
expect(SpecsRemover).to have_received(:remove)
|
|
42
|
-
.with({
|
|
43
|
-
projects: subject.projects,
|
|
44
|
-
references: subject.references,
|
|
45
|
-
specs: subject.specs
|
|
46
|
-
})
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
context 'disabled' do
|
|
51
|
-
let(:enabled) { false }
|
|
52
|
-
|
|
53
|
-
it 'should do nothing' do
|
|
54
|
-
expect(SpecsRemover).not_to have_received(:remove)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
1
|
+
require 'tmpdir'
|
|
2
|
+
|
|
3
|
+
include Rake
|
|
4
|
+
include Rake::Funnel::Support
|
|
5
|
+
|
|
6
|
+
describe Rake::Funnel::Tasks::SideBySideSpecs do
|
|
7
|
+
before {
|
|
8
|
+
Task.clear
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe 'defaults' do
|
|
12
|
+
its(:name) { should == :compile }
|
|
13
|
+
its(:projects) { should == %w(**/*.csproj **/*.vbproj **/*.fsproj) }
|
|
14
|
+
its(:references) { should == [] }
|
|
15
|
+
its(:specs) { should == %w(*Specs.cs **/*Specs.cs *Tests.cs **/*Tests.cs) }
|
|
16
|
+
its(:enabled) { should == false }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe 'execution' do
|
|
20
|
+
subject {
|
|
21
|
+
described_class.new do |t|
|
|
22
|
+
t.projects = %w(**/*.??proj)
|
|
23
|
+
t.references = %w(Ref-1)
|
|
24
|
+
t.specs = %w(*Specs.cs **/*Specs.cs)
|
|
25
|
+
t.enabled = enabled
|
|
26
|
+
end
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
before {
|
|
30
|
+
allow(SpecsRemover).to receive(:remove)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
before {
|
|
34
|
+
Task[subject.name].invoke
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
context 'enabled' do
|
|
38
|
+
let(:enabled) { true }
|
|
39
|
+
|
|
40
|
+
it 'should use remover' do
|
|
41
|
+
expect(SpecsRemover).to have_received(:remove)
|
|
42
|
+
.with({
|
|
43
|
+
projects: subject.projects,
|
|
44
|
+
references: subject.references,
|
|
45
|
+
specs: subject.specs
|
|
46
|
+
})
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context 'disabled' do
|
|
51
|
+
let(:enabled) { false }
|
|
52
|
+
|
|
53
|
+
it 'should do nothing' do
|
|
54
|
+
expect(SpecsRemover).not_to have_received(:remove)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|