dolphindeploy 0.0.2-universal-dotnet
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 +23 -0
- data/lib/IIS/IIS6.rb +165 -0
- data/lib/IIS/IIS7.rb +152 -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 +45 -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/configured_as/mvc_deployment_spec.rb +108 -0
- data/spec/deploycommandcreator_spec.rb +169 -0
- data/spec/deploymentconfig_spec.rb +202 -0
- data/spec/dolphindeploy_spec.rb +13 -0
- data/spec/file_manager_spec.rb +22 -0
- data/spec/support/spec_helper.rb +17 -0
- metadata +222 -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
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../', 'support', 'spec_helper')
|
2
|
+
$: << 'lib/configured_as'
|
3
|
+
require 'mvc_deployment'
|
4
|
+
|
5
|
+
describe MvcDeployment do
|
6
|
+
describe "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 "deployment interaction" do
|
21
|
+
before do
|
22
|
+
@mvc = MvcDeployment.new
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should call out to IIS6 when deploying to v6" do
|
26
|
+
pending "Not sure how to test this"
|
27
|
+
@mvc.deploy()
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should get the location from config based on the environment being deployed" 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 "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 "custom extensions" do
|
61
|
+
def create_custom_method()
|
62
|
+
MvcDeployment.module_eval do
|
63
|
+
attr_accessor :custom_prop
|
64
|
+
|
65
|
+
def custom(val)
|
66
|
+
self.custom_prop = val
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
before(:each) do
|
72
|
+
FileManager.any_instance.expects(:get_latest_version).returns('')
|
73
|
+
FileManager.any_instance.expects(:extract).returns('')
|
74
|
+
IIS.any_instance.expects(:deploy).returns('')
|
75
|
+
|
76
|
+
create_custom_method()
|
77
|
+
|
78
|
+
@mvc = MvcDeployment.new
|
79
|
+
@mvc.set_to ['server', 'test']
|
80
|
+
@mvc.set_before({:custom => 'Random Value'})
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should call custom methods after deployment" do
|
84
|
+
@mvc.deploy('server')
|
85
|
+
@mvc.custom_prop.should == 'Random Value'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "executing custom additional host headers" do
|
90
|
+
before(:each) do
|
91
|
+
FileManager.any_instance.expects(:get_latest_version).returns('')
|
92
|
+
FileManager.any_instance.expects(:extract).returns('')
|
93
|
+
IIS6.any_instance.expects(:deploy).returns('')
|
94
|
+
IIS6.any_instance.expects(:set_extra_header).returns('')
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should call add_header on IIS instance" do
|
98
|
+
pending "Again... not mocking?"
|
99
|
+
mvc = MvcDeployment.new
|
100
|
+
IIS.any_instance.expects(:set_extra_header).returns(nil).once
|
101
|
+
|
102
|
+
mvc.set_to ['server', 'test']
|
103
|
+
mvc.set_after({:extra_header => 'abc.header'})
|
104
|
+
|
105
|
+
mvc.deploy('server')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'DeployCommandCreator'
|
3
|
+
|
4
|
+
describe DeployCommandCreator do
|
5
|
+
def config()
|
6
|
+
config_file =
|
7
|
+
"environment do
|
8
|
+
configured_as :mvc
|
9
|
+
env :systest do
|
10
|
+
host \"Test\"
|
11
|
+
to \"server\", \"path\", \"*\"
|
12
|
+
to \"server2\", \"path2\", \"*\"
|
13
|
+
to \"server2\", \"path2\", \"127.0.0.1\"
|
14
|
+
end
|
15
|
+
end"
|
16
|
+
File.stubs(:read).returns(config_file)
|
17
|
+
require 'deploymentconfig'
|
18
|
+
|
19
|
+
return Deployment.load()
|
20
|
+
end
|
21
|
+
|
22
|
+
before do
|
23
|
+
creator = DeployCommandCreator.new()
|
24
|
+
@mvc = creator.convert_from_config(config, :systest)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create deployment config object based on configuration" do
|
28
|
+
@mvc.should_not be_nil
|
29
|
+
@mvc.class.should == MvcDeployment
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should set environment variable" do
|
33
|
+
@mvc.environment.should == :systest
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should set the host variable" do
|
37
|
+
@mvc.host.should == "Test"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should set the to variable" do
|
41
|
+
@mvc.to[0].server.should == "server"
|
42
|
+
@mvc.to[0].path.should == "path"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should set the to variable with both values" do
|
46
|
+
@mvc.to[0].server.should == "server"
|
47
|
+
@mvc.to[0].path.should == "path"
|
48
|
+
|
49
|
+
@mvc.to[1].server.should == "server2"
|
50
|
+
@mvc.to[1].path.should == "path2"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should have a default IP address of *" do
|
54
|
+
@mvc.to[0].ipaddress.should == "*"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should have the correct IP address if it has been defined" do
|
58
|
+
@mvc.to[2].ipaddress.should == "127.0.0.1"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe DeployCommandCreator, "overriding default" do
|
63
|
+
def config()
|
64
|
+
config_file =
|
65
|
+
"environment do
|
66
|
+
configured_as :mvc
|
67
|
+
desc \"Testing\"
|
68
|
+
env :systest do
|
69
|
+
host \"Test\"
|
70
|
+
end
|
71
|
+
end"
|
72
|
+
File.stubs(:read).returns(config_file)
|
73
|
+
require 'deploymentconfig'
|
74
|
+
|
75
|
+
return Deployment.load()
|
76
|
+
end
|
77
|
+
|
78
|
+
before do
|
79
|
+
creator = DeployCommandCreator.new()
|
80
|
+
@mvc = creator.convert_from_config(config, :systest)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should have a description of Testing" do
|
84
|
+
@mvc.description.should == "Testing"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe DeployCommandCreator, "Before and After blocks" do
|
89
|
+
def config()
|
90
|
+
config_file =
|
91
|
+
"environment do
|
92
|
+
configured_as :mvc
|
93
|
+
env :systest do
|
94
|
+
host \"Test\"
|
95
|
+
to \"server\", \"path\"
|
96
|
+
to \"server2\", \"path2\"
|
97
|
+
|
98
|
+
before do
|
99
|
+
set_value 'xyz'
|
100
|
+
set_host 'ABC' #Redefines the value before executing...
|
101
|
+
end
|
102
|
+
after do
|
103
|
+
set_exec_something 'abc'
|
104
|
+
set_port 99 #Redefines the value after executing...
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end"
|
108
|
+
File.stubs(:read).returns(config_file)
|
109
|
+
require 'deploymentconfig'
|
110
|
+
|
111
|
+
return Deployment.load()
|
112
|
+
end
|
113
|
+
|
114
|
+
before do
|
115
|
+
creator = DeployCommandCreator.new()
|
116
|
+
@mvc = creator.convert_from_config(config, :systest)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should create deployment config object based on configuration" do
|
120
|
+
@mvc.should_not be_nil
|
121
|
+
@mvc.class.should == MvcDeployment
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should set environment variable" do
|
125
|
+
@mvc.environment.should == :systest
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should have a before keys collection containing the method names" do
|
129
|
+
@mvc.before.keys.should include(:set_value)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should have a list of before blocks to execute" do
|
133
|
+
@mvc.before[:set_value].should == 'xyz'
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should have an after keys collection containing the method names" do
|
137
|
+
@mvc.after.keys.should include(:set_exec_something)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should support multiple calls being specified" do
|
141
|
+
@mvc.before.keys.length.should == 2
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "DeployCommandCreator", "supports multiple arguments for method" do
|
146
|
+
def config()
|
147
|
+
config_file =
|
148
|
+
"environment do
|
149
|
+
configured_as :mvc
|
150
|
+
desc \"Testing\"
|
151
|
+
env :systest do
|
152
|
+
host \"Test\"
|
153
|
+
end
|
154
|
+
end"
|
155
|
+
File.stubs(:read).returns(config_file)
|
156
|
+
require 'deploymentconfig'
|
157
|
+
|
158
|
+
return Deployment.load()
|
159
|
+
end
|
160
|
+
|
161
|
+
before do
|
162
|
+
creator = DeployCommandCreator.new()
|
163
|
+
@mvc = creator.convert_from_config(config, :systest)
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should have a description of Testing" do
|
167
|
+
@mvc.description.should == "Testing"
|
168
|
+
end
|
169
|
+
end
|