dolphindeploy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -0
- data/TODO +18 -0
- data/external/DolphinDeploy.IIS.IIS6.dll +0 -0
- data/external/Microsoft.Web.Administration.dll +0 -0
- data/external/TinySharpZip.dll +0 -0
- data/external/adsutil.vbs +2938 -0
- data/external/xunit/HTML.xslt +117 -0
- data/external/xunit/NUnitXml.xslt +121 -0
- data/external/xunit/xunit.console.exe +0 -0
- data/external/xunit/xunit.console.exe.config +21 -0
- data/external/xunit/xunit.console.x86.exe +0 -0
- data/external/xunit/xunit.console.x86.exe.config +21 -0
- data/external/xunit/xunit.dll +0 -0
- data/external/xunit/xunit.dll.tdnet +5 -0
- data/external/xunit/xunit.extensions.dll +0 -0
- data/external/xunit/xunit.extensions.xml +706 -0
- data/external/xunit/xunit.gui.exe +0 -0
- data/external/xunit/xunit.gui.x86.exe +0 -0
- data/external/xunit/xunit.installer.exe +0 -0
- data/external/xunit/xunit.runner.msbuild.dll +0 -0
- data/external/xunit/xunit.runner.tdnet.dll +0 -0
- data/external/xunit/xunit.runner.utility.dll +0 -0
- data/external/xunit/xunit.runner.utility.xml +1048 -0
- data/external/xunit/xunit.xml +2306 -0
- data/lib/IIS/IIS.rb +24 -0
- data/lib/IIS/IIS6.rb +145 -0
- data/lib/IIS/IIS7.rb +20 -0
- data/lib/IIS/IISVersion.rb +7 -0
- data/lib/configured_as/mvc_deployment.rb +174 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.5.1.ReSharper.user +39 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/AppPoolControllerTests.cs +39 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/DolphinDeploy.IIS.IIS6.Tests.csproj +69 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/DolphinDeploy.IIS.IIS6.Tests.csproj.user +6 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/Helper.cs +18 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/Properties/AssemblyInfo.cs +36 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/WebsiteControllerTests.cs +56 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/DolphinDeploy.IIS.IIS6.Tests.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/DolphinDeploy.IIS.IIS6.Tests.pdb +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/DolphinDeploy.IIS.IIS6.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/DolphinDeploy.IIS.IIS6.pdb +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/test_site/index.htm +9 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/xunit.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/bin/Debug/xunit.xml +2306 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/obj/Debug/DolphinDeploy.IIS.IIS6.Tests.csproj.FileListAbsolute.txt +12 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/obj/Debug/DolphinDeploy.IIS.IIS6.Tests.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/obj/Debug/DolphinDeploy.IIS.IIS6.Tests.pdb +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/obj/Debug/ResolveAssemblyReference.cache +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.Tests/test_site/index.htm +9 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.sln +26 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.suo +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/AppPoolController.cs +41 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6.csproj +56 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/IIS6Manager.cs +77 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/Properties/AssemblyInfo.cs +36 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/WebsiteController.cs +101 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/bin/Debug/DolphinDeploy.IIS.IIS6.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/bin/Debug/DolphinDeploy.IIS.IIS6.pdb +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/obj/Debug/DolphinDeploy.IIS.IIS6.csproj.FileListAbsolute.txt +7 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/obj/Debug/DolphinDeploy.IIS.IIS6.dll +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/DolphinDeploy.IIS.IIS6/obj/Debug/DolphinDeploy.IIS.IIS6.pdb +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/BuildScriptCache/1/78fc7364.dat +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/ModuleIds.xml +4 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/NamedArguments/5/4b9722ad.dat +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/PdbInfo/61d4d5326252d9cd7476a391dfbbb2a47481ffa6 +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/ProjectModel/ProjectModel.dat +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/SymbolCache.bin +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/TodoCache/1/78fc7364.dat +0 -0
- data/lib/csharp/DolphinDeploy.IIS.IIS6/_ReSharper.DolphinDeploy.IIS.IIS6/WordIndex/1/72ab4678.dat +0 -0
- data/lib/deploycommandcreator.rb +34 -0
- data/lib/deploymentconfig.rb +15 -0
- data/lib/directory_cleanup.rb +16 -0
- data/lib/dolphindeploy.rb +12 -0
- data/lib/dolphindeploy_rake.rb +36 -0
- data/lib/file_manager.rb +30 -0
- data/lib/unzip.rb +11 -0
- data/spec/IIS/IIS6_spec.rb +24 -0
- data/spec/IIS/IIS_spec.rb +18 -0
- data/spec/config_spec.rb +170 -0
- data/spec/configured_as/mvc_deployment_spec.rb +103 -0
- data/spec/deploycommandcreator_spec.rb +162 -0
- data/spec/dolphindeploy_spec.rb +13 -0
- data/spec/file_manager_spec.rb +20 -0
- data/spec/support/spec_helper.rb +17 -0
- metadata +159 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'caesars'
|
2
|
+
|
3
|
+
class Environment < Caesars
|
4
|
+
end
|
5
|
+
|
6
|
+
class DeploymentConfig < Caesars::Config
|
7
|
+
dsl Environment::DSL
|
8
|
+
end
|
9
|
+
|
10
|
+
class Deployment
|
11
|
+
def self.load
|
12
|
+
conf = File.join(File.dirname(__FILE__), '..\deploy.conf')
|
13
|
+
@deployment = DeploymentConfig.new(conf)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class DirectoryCleanup
|
2
|
+
def remove_last(directory_to_clean, keep_last=10)
|
3
|
+
dir_to_remove = get_directories_to_remove(directory_to_clean, keep_last)
|
4
|
+
dir_to_remove.each do |d|
|
5
|
+
puts "Removing " + d
|
6
|
+
FileUtils.rm_r d, :force => true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_directories_to_remove(directory_to_clean, keep_last)
|
11
|
+
Dir.chdir directory_to_clean
|
12
|
+
ordered = Dir.glob('**').sort_by {|d| File.mtime(d)}
|
13
|
+
dir_to_keep = ordered[ordered.length-keep_last..ordered.length]
|
14
|
+
ordered - dir_to_keep
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
raise Exception, "Dolphin Deploy is only supported on IronRuby" unless Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
|
2
|
+
|
3
|
+
$: << 'lib\configured_as'
|
4
|
+
$: << 'lib\IIS'
|
5
|
+
require 'rubygems' #FIX: Apprantly this is bad practice
|
6
|
+
require 'digest'
|
7
|
+
require 'deploymentconfig'
|
8
|
+
require 'deploycommandcreator'
|
9
|
+
require 'IIS'
|
10
|
+
require 'unzip'
|
11
|
+
require 'file_manager'
|
12
|
+
require 'directory_cleanup'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
$: << 'lib'
|
2
|
+
require 'dolphindeploy'
|
3
|
+
|
4
|
+
# rake dolphin:deploy [env, server]
|
5
|
+
# rake deploy['local', 'localhost']
|
6
|
+
|
7
|
+
namespace :dolphin do
|
8
|
+
desc "Dolphin Deployment"
|
9
|
+
task :deploy, :env, :server do |t, args|
|
10
|
+
deployment = Deployment.load()
|
11
|
+
creator = DeployCommandCreator.new()
|
12
|
+
|
13
|
+
env = args.env.to_sym
|
14
|
+
server = args.server
|
15
|
+
|
16
|
+
mvc = creator.convert_from_config(deployment, env)
|
17
|
+
mvc.deploy server
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Clean up output directory"
|
22
|
+
task :cleanup, :env, :server do |t, args|
|
23
|
+
deployment = Deployment.load()
|
24
|
+
creator = DeployCommandCreator.new()
|
25
|
+
|
26
|
+
env = args.env.to_sym
|
27
|
+
server = args.server
|
28
|
+
|
29
|
+
mvc = creator.convert_from_config(deployment, env)
|
30
|
+
directory_to_clean = mvc.get_location(server)
|
31
|
+
|
32
|
+
dir = DirectoryCleanup.new
|
33
|
+
dir.remove_last(directory_to_clean, 10)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
data/lib/file_manager.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
class FileManager
|
2
|
+
def extract(location, zip_path, env)
|
3
|
+
UnZip.unzip(zip_path, location)
|
4
|
+
swap_configs(location, env)
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_latest_version(location, site_name)
|
8
|
+
dirs = Dir.glob("#{location}/**").grep(/#{site_name}/)
|
9
|
+
|
10
|
+
new_version = find_next_release_version(dirs, site_name)
|
11
|
+
|
12
|
+
File.join(location, site_name + "-" + "%02d" % new_version)
|
13
|
+
end
|
14
|
+
|
15
|
+
def find_next_release_version(dirs, site_name)
|
16
|
+
release_numbers = [0]
|
17
|
+
|
18
|
+
dirs.each do |dir|
|
19
|
+
s = /#{site_name}-(\d+)/.match(dir)
|
20
|
+
release_numbers << s[1].to_i unless s.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
new_version = release_numbers.max + 1
|
24
|
+
end
|
25
|
+
|
26
|
+
def swap_configs(location, env)
|
27
|
+
FileUtils.cp File.join(location, 'web.config'), File.join(location, 'web.original.config')
|
28
|
+
FileUtils.mv File.join(location, "web.#{env.to_s}.config"), File.join(location, 'web.config')
|
29
|
+
end
|
30
|
+
end
|
data/lib/unzip.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
$: << 'external'
|
2
|
+
require 'TinySharpZip'
|
3
|
+
include System::IO
|
4
|
+
|
5
|
+
class UnZip
|
6
|
+
def self.unzip (file, destination)
|
7
|
+
FileUtils.mkdir_p destination
|
8
|
+
puts file + " to >> " + destination
|
9
|
+
TinySharpZip::ZipArchive.Extract(FileStream.new(file, FileMode.Open), destination)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../', 'support', 'spec_helper')
|
2
|
+
require 'lib/configured_as/mvc_deployment'
|
3
|
+
require 'lib/IIS/IIS6'
|
4
|
+
|
5
|
+
describe IIS6, "executing against adsutil" do
|
6
|
+
context "Adding additional bindings" do
|
7
|
+
it "should get the website id based on the deployment name"
|
8
|
+
|
9
|
+
it "should be able to add additional headers via adsutil" do
|
10
|
+
pending "Need to hook up CLR mocking"
|
11
|
+
|
12
|
+
mvc = MvcDeployment.new
|
13
|
+
mvc.site_name = 'test'
|
14
|
+
|
15
|
+
IIS6.any_instance.expects(:`).with("cscript external\\adsutil.vbs set w3svc/5/ServerBindings \":80:test.host.header\"").once
|
16
|
+
iis = IIS6.new
|
17
|
+
iis.set_extra_header ':80:test.host.header', mvc
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should supports multiple additional headers being defined"
|
21
|
+
|
22
|
+
it "should get a list of the existing binding and append to list when setting server bindings"
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../', 'support', 'spec_helper')
|
2
|
+
require 'lib/configured_as/mvc_deployment'
|
3
|
+
require 'lib/IIS/IIS'
|
4
|
+
require 'lib/IIS/IIS6'
|
5
|
+
require 'lib/IIS/IISVersion'
|
6
|
+
|
7
|
+
describe IIS do
|
8
|
+
it "should executing IIS6 deployment if server is v6" do
|
9
|
+
pending "This doesn't work as I expect. Something really simple I'm guessing but keeps failing to mock objects"
|
10
|
+
mvc = MvcDeployment.new
|
11
|
+
mvc.site_name = 'test'
|
12
|
+
|
13
|
+
IISVersion.expects(:current_version).returns("6.0.0.0")
|
14
|
+
IIS6.any_instance.expects(:deploy).with("", "", mvc).returns(false)
|
15
|
+
iis = IIS.new
|
16
|
+
iis.deploy("", "", mvc)
|
17
|
+
end
|
18
|
+
end
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
|
3
|
+
describe "Configuration loading" do
|
4
|
+
File.stubs(:exists?).returns(true)
|
5
|
+
|
6
|
+
it "should execute dsl after being required which modifies properties on the object" do
|
7
|
+
File.stubs(:read).returns("environment do
|
8
|
+
tester true
|
9
|
+
end")
|
10
|
+
require 'deploymentconfig'
|
11
|
+
|
12
|
+
@deployment = Deployment.load()
|
13
|
+
@deployment.environment.tester.should be_true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "Configuration with multiple properties" do
|
18
|
+
File.stubs(:exists?).returns(true)
|
19
|
+
|
20
|
+
it "should return correct host for multiple named environments" do
|
21
|
+
File.stubs(:read).returns("environment do
|
22
|
+
env :systest do
|
23
|
+
host \"www.test.systest\"
|
24
|
+
end
|
25
|
+
|
26
|
+
env :uat do
|
27
|
+
host \"www.test.uat\"
|
28
|
+
end
|
29
|
+
end")
|
30
|
+
require 'deploymentconfig'
|
31
|
+
|
32
|
+
@deployment = Deployment.load()
|
33
|
+
@deployment.environment.systest.host.should == "www.test.systest"
|
34
|
+
@deployment.environment.uat.host.should == "www.test.uat"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should return array of to variables when defining" do
|
38
|
+
File.stubs(:read).returns("environment do
|
39
|
+
env :systest do
|
40
|
+
to \"abc\", \"xxx\"
|
41
|
+
end
|
42
|
+
end")
|
43
|
+
require 'deploymentconfig'
|
44
|
+
|
45
|
+
@deployment = Deployment.load()
|
46
|
+
@deployment.environment.systest.to.should == ['abc', 'xxx']
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return array concated together when calling it multiple times" do
|
50
|
+
File.stubs(:read).returns("environment do
|
51
|
+
env :systest do
|
52
|
+
to \"abc\", \"xxx\"
|
53
|
+
to \"xyz\", \"123\"
|
54
|
+
end
|
55
|
+
end")
|
56
|
+
require 'deploymentconfig'
|
57
|
+
|
58
|
+
@deployment = Deployment.load()
|
59
|
+
@deployment.environment.systest.to.should == ['abc', 'xxx', 'xyz', '123']
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "Configuration with top level properties and sub details" do
|
64
|
+
File.stubs(:exists?).returns(true)
|
65
|
+
|
66
|
+
it "should return correct host for multiple named environments" do
|
67
|
+
File.stubs(:read).returns("environment do
|
68
|
+
desc \"Deployment 123\"
|
69
|
+
setting :test
|
70
|
+
env :systest do
|
71
|
+
host \"www.test.systest\"
|
72
|
+
end
|
73
|
+
|
74
|
+
env :uat do
|
75
|
+
host \"www.test.uat\"
|
76
|
+
end
|
77
|
+
end")
|
78
|
+
require 'deploymentconfig'
|
79
|
+
|
80
|
+
@deployment = Deployment.load()
|
81
|
+
@deployment.environment.desc.should == "Deployment 123"
|
82
|
+
@deployment.environment.setting.should == :test
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
describe "Before and After blocks" do
|
88
|
+
File.stubs(:exists?).returns(true)
|
89
|
+
|
90
|
+
before(:each) do
|
91
|
+
File.stubs(:read).returns("environment do
|
92
|
+
desc \"Deployment 123\"
|
93
|
+
setting :test
|
94
|
+
env :systest do
|
95
|
+
host \"www.test.systest\"
|
96
|
+
before do
|
97
|
+
value \"xyz\"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end")
|
101
|
+
require 'deploymentconfig'
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should return set of keys defined in the before block" do
|
105
|
+
@deployment = Deployment.load()
|
106
|
+
@deployment.environment[:systest].before[:value].should == 'xyz'
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should support accessing values as properties" do
|
110
|
+
@deployment = Deployment.load()
|
111
|
+
@deployment.environment[:systest].before.value.should == 'xyz'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
describe "Host Headers" do
|
117
|
+
File.stubs(:exists?).returns(true)
|
118
|
+
|
119
|
+
it "should support a single additional host header" do
|
120
|
+
File.stubs(:read).returns("environment do
|
121
|
+
desc \"Deployment 123\"
|
122
|
+
setting :test
|
123
|
+
env :systest do
|
124
|
+
host \"www.test.systest\"
|
125
|
+
after do
|
126
|
+
extra_header 'extra.host.header'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end")
|
130
|
+
require 'deploymentconfig'
|
131
|
+
|
132
|
+
@deployment = Deployment.load()
|
133
|
+
@deployment.environment[:systest].after.extra_header.should == 'extra.host.header'
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should support multiple additional host header" do
|
137
|
+
File.stubs(:read).returns("environment do
|
138
|
+
desc \"Deployment 123\"
|
139
|
+
setting :test
|
140
|
+
env :systest do
|
141
|
+
host \"www.test.systest\"
|
142
|
+
after do
|
143
|
+
extra_header 'extra.host.header'
|
144
|
+
extra_header 'extra2.host.header'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end")
|
148
|
+
require 'deploymentconfig'
|
149
|
+
|
150
|
+
@deployment = Deployment.load()
|
151
|
+
@deployment.environment[:systest].after.extra_header.should == ['extra.host.header', 'extra2.host.header']
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should support dynamically creating additional host header" do
|
155
|
+
File.stubs(:read).returns("environment do
|
156
|
+
desc \"Deployment 123\"
|
157
|
+
setting :test
|
158
|
+
env :systest do
|
159
|
+
host \"www.test.systest\"
|
160
|
+
after do
|
161
|
+
['extra', 'extra2'].each {|h| extra_header h + '.host.header'}
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end")
|
165
|
+
require 'deploymentconfig'
|
166
|
+
|
167
|
+
@deployment = Deployment.load()
|
168
|
+
@deployment.environment[:systest].after.extra_header.should == ['extra.host.header', 'extra2.host.header']
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../', 'support', 'spec_helper')
|
2
|
+
$: << 'lib/configured_as'
|
3
|
+
require 'mvc_deployment'
|
4
|
+
|
5
|
+
|
6
|
+
describe MvcDeployment, "defaults" do
|
7
|
+
before do
|
8
|
+
@mvc = MvcDeployment.new
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have a default description" do
|
12
|
+
@mvc.description.should == "MvcDeployment"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a default port number" do
|
16
|
+
@mvc.port.should == 80
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe MvcDeployment, "deployment" do
|
21
|
+
before do
|
22
|
+
@mvc = MvcDeployment.new
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should call out to IIS6" do
|
26
|
+
pending "Not sure how to test this"
|
27
|
+
@mvc.deploy()
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should get the location based on the environment" do
|
31
|
+
@mvc.set_to ['server', 'C:/some_location']
|
32
|
+
path = @mvc.get_location('server')
|
33
|
+
path.should == 'C:/some_location'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe MvcDeployment, "when executing" do
|
38
|
+
before(:each) do
|
39
|
+
FileManager.any_instance.expects(:get_latest_version).returns('')
|
40
|
+
FileManager.any_instance.expects(:extract).returns('')
|
41
|
+
IIS.any_instance.expects(:deploy).returns('')
|
42
|
+
|
43
|
+
@mvc = MvcDeployment.new
|
44
|
+
@mvc.set_to ['server', 'test']
|
45
|
+
@mvc.set_before({:set_host => 'ABC'})
|
46
|
+
@mvc.set_after({:set_port => 99})
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should call all the methods specified in the before block" do
|
50
|
+
@mvc.deploy('server')
|
51
|
+
@mvc.host.should == 'ABC'
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should call all the methods specified in the before block" do
|
55
|
+
@mvc.deploy('server')
|
56
|
+
@mvc.port.should == 99
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe MvcDeployment, "Executing custom extensions" do
|
61
|
+
before(:each) do
|
62
|
+
FileManager.any_instance.expects(:get_latest_version).returns('')
|
63
|
+
FileManager.any_instance.expects(:extract).returns('')
|
64
|
+
IIS.any_instance.expects(:deploy).returns('')
|
65
|
+
|
66
|
+
MvcDeployment.module_eval do
|
67
|
+
attr_accessor :custom_prop
|
68
|
+
|
69
|
+
def custom(val)
|
70
|
+
self.custom_prop = val
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
@mvc = MvcDeployment.new
|
75
|
+
@mvc.set_to ['server', 'test']
|
76
|
+
@mvc.set_before({:custom => 'Random Value'})
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should call custom methods" do
|
80
|
+
@mvc.deploy('server')
|
81
|
+
@mvc.custom_prop.should == 'Random Value'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe MvcDeployment, "Executing custom additional host headers" do
|
86
|
+
before(:each) do
|
87
|
+
FileManager.any_instance.expects(:get_latest_version).returns('')
|
88
|
+
FileManager.any_instance.expects(:extract).returns('')
|
89
|
+
IIS6.any_instance.expects(:deploy).returns('')
|
90
|
+
IIS6.any_instance.expects(:set_extra_header).returns('')
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should call add_header on IIS instance" do
|
94
|
+
pending "Again... not mocking?"
|
95
|
+
mvc = MvcDeployment.new
|
96
|
+
IIS.any_instance.expects(:set_extra_header).returns(nil).once
|
97
|
+
|
98
|
+
mvc.set_to ['server', 'test']
|
99
|
+
mvc.set_after({:extra_header => 'abc.header'})
|
100
|
+
|
101
|
+
mvc.deploy('server')
|
102
|
+
end
|
103
|
+
end
|