sevendigital-deploy 0.1.6
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.
- data/.document +5 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/lib/IIS_appcmd.rb +7 -0
- data/lib/IIS_apppool_builder.rb +31 -0
- data/lib/IIS_host_adder.rb +18 -0
- data/lib/IIS_self_signer.rb +15 -0
- data/lib/IIS_site_builder.rb +29 -0
- data/lib/web_site_identifier.rb +27 -0
- data/sevendigital-deploy.gemspec +78 -0
- data/spec/IIS_appcmd_spec.rb +16 -0
- data/spec/IIS_apppool_builder_spec.rb +32 -0
- data/spec/IIS_host_adder_spec.rb +33 -0
- data/spec/IIS_self_signer_spec.rb +22 -0
- data/spec/IIS_site_builder_spec.rb +46 -0
- data/spec/support/spec_helper.rb +23 -0
- data/spec/website_identifier_spec.rb +45 -0
- metadata +183 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "mocha", ">= 0"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "rspec", ">= 0"
|
13
|
+
gem "bundler", "~> 1.1.4"
|
14
|
+
gem "jeweler", "~> 1.8.3"
|
15
|
+
gem "simplecov", "> 0"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.3)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.7.3)
|
12
|
+
metaclass (0.0.1)
|
13
|
+
mocha (0.11.4)
|
14
|
+
metaclass (~> 0.0.1)
|
15
|
+
multi_json (1.3.6)
|
16
|
+
rake (0.9.2.2)
|
17
|
+
rdoc (3.12)
|
18
|
+
json (~> 1.4)
|
19
|
+
rspec (2.10.0)
|
20
|
+
rspec-core (~> 2.10.0)
|
21
|
+
rspec-expectations (~> 2.10.0)
|
22
|
+
rspec-mocks (~> 2.10.0)
|
23
|
+
rspec-core (2.10.1)
|
24
|
+
rspec-expectations (2.10.0)
|
25
|
+
diff-lcs (~> 1.1.3)
|
26
|
+
rspec-mocks (2.10.1)
|
27
|
+
shoulda (3.0.1)
|
28
|
+
shoulda-context (~> 1.0.0)
|
29
|
+
shoulda-matchers (~> 1.0.0)
|
30
|
+
shoulda-context (1.0.0)
|
31
|
+
shoulda-matchers (1.0.0)
|
32
|
+
simplecov (0.6.4)
|
33
|
+
multi_json (~> 1.0)
|
34
|
+
simplecov-html (~> 0.5.3)
|
35
|
+
simplecov-html (0.5.3)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
bundler (~> 1.1.4)
|
42
|
+
jeweler (~> 1.8.3)
|
43
|
+
mocha
|
44
|
+
rdoc (~> 3.12)
|
45
|
+
rspec
|
46
|
+
shoulda
|
47
|
+
simplecov (> 0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Henry Oswald
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= sevendigital-deploy
|
2
|
+
|
3
|
+
Deploy dot net
|
4
|
+
|
5
|
+
== Contributing to sevendigital-deploy
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2012 Henry Oswald. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "sevendigital-deploy"
|
18
|
+
gem.homepage = "http://github.com/henryoswald/sevendigital-deploy"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{deploy iis sites}
|
21
|
+
gem.description = %Q{deploy iis sites}
|
22
|
+
gem.email = "henry.oswald@7digital.com"
|
23
|
+
gem.authors = ["Henry Oswald"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
30
|
+
sh 'rm -rf coverage/*' if ENV['COVERAGE']
|
31
|
+
t.pattern = 'spec/**/*_spec.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
require 'rdoc/task'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = "sevendigital-deploy #{version}"
|
42
|
+
rdoc.rdoc_files.include('README*')
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.6
|
data/lib/IIS_appcmd.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'IIS_appcmd'
|
3
|
+
|
4
|
+
# Used to manage IIS App Pool
|
5
|
+
|
6
|
+
class IISAppPoolBuilder
|
7
|
+
# Params:
|
8
|
+
# +siteName+:: siteName string used to identify site (e.g)
|
9
|
+
def initialize(siteName, iisAppCmd = IISAppCmd.new)
|
10
|
+
@siteName = siteName
|
11
|
+
@iisAppCmd = iisAppCmd
|
12
|
+
end
|
13
|
+
|
14
|
+
def create
|
15
|
+
puts "creating app pool : #{@siteName}"
|
16
|
+
@iisAppCmd.execute("ADD APPPOOL /name:#{@siteName} /managedRuntimeVersion:v4.0")
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete
|
21
|
+
puts "deleting app pool : #{@siteName}"
|
22
|
+
@iisAppCmd.execute("DELETE APPPOOL #{@siteName}")
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def assign
|
27
|
+
puts "assigning app pool : #{@siteName} to site #{@siteName}"
|
28
|
+
@iisAppCmd.execute("SET SITE /site.name:#{@siteName} /applicationDefaults.applicationPool:#{@siteName}")
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'IIS_appcmd'
|
2
|
+
|
3
|
+
class IISHostAdder
|
4
|
+
def initialize(siteName, iisAppCmd = IISAppCmd.new)
|
5
|
+
@siteName = siteName
|
6
|
+
@iisAppCmd = iisAppCmd
|
7
|
+
end
|
8
|
+
|
9
|
+
def addSingle(host, protocol = "http")
|
10
|
+
#puts "adding host #{host} to site #{@siteName}"
|
11
|
+
@iisAppCmd.execute("SET CONFIG -section:system.applicationHost/sites /+\"[name='#{@siteName}'].bindings.[protocol='#{protocol}',bindingInformation='*:#{host}']\" /commit:apphost")
|
12
|
+
end
|
13
|
+
|
14
|
+
def addMultiple(hosts, protocol = "http")
|
15
|
+
puts "adding multiple sites for site #{@siteName}"
|
16
|
+
hosts.each {|host| addSingle(host) }
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'web_site_identifier'
|
3
|
+
|
4
|
+
class IISSelfSigner
|
5
|
+
def initialize(siteName, webSiteIdentifier = WebSiteIdentifier.new)
|
6
|
+
@siteName = siteName
|
7
|
+
@webSiteIdentifier = webSiteIdentifier
|
8
|
+
end
|
9
|
+
|
10
|
+
def sign
|
11
|
+
@siteId = @webSiteIdentifier.getId(@siteName)
|
12
|
+
certName = @siteName+":#{(0..16).to_a.map{|a| rand(16).to_s(16)}.join}"
|
13
|
+
`"C:\\Program Files (x86)\\IIS Resources\\SelfSSL\\selfssl.exe" /T /N:CN=#{certName} /S:#{@siteId} /Q`
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'web_site_identifier'
|
3
|
+
require 'IIS_appcmd'
|
4
|
+
|
5
|
+
class IISSiteBuilder
|
6
|
+
attr_accessor :webSiteIdentifier
|
7
|
+
|
8
|
+
def initialize(siteName, sitePath, webSiteIdentifier = WebSiteIdentifier.new, iisAppCmd = IISAppCmd.new)
|
9
|
+
@siteName = siteName
|
10
|
+
@sitePath = sitePath
|
11
|
+
@webSiteIdentifier = webSiteIdentifier
|
12
|
+
@iisAppCmd = iisAppCmd
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete
|
16
|
+
puts "attempting delete of #{@siteName}"
|
17
|
+
if @webSiteIdentifier.exists(@siteName)
|
18
|
+
@iisAppCmd.execute("DELETE SITE #{@siteName}")
|
19
|
+
puts "deleted site #{@siteName}"
|
20
|
+
end
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def create
|
25
|
+
puts "creating site #{@siteName}"
|
26
|
+
@iisAppCmd.execute("ADD SITE /name:#{@siteName} /bindings:http://#{@siteName}:80 /physicalPath:#{@sitePath}")
|
27
|
+
self
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'IIS_appcmd'
|
3
|
+
|
4
|
+
class WebSiteIdentifier
|
5
|
+
|
6
|
+
def initialize(iisAppCmd = IISAppCmd.new)
|
7
|
+
@iisAppCmd = iisAppCmd
|
8
|
+
end
|
9
|
+
|
10
|
+
def exists(siteName)
|
11
|
+
siteInfo = @iisAppCmd.execute("LIST SITE")
|
12
|
+
siteExits = siteInfo.include?(siteName)
|
13
|
+
puts "checking if site #{siteName} exists : #{siteExits}"
|
14
|
+
siteExits
|
15
|
+
end
|
16
|
+
|
17
|
+
def getId(siteName)
|
18
|
+
siteInfo = @iisAppCmd.execute("LIST SITE /site.name:#{siteName}")
|
19
|
+
parseId(siteInfo)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def parseId(siteInfo)
|
24
|
+
match = /id:(\d+),/.match(siteInfo)
|
25
|
+
match[1].to_s
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "sevendigital-deploy"
|
8
|
+
s.version = "0.1.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Henry Oswald"]
|
12
|
+
s.date = "2012-06-26"
|
13
|
+
s.description = "deploy iis sites"
|
14
|
+
s.email = "henry.oswald@7digital.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/IIS_appcmd.rb",
|
28
|
+
"lib/IIS_apppool_builder.rb",
|
29
|
+
"lib/IIS_host_adder.rb",
|
30
|
+
"lib/IIS_self_signer.rb",
|
31
|
+
"lib/IIS_site_builder.rb",
|
32
|
+
"lib/web_site_identifier.rb",
|
33
|
+
"sevendigital-deploy.gemspec",
|
34
|
+
"spec/IIS_appcmd_spec.rb",
|
35
|
+
"spec/IIS_apppool_builder_spec.rb",
|
36
|
+
"spec/IIS_host_adder_spec.rb",
|
37
|
+
"spec/IIS_self_signer_spec.rb",
|
38
|
+
"spec/IIS_site_builder_spec.rb",
|
39
|
+
"spec/support/spec_helper.rb",
|
40
|
+
"spec/website_identifier_spec.rb"
|
41
|
+
]
|
42
|
+
s.homepage = "http://github.com/henryoswald/sevendigital-deploy"
|
43
|
+
s.licenses = ["MIT"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = "1.8.24"
|
46
|
+
s.summary = "deploy iis sites"
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1.4"])
|
57
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
58
|
+
s.add_development_dependency(%q<simplecov>, ["> 0"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
61
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
62
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
63
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
64
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.4"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
66
|
+
s.add_dependency(%q<simplecov>, ["> 0"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
70
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
71
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
72
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
73
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.4"])
|
74
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
75
|
+
s.add_dependency(%q<simplecov>, ["> 0"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'IIS_appcmd'
|
2
|
+
|
3
|
+
describe IISAppCmd do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@iisAppCmd = IISAppCmd.new
|
7
|
+
end
|
8
|
+
|
9
|
+
context "executing app cmd arugment" do
|
10
|
+
it "use given arument" do
|
11
|
+
arugment = "do this"
|
12
|
+
@iisAppCmd.expects(:`).with("c:\\windows\\system32\\inetsrv\\appcmd.exe #{arugment}").returns("")
|
13
|
+
@iisAppCmd.execute(arugment)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'support/spec_helper'
|
2
|
+
require 'IIS_apppool_builder'
|
3
|
+
|
4
|
+
describe IISAppPoolBuilder do
|
5
|
+
siteName = "7digital.com"
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@iisAppcmd = mock()
|
9
|
+
@iisAppPoolBuilder = IISAppPoolBuilder.new(siteName, @iisAppcmd)
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'setting up app pool' do
|
13
|
+
it 'is fluent' do
|
14
|
+
@iisAppcmd.expects(:execute).times 3
|
15
|
+
@iisAppPoolBuilder.delete().create().assign()
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'creates a new app pool' do
|
19
|
+
@iisAppcmd.expects(:execute).with("ADD APPPOOL /name:#{siteName} /managedRuntimeVersion:v4.0")
|
20
|
+
@iisAppPoolBuilder.create
|
21
|
+
end
|
22
|
+
it 'tears down the app pool' do
|
23
|
+
@iisAppcmd.expects(:execute).with("DELETE APPPOOL #{siteName}")
|
24
|
+
@iisAppPoolBuilder.delete
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'sets application pool' do
|
28
|
+
@iisAppcmd.expects(:execute).with("SET SITE /site.name:#{siteName} /applicationDefaults.applicationPool:#{siteName}")
|
29
|
+
@iisAppPoolBuilder.assign
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'IIS_host_adder'
|
2
|
+
|
3
|
+
describe IISHostAdder do
|
4
|
+
siteName = "7digital.com"
|
5
|
+
|
6
|
+
context 'adding a host entry' do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@iisAppcmd = mock()
|
10
|
+
@iisHostAdder = IISHostAdder.new(siteName, @iisAppcmd)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'add sucessfully' do
|
14
|
+
hostEntry = "4143:www.7digital.com"
|
15
|
+
@iisAppcmd.expects(:execute).with("SET CONFIG -section:system.applicationHost/sites /+\"[name='#{siteName}'].bindings.[protocol='http',bindingInformation='*:#{hostEntry}']\" /commit:apphost")
|
16
|
+
@iisHostAdder.addSingle(hostEntry)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'add https sucessfully' do
|
20
|
+
hostEntry = "4143:www.7digital.com"
|
21
|
+
@iisAppcmd.expects(:execute).with("SET CONFIG -section:system.applicationHost/sites /+\"[name='#{siteName}'].bindings.[protocol='https',bindingInformation='*:#{hostEntry}']\" /commit:apphost")
|
22
|
+
@iisHostAdder.addSingle(hostEntry, "https")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should add multiple sites when using array' do
|
26
|
+
hostEntrys = ["80:de.7digital.com", "1443:fr.7digital.com", "44443:ie.7digital.com"]
|
27
|
+
@iisAppcmd.expects(:execute).with(includes(hostEntrys[0]))
|
28
|
+
@iisAppcmd.expects(:execute).with(includes(hostEntrys[1]))
|
29
|
+
@iisAppcmd.expects(:execute).with(includes(hostEntrys[2]))
|
30
|
+
@iisHostAdder.addMultiple(hostEntrys)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'support/spec_helper'
|
2
|
+
require 'IIS_self_signer'
|
3
|
+
|
4
|
+
describe IISSelfSigner do
|
5
|
+
context 'self signing iis site' do
|
6
|
+
selfSignPath = "%programfiles(x86)%\\IIS Resources\\SelfSSL\\selfssl.exe"
|
7
|
+
siteName = "7digital.com"
|
8
|
+
siteId = 13
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
webSiteIdentifier = mock()
|
12
|
+
webSiteIdentifier.stubs(:getId).returns(siteId)
|
13
|
+
|
14
|
+
@iisSelfSigner = IISSelfSigner.new(siteName, webSiteIdentifier)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'self signs site' do
|
18
|
+
@iisSelfSigner.expects(:`).with(includes("/S:#{siteId} /Q")).once
|
19
|
+
@iisSelfSigner.sign
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'support/spec_helper'
|
2
|
+
require 'IIS_site_builder'
|
3
|
+
|
4
|
+
describe IISSiteBuilder do
|
5
|
+
siteName = "7digital.com"
|
6
|
+
sitePath = "some/path/here"
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@webSiteIdentifier = mock()
|
10
|
+
@webSiteIdentifier.stubs(:exists).returns(true)
|
11
|
+
@iisAppCmd = mock()
|
12
|
+
@iisSiteBuilder = IISSiteBuilder.new(siteName, sitePath, @webSiteIdentifier, @iisAppCmd)
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'deploying a site to iis' do
|
16
|
+
it 'is fluent' do
|
17
|
+
@iisAppCmd.expects(:execute).times 2
|
18
|
+
@iisSiteBuilder.delete().create()
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'creates a new site' do
|
22
|
+
@iisAppCmd.expects(:execute).with("ADD SITE /name:#{siteName} /bindings:http://#{siteName}:80 /physicalPath:#{sitePath}")
|
23
|
+
@iisSiteBuilder.create()
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'creating a new iis site builder' do
|
28
|
+
it 'create its own webSiteIdentifier' do
|
29
|
+
siteBuilder = IISSiteBuilder.new(siteName, sitePath)
|
30
|
+
siteBuilder.webSiteIdentifier.should_not == nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'deleteing website' do
|
35
|
+
it 'tears down the old site' do
|
36
|
+
@iisAppCmd.expects(:execute).with("DELETE SITE #{siteName}")
|
37
|
+
@iisSiteBuilder.delete()
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'does not tear down the website if it exists' do
|
41
|
+
@webSiteIdentifier.stubs(:exists).returns(false)
|
42
|
+
@iisAppCmd.expects(:execute).with("DELETE SITE #{siteName}").never
|
43
|
+
@iisSiteBuilder.delete()
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mocha'
|
3
|
+
require 'rspec'
|
4
|
+
require 'rake/dsl_definition'
|
5
|
+
|
6
|
+
root_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../'))
|
7
|
+
$: << './'
|
8
|
+
$: << File.join(root_dir, 'lib')
|
9
|
+
$: << File.join(root_dir, 'spec')
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.mock_framework = :mocha
|
13
|
+
config.color_enabled = true
|
14
|
+
config.tty = true
|
15
|
+
config.formatter = :documentation
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'simplecov'
|
19
|
+
SimpleCov.start do
|
20
|
+
add_filter '/spec/'
|
21
|
+
end if ENV['COVERAGE']
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'support/spec_helper'
|
2
|
+
require 'web_site_identifier'
|
3
|
+
|
4
|
+
describe WebSiteIdentifier do
|
5
|
+
siteName = "7digital.com"
|
6
|
+
listOfSites = "
|
7
|
+
SITE \"territoriesApi\" (id:3,bindings:http/*:80:territoriesapi,state:Started)
|
8
|
+
SITE \"#{siteName}\" (id:1,bindings:http/*:80:sevenspace.local,net.tcp/808:*,net.pipe/*,net.msmq/localhost,msmq.formatname/localhost,state:Stopped)
|
9
|
+
SITE \"SevenDigital.Web.Stores\" (id:5,bindings:http/*:80:stores.7digital.local,http/*:80:,state:Stopped)
|
10
|
+
SITE \"mailout\" (id:6,bindings:http/*:80:mailout.7digital.locallocal,state:Stopped)
|
11
|
+
"
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
@iisAppCmd = mock()
|
15
|
+
@webSiteIdentifier = WebSiteIdentifier.new(@iisAppCmd)
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'Given an appcmd result' do
|
19
|
+
it 'gets website identifier' do
|
20
|
+
@iisAppCmd.expects(:execute).with("LIST SITE /site.name:#{siteName}").returns('SITE "7digital.com" (id:13,bindings:http/*:80:www.7digital.local,https/:443:,state:Started)')
|
21
|
+
result = @webSiteIdentifier.getId(siteName)
|
22
|
+
result.should == "13"
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'gets website identifier with big number' do
|
26
|
+
@iisAppCmd.expects(:execute).with("LIST SITE /site.name:#{siteName}").returns('SITE "7digital.com" (id:123333,bindings:http/*:80:www.7digital.local,https/:443:,state:Started)')
|
27
|
+
result = @webSiteIdentifier.getId(siteName)
|
28
|
+
result.should == "123333"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'given a website name' do
|
33
|
+
it 'can check the website when exists' do
|
34
|
+
@iisAppCmd.expects(:execute).with("LIST SITE").returns(listOfSites)
|
35
|
+
@webSiteIdentifier.exists(siteName).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'can check the website when it does not exist' do
|
39
|
+
@iisAppCmd.expects(:execute).with("LIST SITE").returns(listOfSites)
|
40
|
+
@webSiteIdentifier.exists("dsadsadas").should be_false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sevendigital-deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Henry Oswald
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: shoulda
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: mocha
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.12'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.1.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.1.4
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: jeweler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.8.3
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.8.3
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simplecov
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>'
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>'
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: deploy iis sites
|
127
|
+
email: henry.oswald@7digital.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- LICENSE.txt
|
132
|
+
- README.rdoc
|
133
|
+
files:
|
134
|
+
- .document
|
135
|
+
- Gemfile
|
136
|
+
- Gemfile.lock
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.rdoc
|
139
|
+
- Rakefile
|
140
|
+
- VERSION
|
141
|
+
- lib/IIS_appcmd.rb
|
142
|
+
- lib/IIS_apppool_builder.rb
|
143
|
+
- lib/IIS_host_adder.rb
|
144
|
+
- lib/IIS_self_signer.rb
|
145
|
+
- lib/IIS_site_builder.rb
|
146
|
+
- lib/web_site_identifier.rb
|
147
|
+
- sevendigital-deploy.gemspec
|
148
|
+
- spec/IIS_appcmd_spec.rb
|
149
|
+
- spec/IIS_apppool_builder_spec.rb
|
150
|
+
- spec/IIS_host_adder_spec.rb
|
151
|
+
- spec/IIS_self_signer_spec.rb
|
152
|
+
- spec/IIS_site_builder_spec.rb
|
153
|
+
- spec/support/spec_helper.rb
|
154
|
+
- spec/website_identifier_spec.rb
|
155
|
+
homepage: http://github.com/henryoswald/sevendigital-deploy
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
post_install_message:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
161
|
+
- lib
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
segments:
|
169
|
+
- 0
|
170
|
+
hash: 4402154530690036797
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
requirements: []
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 1.8.24
|
180
|
+
signing_key:
|
181
|
+
specification_version: 3
|
182
|
+
summary: deploy iis sites
|
183
|
+
test_files: []
|