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,65 +1,65 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
|
3
|
-
describe Rake::Funnel::Support::Which do
|
4
|
-
let(:temp_dir) { Dir.mktmpdir }
|
5
|
-
let(:executable_path) { File.join(temp_dir, 'executable.exe') }
|
6
|
-
let(:create_entry) { lambda { |p| FileUtils.touch(p) }}
|
7
|
-
|
8
|
-
before {
|
9
|
-
create_entry.call(executable_path)
|
10
|
-
|
11
|
-
allow(ENV).to receive(:[]).with('PATH').and_return(temp_dir)
|
12
|
-
}
|
13
|
-
|
14
|
-
after {
|
15
|
-
FileUtils.rm_rf(temp_dir)
|
16
|
-
}
|
17
|
-
|
18
|
-
describe 'executable in PATH' do
|
19
|
-
context 'found' do
|
20
|
-
it 'should yield executable' do
|
21
|
-
expect(described_class.which(File.basename(executable_path))).to eq(executable_path)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'not found' do
|
26
|
-
it 'should yield nil' do
|
27
|
-
expect(described_class.which('does-not-exist.exe')).to be_nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'found as directory' do
|
32
|
-
let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } }
|
33
|
-
|
34
|
-
it 'should yield nil' do
|
35
|
-
expect(described_class.which('executable.exe')).to be_nil
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'executable in current working directory' do
|
41
|
-
context 'found' do
|
42
|
-
it 'should yield executable' do
|
43
|
-
Dir.chdir(temp_dir) do
|
44
|
-
expect(described_class.which(File.basename(executable_path))).to eq(File.basename(executable_path))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'not found' do
|
50
|
-
it 'should yield nil' do
|
51
|
-
Dir.chdir(temp_dir) do
|
52
|
-
expect(described_class.which('does-not-exist.exe')).to be_nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'found as directory' do
|
58
|
-
let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } }
|
59
|
-
|
60
|
-
it 'should yield nil' do
|
61
|
-
expect(described_class.which('executable.exe')).to be_nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
1
|
+
require 'tmpdir'
|
2
|
+
|
3
|
+
describe Rake::Funnel::Support::Which do
|
4
|
+
let(:temp_dir) { Dir.mktmpdir }
|
5
|
+
let(:executable_path) { File.join(temp_dir, 'executable.exe') }
|
6
|
+
let(:create_entry) { lambda { |p| FileUtils.touch(p) }}
|
7
|
+
|
8
|
+
before {
|
9
|
+
create_entry.call(executable_path)
|
10
|
+
|
11
|
+
allow(ENV).to receive(:[]).with('PATH').and_return(temp_dir)
|
12
|
+
}
|
13
|
+
|
14
|
+
after {
|
15
|
+
FileUtils.rm_rf(temp_dir)
|
16
|
+
}
|
17
|
+
|
18
|
+
describe 'executable in PATH' do
|
19
|
+
context 'found' do
|
20
|
+
it 'should yield executable' do
|
21
|
+
expect(described_class.which(File.basename(executable_path))).to eq(executable_path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'not found' do
|
26
|
+
it 'should yield nil' do
|
27
|
+
expect(described_class.which('does-not-exist.exe')).to be_nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'found as directory' do
|
32
|
+
let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } }
|
33
|
+
|
34
|
+
it 'should yield nil' do
|
35
|
+
expect(described_class.which('executable.exe')).to be_nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'executable in current working directory' do
|
41
|
+
context 'found' do
|
42
|
+
it 'should yield executable' do
|
43
|
+
Dir.chdir(temp_dir) do
|
44
|
+
expect(described_class.which(File.basename(executable_path))).to eq(File.basename(executable_path))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'not found' do
|
50
|
+
it 'should yield nil' do
|
51
|
+
Dir.chdir(temp_dir) do
|
52
|
+
expect(described_class.which('does-not-exist.exe')).to be_nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'found as directory' do
|
58
|
+
let(:create_entry) { lambda { |p| FileUtils.mkdir_p(p) } }
|
59
|
+
|
60
|
+
it 'should yield nil' do
|
61
|
+
expect(described_class.which('executable.exe')).to be_nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -1,77 +1,77 @@
|
|
1
|
-
include Rake::Funnel::Support
|
2
|
-
|
3
|
-
describe Rake::Funnel::Support::Zipper do
|
4
|
-
describe '#zip' do
|
5
|
-
let(:source) { %w(bin/1 bin/2 bin/3/4) }
|
6
|
-
|
7
|
-
context 'failure' do
|
8
|
-
context 'target not defined' do
|
9
|
-
let(:target) { nil }
|
10
|
-
|
11
|
-
it 'should fail' do
|
12
|
-
expect { described_class.zip(source, target) }.to raise_error(/Target not defined/)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'success' do
|
18
|
-
let(:target) { 'some path/file.zip' }
|
19
|
-
let(:zip_root) { nil }
|
20
|
-
let(:zip) { instance_double(::Zip::File).as_null_object }
|
21
|
-
let(:mtime) { Time.new(2015, 3, 9) }
|
22
|
-
let(:zip_entry) { double(::Zip::Entry).as_null_object }
|
23
|
-
|
24
|
-
before {
|
25
|
-
allow(RakeFileUtils).to receive(:mkdir_p)
|
26
|
-
}
|
27
|
-
|
28
|
-
before {
|
29
|
-
allow(::Zip::File).to receive(:open).with(target, ::Zip::File::CREATE).and_yield(zip)
|
30
|
-
allow(zip).to receive(:add).and_return(zip_entry)
|
31
|
-
allow(File).to receive(:mtime).and_return(mtime)
|
32
|
-
}
|
33
|
-
|
34
|
-
before {
|
35
|
-
described_class.zip(source, target, zip_root)
|
36
|
-
}
|
37
|
-
|
38
|
-
it 'should create the target directory' do
|
39
|
-
expect(RakeFileUtils).to have_received(:mkdir_p).with(File.dirname(target))
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'configuration' do
|
43
|
-
it 'should allow unicode names' do
|
44
|
-
expect(::Zip.unicode_names).to eq(true)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should use best compression' do
|
48
|
-
expect(::Zip.default_compression).to eq(Zlib::BEST_COMPRESSION)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'work-around for https://github.com/rubyzip/rubyzip/issues/176' do
|
53
|
-
it 'should explicitly set the file mtime' do
|
54
|
-
expect(zip_entry).to have_received(:time=).with(mtime).exactly(source.length).times
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'common path' do
|
59
|
-
it 'should remove the common path from the source' do
|
60
|
-
expect(zip).not_to have_received(:add).with(/#{source.common_path}/, anything)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe 'zip root' do
|
65
|
-
[nil, '', 'some path/inside the zip file'].each do |root|
|
66
|
-
context "with '#{root || 'nil'}'" do
|
67
|
-
let(:zip_root) { root }
|
68
|
-
|
69
|
-
it "should put files below #{(root.nil? || root.empty?) ? 'the root' : "'#{root}'"}" do
|
70
|
-
expect(zip).to have_received(:add).with(/^#{root}/, anything).exactly(source.length).times
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
1
|
+
include Rake::Funnel::Support
|
2
|
+
|
3
|
+
describe Rake::Funnel::Support::Zipper do
|
4
|
+
describe '#zip' do
|
5
|
+
let(:source) { %w(bin/1 bin/2 bin/3/4) }
|
6
|
+
|
7
|
+
context 'failure' do
|
8
|
+
context 'target not defined' do
|
9
|
+
let(:target) { nil }
|
10
|
+
|
11
|
+
it 'should fail' do
|
12
|
+
expect { described_class.zip(source, target) }.to raise_error(/Target not defined/)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'success' do
|
18
|
+
let(:target) { 'some path/file.zip' }
|
19
|
+
let(:zip_root) { nil }
|
20
|
+
let(:zip) { instance_double(::Zip::File).as_null_object }
|
21
|
+
let(:mtime) { Time.new(2015, 3, 9) }
|
22
|
+
let(:zip_entry) { double(::Zip::Entry).as_null_object }
|
23
|
+
|
24
|
+
before {
|
25
|
+
allow(RakeFileUtils).to receive(:mkdir_p)
|
26
|
+
}
|
27
|
+
|
28
|
+
before {
|
29
|
+
allow(::Zip::File).to receive(:open).with(target, ::Zip::File::CREATE).and_yield(zip)
|
30
|
+
allow(zip).to receive(:add).and_return(zip_entry)
|
31
|
+
allow(File).to receive(:mtime).and_return(mtime)
|
32
|
+
}
|
33
|
+
|
34
|
+
before {
|
35
|
+
described_class.zip(source, target, zip_root)
|
36
|
+
}
|
37
|
+
|
38
|
+
it 'should create the target directory' do
|
39
|
+
expect(RakeFileUtils).to have_received(:mkdir_p).with(File.dirname(target))
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'configuration' do
|
43
|
+
it 'should allow unicode names' do
|
44
|
+
expect(::Zip.unicode_names).to eq(true)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should use best compression' do
|
48
|
+
expect(::Zip.default_compression).to eq(Zlib::BEST_COMPRESSION)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'work-around for https://github.com/rubyzip/rubyzip/issues/176' do
|
53
|
+
it 'should explicitly set the file mtime' do
|
54
|
+
expect(zip_entry).to have_received(:time=).with(mtime).exactly(source.length).times
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'common path' do
|
59
|
+
it 'should remove the common path from the source' do
|
60
|
+
expect(zip).not_to have_received(:add).with(/#{source.common_path}/, anything)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'zip root' do
|
65
|
+
[nil, '', 'some path/inside the zip file'].each do |root|
|
66
|
+
context "with '#{root || 'nil'}'" do
|
67
|
+
let(:zip_root) { root }
|
68
|
+
|
69
|
+
it "should put files below #{(root.nil? || root.empty?) ? 'the root' : "'#{root}'"}" do
|
70
|
+
expect(zip).to have_received(:add).with(/^#{root}/, anything).exactly(source.length).times
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
include Rake
|
2
|
-
include Rake::Funnel::Support
|
3
|
-
|
4
|
-
describe Rake::Funnel::Tasks::AssemblyVersion do
|
5
|
-
before {
|
6
|
-
Task.clear
|
7
|
-
}
|
8
|
-
|
9
|
-
describe 'defaults' do
|
10
|
-
its(:name) { should == :version }
|
11
|
-
its(:language) { should == :cs }
|
12
|
-
its(:source) { should == :FromVersionFiles }
|
13
|
-
its(:source_args) { should == {} }
|
14
|
-
its(:target_path) { should be_an_instance_of(Proc) }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'execution' do
|
18
|
-
let(:writer) { instance_double(AssemblyVersionWriter).as_null_object }
|
19
|
-
|
20
|
-
before {
|
21
|
-
allow(AssemblyVersionWriter).to receive(:new).and_return(writer)
|
22
|
-
}
|
23
|
-
|
24
|
-
subject {
|
25
|
-
described_class.new(:name) do |t|
|
26
|
-
t.language = [:cs, :vb]
|
27
|
-
t.source = %w(one two)
|
28
|
-
t.source_args = { foo: 42 }
|
29
|
-
t.target_path = 'will not work'
|
30
|
-
end
|
31
|
-
}
|
32
|
-
|
33
|
-
before {
|
34
|
-
Task[subject.name].invoke
|
35
|
-
}
|
36
|
-
|
37
|
-
it 'should pass source and source_args' do
|
38
|
-
expect(AssemblyVersionWriter).to have_received(:new).with(subject.source, subject.source_args)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should use writer' do
|
42
|
-
expect(writer).to have_received(:write).with(subject.target_path, subject.language)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel::Support
|
3
|
+
|
4
|
+
describe Rake::Funnel::Tasks::AssemblyVersion do
|
5
|
+
before {
|
6
|
+
Task.clear
|
7
|
+
}
|
8
|
+
|
9
|
+
describe 'defaults' do
|
10
|
+
its(:name) { should == :version }
|
11
|
+
its(:language) { should == :cs }
|
12
|
+
its(:source) { should == :FromVersionFiles }
|
13
|
+
its(:source_args) { should == {} }
|
14
|
+
its(:target_path) { should be_an_instance_of(Proc) }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'execution' do
|
18
|
+
let(:writer) { instance_double(AssemblyVersionWriter).as_null_object }
|
19
|
+
|
20
|
+
before {
|
21
|
+
allow(AssemblyVersionWriter).to receive(:new).and_return(writer)
|
22
|
+
}
|
23
|
+
|
24
|
+
subject {
|
25
|
+
described_class.new(:name) do |t|
|
26
|
+
t.language = [:cs, :vb]
|
27
|
+
t.source = %w(one two)
|
28
|
+
t.source_args = { foo: 42 }
|
29
|
+
t.target_path = 'will not work'
|
30
|
+
end
|
31
|
+
}
|
32
|
+
|
33
|
+
before {
|
34
|
+
Task[subject.name].invoke
|
35
|
+
}
|
36
|
+
|
37
|
+
it 'should pass source and source_args' do
|
38
|
+
expect(AssemblyVersionWriter).to have_received(:new).with(subject.source, subject.source_args)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should use writer' do
|
42
|
+
expect(writer).to have_received(:write).with(subject.target_path, subject.language)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
include Rake
|
2
|
-
|
3
|
-
describe Rake::Funnel::Tasks::BinPath do
|
4
|
-
before {
|
5
|
-
Task.clear
|
6
|
-
}
|
7
|
-
|
8
|
-
describe 'defaults' do
|
9
|
-
its(:name) { should == :bin_path }
|
10
|
-
its(:search_pattern) { should eq(%w(tools/* tools/*/bin packages/**/tools)) }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'execution' do
|
14
|
-
let(:default_path) { 'default PATH contents' }
|
15
|
-
let(:search_pattern) { %w(foo bar) }
|
16
|
-
|
17
|
-
before {
|
18
|
-
allow(ENV).to receive(:[]).with('PATH').and_return(default_path)
|
19
|
-
allow(ENV).to receive(:[]=)
|
20
|
-
allow(Rake).to receive(:rake_output_message)
|
21
|
-
}
|
22
|
-
|
23
|
-
before {
|
24
|
-
allow(Dir).to receive(:[]).with(*search_pattern).and_return(search_pattern)
|
25
|
-
}
|
26
|
-
|
27
|
-
subject {
|
28
|
-
described_class.new do |t|
|
29
|
-
t.search_pattern = search_pattern
|
30
|
-
end
|
31
|
-
}
|
32
|
-
|
33
|
-
before {
|
34
|
-
Task[subject.name].invoke
|
35
|
-
}
|
36
|
-
|
37
|
-
it 'should prepend sorted matching folders to the PATH environment variable' do
|
38
|
-
paths = search_pattern.map { |path| File.expand_path(path) }.sort.join(File::PATH_SEPARATOR)
|
39
|
-
|
40
|
-
expect(ENV).to have_received(:[]=).with('PATH',/^#{paths}/)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should append original PATH environment variable' do
|
44
|
-
expect(ENV).to have_received(:[]=).with('PATH', /#{default_path}$/)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should report added paths' do
|
48
|
-
expect(Rake).to have_received(:rake_output_message).with(%r|/foo$|)
|
49
|
-
expect(Rake).to have_received(:rake_output_message).with(%r|/bar$|)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
1
|
+
include Rake
|
2
|
+
|
3
|
+
describe Rake::Funnel::Tasks::BinPath do
|
4
|
+
before {
|
5
|
+
Task.clear
|
6
|
+
}
|
7
|
+
|
8
|
+
describe 'defaults' do
|
9
|
+
its(:name) { should == :bin_path }
|
10
|
+
its(:search_pattern) { should eq(%w(tools/* tools/*/bin packages/**/tools)) }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'execution' do
|
14
|
+
let(:default_path) { 'default PATH contents' }
|
15
|
+
let(:search_pattern) { %w(foo bar) }
|
16
|
+
|
17
|
+
before {
|
18
|
+
allow(ENV).to receive(:[]).with('PATH').and_return(default_path)
|
19
|
+
allow(ENV).to receive(:[]=)
|
20
|
+
allow(Rake).to receive(:rake_output_message)
|
21
|
+
}
|
22
|
+
|
23
|
+
before {
|
24
|
+
allow(Dir).to receive(:[]).with(*search_pattern).and_return(search_pattern)
|
25
|
+
}
|
26
|
+
|
27
|
+
subject {
|
28
|
+
described_class.new do |t|
|
29
|
+
t.search_pattern = search_pattern
|
30
|
+
end
|
31
|
+
}
|
32
|
+
|
33
|
+
before {
|
34
|
+
Task[subject.name].invoke
|
35
|
+
}
|
36
|
+
|
37
|
+
it 'should prepend sorted matching folders to the PATH environment variable' do
|
38
|
+
paths = search_pattern.map { |path| File.expand_path(path) }.sort.join(File::PATH_SEPARATOR)
|
39
|
+
|
40
|
+
expect(ENV).to have_received(:[]=).with('PATH',/^#{paths}/)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should append original PATH environment variable' do
|
44
|
+
expect(ENV).to have_received(:[]=).with('PATH', /#{default_path}$/)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should report added paths' do
|
48
|
+
expect(Rake).to have_received(:rake_output_message).with(%r|/foo$|)
|
49
|
+
expect(Rake).to have_received(:rake_output_message).with(%r|/bar$|)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,44 +1,44 @@
|
|
1
|
-
include Rake
|
2
|
-
include Rake::Funnel::Support
|
3
|
-
|
4
|
-
describe Rake::Funnel::Tasks::Copy do
|
5
|
-
before {
|
6
|
-
Task.clear
|
7
|
-
}
|
8
|
-
|
9
|
-
describe 'defaults' do
|
10
|
-
its(:name) { should == :copy }
|
11
|
-
its(:source) { should eq([]) }
|
12
|
-
its(:target) { should be_nil }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'execution' do
|
16
|
-
let(:source) { %w(one two) }
|
17
|
-
let(:target) { 'target' }
|
18
|
-
let(:finder) { instance_double(Finder).as_null_object }
|
19
|
-
|
20
|
-
before {
|
21
|
-
allow(finder).to receive(:all_or_default).and_return(source)
|
22
|
-
allow(Finder).to receive(:new).and_return(finder)
|
23
|
-
}
|
24
|
-
|
25
|
-
before {
|
26
|
-
allow(Copier).to receive(:copy)
|
27
|
-
}
|
28
|
-
|
29
|
-
subject {
|
30
|
-
described_class.new do |t|
|
31
|
-
t.source = source
|
32
|
-
t.target = target
|
33
|
-
end
|
34
|
-
}
|
35
|
-
|
36
|
-
before {
|
37
|
-
Task[subject.name].invoke
|
38
|
-
}
|
39
|
-
|
40
|
-
it 'should delegate to Copier' do
|
41
|
-
expect(Copier).to have_received(:copy).with(source, subject.target)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel::Support
|
3
|
+
|
4
|
+
describe Rake::Funnel::Tasks::Copy do
|
5
|
+
before {
|
6
|
+
Task.clear
|
7
|
+
}
|
8
|
+
|
9
|
+
describe 'defaults' do
|
10
|
+
its(:name) { should == :copy }
|
11
|
+
its(:source) { should eq([]) }
|
12
|
+
its(:target) { should be_nil }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'execution' do
|
16
|
+
let(:source) { %w(one two) }
|
17
|
+
let(:target) { 'target' }
|
18
|
+
let(:finder) { instance_double(Finder).as_null_object }
|
19
|
+
|
20
|
+
before {
|
21
|
+
allow(finder).to receive(:all_or_default).and_return(source)
|
22
|
+
allow(Finder).to receive(:new).and_return(finder)
|
23
|
+
}
|
24
|
+
|
25
|
+
before {
|
26
|
+
allow(Copier).to receive(:copy)
|
27
|
+
}
|
28
|
+
|
29
|
+
subject {
|
30
|
+
described_class.new do |t|
|
31
|
+
t.source = source
|
32
|
+
t.target = target
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
before {
|
37
|
+
Task[subject.name].invoke
|
38
|
+
}
|
39
|
+
|
40
|
+
it 'should delegate to Copier' do
|
41
|
+
expect(Copier).to have_received(:copy).with(source, subject.target)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|