rake-funnel 0.0.1.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 +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.travis.yml +21 -0
- data/Gemfile +29 -0
- data/Guardfile +24 -0
- data/README.md +29 -0
- data/Rakefile +77 -0
- data/build.cmd +30 -0
- data/bundle.cmd +26 -0
- data/config/.gitignore +1 -0
- data/config/.local.yaml.example +9 -0
- data/config/default.yaml +5 -0
- data/config/dev.yaml +0 -0
- data/config/production.yaml +3 -0
- data/lib/rake/funnel/ambiguous_file_error.rb +29 -0
- data/lib/rake/funnel/execution_error.rb +26 -0
- data/lib/rake/funnel/extensions/camel_case.rb +19 -0
- data/lib/rake/funnel/extensions/common_path.rb +52 -0
- data/lib/rake/funnel/extensions/disable_colors.rb +27 -0
- data/lib/rake/funnel/extensions/rexml.rb +23 -0
- data/lib/rake/funnel/extensions/shell.rb +56 -0
- data/lib/rake/funnel/framework.rb +15 -0
- data/lib/rake/funnel/integration/progress_report.rb +70 -0
- data/lib/rake/funnel/integration/sync_output.rb +8 -0
- data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +59 -0
- data/lib/rake/funnel/integration/teamcity/progress_report.rb +33 -0
- data/lib/rake/funnel/integration/teamcity/service_messages.rb +40 -0
- data/lib/rake/funnel/integration/teamcity/teamcity.rb +15 -0
- data/lib/rake/funnel/integration/teamcity.rb +5 -0
- data/lib/rake/funnel/support/finder.rb +51 -0
- data/lib/rake/funnel/support/mapper.rb +81 -0
- data/lib/rake/funnel/support/mapper_styles/default.rb +31 -0
- data/lib/rake/funnel/support/mapper_styles/msbuild.rb +33 -0
- data/lib/rake/funnel/support/mapper_styles/msdeploy.rb +47 -0
- data/lib/rake/funnel/support/mapper_styles/nunit.rb +33 -0
- data/lib/rake/funnel/support/mono.rb +17 -0
- data/lib/rake/funnel/support/patch.rb +37 -0
- data/lib/rake/funnel/support/template_engine.rb +26 -0
- data/lib/rake/funnel/support/which.rb +15 -0
- data/lib/rake/funnel/tasks/bin_path.rb +34 -0
- data/lib/rake/funnel/tasks/copy.rb +54 -0
- data/lib/rake/funnel/tasks/environments.rb +74 -0
- data/lib/rake/funnel/tasks/environments_support/loader.rb +37 -0
- data/lib/rake/funnel/tasks/msbuild.rb +52 -0
- data/lib/rake/funnel/tasks/msbuild_support/build_tool.rb +28 -0
- data/lib/rake/funnel/tasks/msdeploy.rb +58 -0
- data/lib/rake/funnel/tasks/msdeploy_support/registry_patch.rb +84 -0
- data/lib/rake/funnel/tasks/nunit.rb +46 -0
- data/lib/rake/funnel/tasks/paket.rb +39 -0
- data/lib/rake/funnel/tasks/quick_template.rb +45 -0
- data/lib/rake/funnel/tasks/side_by_side_specs.rb +33 -0
- data/lib/rake/funnel/tasks/side_by_side_specs_support/remover.rb +62 -0
- data/lib/rake/funnel/tasks/timing.rb +100 -0
- data/lib/rake/funnel/tasks/timing_support/report.rb +89 -0
- data/lib/rake/funnel/tasks/timing_support/statistics.rb +26 -0
- data/lib/rake/funnel/tasks/zip.rb +66 -0
- data/lib/rake/funnel/version.rb +5 -0
- data/lib/rake/funnel.rb +7 -0
- data/rake-funnel.gemspec +28 -0
- data/spec/rake/funnel/execution_error_spec.rb +67 -0
- data/spec/rake/funnel/extensions/camel_case_spec.rb +17 -0
- data/spec/rake/funnel/extensions/common_path_spec.rb +56 -0
- data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -0
- data/spec/rake/funnel/extensions/rexml_spec.rb +20 -0
- data/spec/rake/funnel/extensions/shell_spec.rb +237 -0
- data/spec/rake/funnel/integration/progress_report_spec.rb +149 -0
- data/spec/rake/funnel/integration/sync_output_spec.rb +16 -0
- data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +112 -0
- data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -0
- data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -0
- data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -0
- data/spec/rake/funnel/support/finder_spec.rb +210 -0
- data/spec/rake/funnel/support/mapper_spec.rb +87 -0
- data/spec/rake/funnel/support/mapper_styles/msdeploy_spec.rb +222 -0
- data/spec/rake/funnel/support/mapper_styles/nunit_spec.rb +25 -0
- data/spec/rake/funnel/support/mapper_styles/styles_spec.rb +214 -0
- data/spec/rake/funnel/support/mono_spec.rb +57 -0
- data/spec/rake/funnel/support/patch_spec.rb +108 -0
- data/spec/rake/funnel/support/template_engine_spec.rb +65 -0
- data/spec/rake/funnel/support/which_spec.rb +65 -0
- data/spec/rake/funnel/tasks/bin_path_spec.rb +40 -0
- data/spec/rake/funnel/tasks/copy_spec.rb +101 -0
- data/spec/rake/funnel/tasks/environments_spec.rb +237 -0
- data/spec/rake/funnel/tasks/environments_support/loader_spec.rb +114 -0
- data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -0
- data/spec/rake/funnel/tasks/msbuild_support/build_tool_spec.rb +21 -0
- data/spec/rake/funnel/tasks/msdeploy_spec.rb +243 -0
- data/spec/rake/funnel/tasks/msdeploy_support/registry_patch_spec.rb +139 -0
- data/spec/rake/funnel/tasks/nunit_spec.rb +76 -0
- data/spec/rake/funnel/tasks/paket_spec.rb +184 -0
- data/spec/rake/funnel/tasks/quick_template_spec.rb +89 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/FooCode.cs +0 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/FooSpecs.cs +0 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/Sample.csproj +28 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/Specs.cs +0 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/subdir/BarCode.cs +0 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/example/subdir/BarSpecs.cs +0 -0
- data/spec/rake/funnel/tasks/side_by_side_specs_support/remover_spec.rb +116 -0
- data/spec/rake/funnel/tasks/timing_spec.rb +133 -0
- data/spec/rake/funnel/tasks/timing_support/report_spec.rb +129 -0
- data/spec/rake/funnel/tasks/zip_spec.rb +119 -0
- data/spec/spec_helper.rb +32 -0
- data/tools/MSDeploy/Microsoft.Web.Delegation.dll +0 -0
- data/tools/MSDeploy/Microsoft.Web.Deployment.Tracing.dll +0 -0
- data/tools/MSDeploy/Microsoft.Web.Deployment.dll +0 -0
- data/tools/MSDeploy/en/msdeploy.resources.dll +0 -0
- data/tools/MSDeploy/msdeploy.exe +0 -0
- data/tools/MSDeploy/msdeploy.exe.config +6 -0
- metadata +253 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
describe Rake::Funnel::Tasks::EnvironmentsSupport::Loader do
|
2
|
+
describe 'loading configuration' do
|
3
|
+
let(:config) {
|
4
|
+
{
|
5
|
+
name: 'environment name',
|
6
|
+
config_files: config_files.keys.map(&:to_s)
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
let(:config_files) {
|
11
|
+
{
|
12
|
+
one: 'one: 23',
|
13
|
+
two: 'two: 42'
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
let(:store) {
|
18
|
+
double(Configatron::Store).as_null_object
|
19
|
+
}
|
20
|
+
|
21
|
+
before {
|
22
|
+
config_files.each do |file, content|
|
23
|
+
allow(File).to receive(:read).with(file.to_s).and_return(content)
|
24
|
+
end
|
25
|
+
|
26
|
+
allow(Rake).to receive(:rake_output_message)
|
27
|
+
}
|
28
|
+
|
29
|
+
before {
|
30
|
+
described_class.load_configuration(config, store)
|
31
|
+
}
|
32
|
+
|
33
|
+
it 'should reinitialize the configatron store' do
|
34
|
+
expect(store).to have_received(:unlock!)
|
35
|
+
expect(store).to have_received(:reset!)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should save the env to store' do
|
39
|
+
expect(store).to have_received(:env=).with(config[:name])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should load all config files' do
|
43
|
+
config[:config_files].each do |file|
|
44
|
+
expect(File).to have_received(:read).with(file)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should add each config file's values to the store" do
|
49
|
+
expect(store).to have_received(:configure_from_hash).with({ 'one' => 23 })
|
50
|
+
expect(store).to have_received(:configure_from_hash).with({ 'two' => 42 })
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should lock the store' do
|
54
|
+
expect(store).to have_received(:lock!)
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'config file with overriding values' do
|
58
|
+
let(:config_files) {
|
59
|
+
{
|
60
|
+
one: 'foo: bar',
|
61
|
+
two: 'foo: baz'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
let(:store) {
|
66
|
+
Configatron::RootStore.new
|
67
|
+
}
|
68
|
+
|
69
|
+
it 'should merge config values' do
|
70
|
+
expect(store.foo).to eq('baz')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'env also defined in config file' do
|
75
|
+
let(:config_files) {
|
76
|
+
{
|
77
|
+
with_env: 'env: foo'
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
let(:store) {
|
82
|
+
Configatron::RootStore.new
|
83
|
+
}
|
84
|
+
|
85
|
+
it 'should override env from config' do
|
86
|
+
expect(store.env).to eq('foo')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'empty config file' do
|
91
|
+
let(:config_files) {
|
92
|
+
{
|
93
|
+
empty: ''
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
it 'should configure with empty hash' do
|
98
|
+
expect(store).to have_received(:configure_from_hash).with({})
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'config file with ERb' do
|
103
|
+
let(:config_files) {
|
104
|
+
{
|
105
|
+
with_erb: 'foo: <%= 40 + 2 %>'
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
it 'should evaluate ERb' do
|
110
|
+
expect(store).to have_received(:configure_from_hash).with({ 'foo' => 42 })
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel
|
3
|
+
include Rake::Funnel::Support
|
4
|
+
include Rake::Funnel::Tasks::MSBuildSupport
|
5
|
+
|
6
|
+
describe Rake::Funnel::Tasks::MSBuild do
|
7
|
+
before {
|
8
|
+
Task.clear
|
9
|
+
}
|
10
|
+
|
11
|
+
describe 'defaults' do
|
12
|
+
its(:name) { should == :compile }
|
13
|
+
its(:project_or_solution) { should be_instance_of(Finder) }
|
14
|
+
its(:args) { should == {} }
|
15
|
+
its(:search_pattern) { should == %w(**/*.sln) }
|
16
|
+
|
17
|
+
describe 'build tool' do
|
18
|
+
before {
|
19
|
+
allow(BuildTool).to receive(:find).and_return('build tool')
|
20
|
+
}
|
21
|
+
|
22
|
+
it 'should use build tool finder' do
|
23
|
+
expect(subject.msbuild).to eq('build tool')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'overriding defaults' do
|
29
|
+
context 'when msbuild executable is specified' do
|
30
|
+
subject {
|
31
|
+
described_class.new do |t|
|
32
|
+
t.msbuild = 'custom build tool.exe'
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
its(:msbuild) { should == 'custom build tool.exe' }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when project or solution is specified' do
|
40
|
+
before {
|
41
|
+
allow(Finder).to receive(:new).and_call_original
|
42
|
+
}
|
43
|
+
|
44
|
+
subject {
|
45
|
+
described_class.new do |t|
|
46
|
+
t.project_or_solution = 'project.sln'
|
47
|
+
end
|
48
|
+
}
|
49
|
+
|
50
|
+
its(:project_or_solution) { should be_instance_of(Finder) }
|
51
|
+
|
52
|
+
it 'should set project or solution' do
|
53
|
+
expect(Finder).to have_received(:new).with('project.sln', subject, 'No projects or more than one project found.')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'execution' do
|
59
|
+
let(:args) { {} }
|
60
|
+
|
61
|
+
let(:mapper) { double(Mapper).as_null_object }
|
62
|
+
let(:finder) { double(Finder).as_null_object }
|
63
|
+
|
64
|
+
before {
|
65
|
+
allow(subject).to receive(:sh)
|
66
|
+
|
67
|
+
allow(Mapper).to receive(:new).and_return(mapper)
|
68
|
+
allow(Finder).to receive(:new).and_return(finder)
|
69
|
+
}
|
70
|
+
|
71
|
+
before {
|
72
|
+
Task[subject.name].invoke
|
73
|
+
}
|
74
|
+
|
75
|
+
it 'should use solution finder' do
|
76
|
+
expect(finder).to have_received(:single)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should use MSBuild mapper' do
|
80
|
+
expect(Mapper).to have_received(:new).with(:MSBuild)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should map arguments' do
|
84
|
+
expect(mapper).to have_received(:map).with(args)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should run with sh' do
|
88
|
+
expect(subject).to have_received(:sh)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
describe Rake::Funnel::Tasks::MSBuildSupport::BuildTool do
|
2
|
+
before {
|
3
|
+
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
4
|
+
}
|
5
|
+
|
6
|
+
context 'on Windows', platform: :win32 do
|
7
|
+
let(:windows?) { true }
|
8
|
+
|
9
|
+
it 'should find msbuild.exe' do
|
10
|
+
expect(described_class.find).to match(/msbuild\.exe$/)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'not on Windows' do
|
15
|
+
let(:windows?) { false }
|
16
|
+
|
17
|
+
it 'should find xbuild' do
|
18
|
+
expect(described_class.find).to eq('xbuild')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel
|
3
|
+
include Rake::Funnel::Support
|
4
|
+
include Rake::Funnel::Tasks::MSDeploySupport
|
5
|
+
|
6
|
+
describe Rake::Funnel::Tasks::MSDeploy do
|
7
|
+
before {
|
8
|
+
CLEAN.clear
|
9
|
+
Task.clear
|
10
|
+
}
|
11
|
+
|
12
|
+
describe 'defaults' do
|
13
|
+
its(:name) { should == :msdeploy }
|
14
|
+
its(:msdeploy) { should == 'msdeploy' }
|
15
|
+
its(:log_file) { should == 'msdeploy.log' }
|
16
|
+
its(:args) { should == {} }
|
17
|
+
|
18
|
+
it 'should add the log file to the files to be cleaned' do
|
19
|
+
expect(CLEAN).to include(subject.log_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'overriding defaults' do
|
24
|
+
context 'when task name is specified' do
|
25
|
+
it 'should have a default log file equal to the task name' do
|
26
|
+
expect(described_class.new(:foo).log_file).to eq('foo.log')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when task name and log file is specified' do
|
31
|
+
subject! {
|
32
|
+
described_class.new(:foo) do |t|
|
33
|
+
t.log_file = 'bar.log'
|
34
|
+
end
|
35
|
+
}
|
36
|
+
|
37
|
+
it 'should use custom log file' do
|
38
|
+
expect(subject.log_file).to eq('bar.log')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should add the log file to the files to be cleaned' do
|
42
|
+
expect(CLEAN).to include(subject.log_file)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'execution' do
|
48
|
+
let(:msdeploy) { 'msdeploy' }
|
49
|
+
let(:args) { {} }
|
50
|
+
|
51
|
+
subject {
|
52
|
+
described_class.new do |t|
|
53
|
+
t.msdeploy = msdeploy
|
54
|
+
t.args = args
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
before {
|
59
|
+
allow(subject).to receive(:shell)
|
60
|
+
|
61
|
+
allow(RegistryPatch).to receive(:new).and_yield
|
62
|
+
}
|
63
|
+
|
64
|
+
describe 'argument mapping and invocation' do
|
65
|
+
let(:mapper) { double(Mapper).as_null_object }
|
66
|
+
|
67
|
+
before {
|
68
|
+
allow(Mapper).to receive(:new).and_return(mapper)
|
69
|
+
}
|
70
|
+
|
71
|
+
before {
|
72
|
+
Task[subject.name].invoke
|
73
|
+
}
|
74
|
+
|
75
|
+
it 'should use MSDeploy mapper' do
|
76
|
+
expect(Mapper).to have_received(:new).with(:MSDeploy)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should map arguments' do
|
80
|
+
expect(mapper).to have_received(:map).with(args)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should run with shell' do
|
84
|
+
expect(subject).to have_received(:shell).with(/^msdeploy /,
|
85
|
+
{
|
86
|
+
log_file: 'msdeploy.log',
|
87
|
+
error_lines: /^(error|[\w\.]*exception)/i
|
88
|
+
})
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'arg examples' do
|
93
|
+
before {
|
94
|
+
Task[subject.name].invoke
|
95
|
+
}
|
96
|
+
|
97
|
+
context 'skip actions' do
|
98
|
+
let (:args) {
|
99
|
+
{
|
100
|
+
verb: :sync,
|
101
|
+
source: {
|
102
|
+
content_path: 'deploy'
|
103
|
+
},
|
104
|
+
dest: {
|
105
|
+
computer_name: 'remote.example.com',
|
106
|
+
username: 'bob',
|
107
|
+
password: 'secret',
|
108
|
+
auto: true
|
109
|
+
},
|
110
|
+
skip: [
|
111
|
+
{ directory: 'logs' },
|
112
|
+
{
|
113
|
+
object_name: 'filePath',
|
114
|
+
skip_action: 'Delete',
|
115
|
+
absolute_path: 'App_Offline\.htm$'
|
116
|
+
}
|
117
|
+
],
|
118
|
+
use_checksum: nil,
|
119
|
+
allow_untrusted: nil
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
it 'should succeed' do
|
124
|
+
args = %w(
|
125
|
+
msdeploy
|
126
|
+
-verb:sync
|
127
|
+
-source:contentPath=deploy
|
128
|
+
-dest:computerName=remote.example.com,username=bob,password=secret,auto=true
|
129
|
+
-skip:directory=logs
|
130
|
+
-skip:objectName=filePath,skipAction=Delete,absolutePath=App_Offline\.htm$
|
131
|
+
-useChecksum
|
132
|
+
-allowUntrusted
|
133
|
+
)
|
134
|
+
|
135
|
+
expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'runCommand' do
|
140
|
+
let(:args) {
|
141
|
+
{
|
142
|
+
verb: :sync,
|
143
|
+
source: {
|
144
|
+
run_command: 'cd "C:\Program Files"',
|
145
|
+
wait_interval: 1
|
146
|
+
},
|
147
|
+
dest: {
|
148
|
+
computer_name: 'remote.example.com',
|
149
|
+
username: 'bob',
|
150
|
+
password: 'secret',
|
151
|
+
auto: true
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
it 'should succeed' do
|
157
|
+
args = %w(
|
158
|
+
msdeploy
|
159
|
+
-verb:sync
|
160
|
+
-source:runCommand="cd ""C:\Program Files""",waitInterval=1
|
161
|
+
-dest:computerName=remote.example.com,username=bob,password=secret,auto=true
|
162
|
+
)
|
163
|
+
|
164
|
+
expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'preSync runCommand' do
|
169
|
+
let(:args) {
|
170
|
+
{
|
171
|
+
verb: :sync,
|
172
|
+
pre_sync: {
|
173
|
+
run_command: 'cd "C:\Program Files"',
|
174
|
+
dont_use_command_exe: :true
|
175
|
+
},
|
176
|
+
source: {
|
177
|
+
content_path: 'deploy'
|
178
|
+
},
|
179
|
+
dest: {
|
180
|
+
computer_name: 'remote.example.com',
|
181
|
+
username: 'bob',
|
182
|
+
password: 'secret'
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
it 'should succeed' do
|
188
|
+
args = %w(
|
189
|
+
msdeploy
|
190
|
+
-verb:sync
|
191
|
+
-preSync:runCommand="cd ""C:\Program Files""",dontUseCommandExe=true
|
192
|
+
-source:contentPath=deploy
|
193
|
+
-dest:computerName=remote.example.com,username=bob,password=secret
|
194
|
+
)
|
195
|
+
|
196
|
+
expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
describe "MSDeploy's idiocy" do
|
202
|
+
before {
|
203
|
+
Task[subject.name].invoke
|
204
|
+
}
|
205
|
+
|
206
|
+
describe 'version registry value that is required to exist' do
|
207
|
+
it 'should patch the registry' do
|
208
|
+
expect(RegistryPatch).to have_received(:new)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe 'command line parser that requires quotes inside but not outside parameters' do
|
213
|
+
let(:msdeploy) { 'path to/msdeploy' }
|
214
|
+
|
215
|
+
let(:args) {
|
216
|
+
{
|
217
|
+
'simple key' => 'simple value',
|
218
|
+
hash: {
|
219
|
+
'hash key 1' => 'hash value 1',
|
220
|
+
'hash key 2' => 'hash value 2'
|
221
|
+
},
|
222
|
+
array: ['array value 1', 'array value 2'],
|
223
|
+
'some flag' => nil
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
it 'should quote the string' do
|
228
|
+
args = '"path to/msdeploy" -"simple key":"simple value" -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2" -array:"array value 1" -array:"array value 2" -"some flag"'
|
229
|
+
args = %w(
|
230
|
+
"path to/msdeploy"
|
231
|
+
-"simple key":"simple value"
|
232
|
+
-hash:"hash key 1"="hash value 1","hash key 2"="hash value 2"
|
233
|
+
-array:"array value 1"
|
234
|
+
-array:"array value 2"
|
235
|
+
-"some flag"
|
236
|
+
).join(' ')
|
237
|
+
|
238
|
+
expect(subject).to have_received(:shell).with(args, be_an_instance_of(Hash))
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
describe Rake::Funnel::Tasks::MSDeploySupport::RegistryPatch do
|
2
|
+
describe 'execution' do
|
3
|
+
it 'should yield block' do
|
4
|
+
result = 0
|
5
|
+
|
6
|
+
described_class.new do
|
7
|
+
result = 42
|
8
|
+
end
|
9
|
+
|
10
|
+
expect(result).to eq(42)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should work without block' do
|
14
|
+
expect(lambda { described_class.new }).not_to raise_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'patching' do
|
19
|
+
context 'not on Windows' do
|
20
|
+
before {
|
21
|
+
allow_any_instance_of(described_class).to receive(:require).with('win32/registry').and_raise(LoadError)
|
22
|
+
}
|
23
|
+
|
24
|
+
it 'should succeed' do
|
25
|
+
expect(lambda { described_class.new }).not_to raise_error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'on Windows', platform: :win32 do
|
30
|
+
let(:root) { Win32::Registry::HKEY_LOCAL_MACHINE }
|
31
|
+
|
32
|
+
let(:keys) {
|
33
|
+
described_class::KEYS.map do |key|
|
34
|
+
instance_double(Win32::Registry, keyname: key)
|
35
|
+
end
|
36
|
+
}
|
37
|
+
|
38
|
+
def allow_open_or_create(key)
|
39
|
+
allow(root).to receive(:create).with(key.keyname).and_yield(key)
|
40
|
+
end
|
41
|
+
|
42
|
+
def allow_open_for_deletion(key)
|
43
|
+
allow(root).to receive(:create).with(File.dirname(key.keyname)).and_yield(key)
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'MSDeploy registry key and "Version" value does not exist' do
|
47
|
+
before {
|
48
|
+
keys.each do |key|
|
49
|
+
allow(key).to receive(:created?).and_return(true)
|
50
|
+
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
51
|
+
allow(key).to receive(:[]=)
|
52
|
+
allow(key).to receive(:delete_key)
|
53
|
+
end
|
54
|
+
}
|
55
|
+
|
56
|
+
before {
|
57
|
+
keys.each do |key|
|
58
|
+
allow_open_or_create(key)
|
59
|
+
allow_open_for_deletion(key)
|
60
|
+
end
|
61
|
+
}
|
62
|
+
|
63
|
+
before {
|
64
|
+
described_class.new
|
65
|
+
}
|
66
|
+
|
67
|
+
it 'should create the key' do
|
68
|
+
keys.each do |key|
|
69
|
+
expect(root).to have_received(:create).with(key.keyname)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should create the version' do
|
74
|
+
keys.each do |key|
|
75
|
+
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should delete the key' do
|
80
|
+
keys.each do |key|
|
81
|
+
expect(key).to have_received(:delete_key).with(File.basename(key.keyname), true)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'MSDeploy registry key does exist' do
|
87
|
+
before {
|
88
|
+
keys.each do |key|
|
89
|
+
allow_open_or_create(key)
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
context '"Version" value does not exist' do
|
94
|
+
before {
|
95
|
+
keys.each do |key|
|
96
|
+
allow(key).to receive(:created?).and_return(false)
|
97
|
+
allow(key).to receive(:[]).and_raise(Win32::Registry::Error.new('value does not exist, so getting it raises'.length))
|
98
|
+
allow(key).to receive(:[]=)
|
99
|
+
allow(key).to receive(:delete_value)
|
100
|
+
end
|
101
|
+
}
|
102
|
+
|
103
|
+
before {
|
104
|
+
described_class.new
|
105
|
+
}
|
106
|
+
|
107
|
+
it 'should create the version' do
|
108
|
+
keys.each do |key|
|
109
|
+
expect(key).to have_received(:[]=).with('Version', described_class::FAKE_VERSION)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should delete the version' do
|
114
|
+
keys.each do |key|
|
115
|
+
expect(key).to have_received(:delete_value).with(described_class::VERSION_VALUE)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context '"Version" value does exist' do
|
121
|
+
before {
|
122
|
+
keys.each do |key|
|
123
|
+
allow(key).to receive(:created?).and_return(false)
|
124
|
+
allow(key).to receive(:[])
|
125
|
+
end
|
126
|
+
}
|
127
|
+
|
128
|
+
before {
|
129
|
+
described_class.new
|
130
|
+
}
|
131
|
+
|
132
|
+
it 'should do nothing' do
|
133
|
+
expect(true).to eq(true)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
include Rake
|
2
|
+
include Rake::Funnel
|
3
|
+
include Rake::Funnel::Integration::TeamCity
|
4
|
+
include Rake::Funnel::Support
|
5
|
+
|
6
|
+
describe Rake::Funnel::Tasks::NUnit do
|
7
|
+
before {
|
8
|
+
Task.clear
|
9
|
+
}
|
10
|
+
|
11
|
+
describe 'defaults' do
|
12
|
+
its(:name) { should == :test }
|
13
|
+
its(:args) { should == {} }
|
14
|
+
its(:nunit) { should == 'nunit-console.exe' }
|
15
|
+
its(:files) { should == %w(build/specs/**/*.dll build/specs/**/*.exe) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'overriding defaults' do
|
19
|
+
context 'when NUnit executable is specified' do
|
20
|
+
subject {
|
21
|
+
described_class.new do |t|
|
22
|
+
t.nunit = 'custom nunit.exe'
|
23
|
+
end
|
24
|
+
}
|
25
|
+
|
26
|
+
its(:nunit) { should == 'custom nunit.exe' }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'execution' do
|
31
|
+
let(:args) { {} }
|
32
|
+
|
33
|
+
let(:mapper) { double(Mapper).as_null_object }
|
34
|
+
let(:finder) { double(Finder).as_null_object }
|
35
|
+
|
36
|
+
before {
|
37
|
+
allow(subject).to receive(:sh)
|
38
|
+
|
39
|
+
allow(Mapper).to receive(:new).and_return(mapper)
|
40
|
+
allow(Finder).to receive(:new).and_return(finder)
|
41
|
+
allow(NUnitPlugin).to receive(:setup)
|
42
|
+
|
43
|
+
allow(Mono).to receive(:invocation).and_wrap_original do |original_method, *args, &block|
|
44
|
+
args.compact
|
45
|
+
end
|
46
|
+
}
|
47
|
+
|
48
|
+
before {
|
49
|
+
Task[subject.name].invoke
|
50
|
+
}
|
51
|
+
|
52
|
+
it 'should use test assembly finder' do
|
53
|
+
expect(finder).to have_received(:all)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should set up TeamCity plugin' do
|
57
|
+
expect(NUnitPlugin).to have_received(:setup).with(subject.nunit)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should use NUnit mapper' do
|
61
|
+
expect(Mapper).to have_received(:new).with(:NUnit)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should map arguments' do
|
65
|
+
expect(mapper).to have_received(:map).with(args)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should use mono invocation' do
|
69
|
+
expect(Mono).to have_received(:invocation).with(subject.nunit)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should run with sh' do
|
73
|
+
expect(subject).to have_received(:sh)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|