iisconfig 0.4.0 → 0.4.1
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 +5 -13
- data/VERSION +1 -1
- data/bin/iisconfig +7 -7
- data/lib/iisconfig.rb +42 -42
- data/lib/iisconfig/app_pool.rb +118 -110
- data/lib/iisconfig/application.rb +46 -46
- data/lib/iisconfig/configuration.rb +101 -101
- data/lib/iisconfig/ftp_site.rb +91 -91
- data/lib/iisconfig/iis_object.rb +34 -34
- data/lib/iisconfig/iisconfig.rb +2 -2
- data/lib/iisconfig/process_model.rb +77 -77
- data/lib/iisconfig/runner.rb +25 -25
- data/lib/iisconfig/site.rb +84 -84
- data/lib/iisconfig/version.rb +4 -4
- data/lib/iisconfig/virtual_directory.rb +29 -29
- data/test/example.rb +53 -52
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTM3YTUxNjk2MWZiMjJiMWUyY2YzODg0MjU1NDJmNWQxZmZmNjRlZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 703bfb6ef00a88092ce6d6a1e176bab76d5be753
|
4
|
+
data.tar.gz: 79b95a6cb3423fccd3a9fd7d2137def96f489ca6
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YWFiZmVjNGEyN2Q5YmJkYTkzOTJjZGI0MGNjODdhOTJlNGEyN2FlYzQ3OTUw
|
11
|
-
OTcyODU4ZjBkZjAwZTU3ZmJlZmVlNTJkNTFjYTgxZjEwM2JlMjY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWMwYzc4OTY2NzE5NzdkZmVkOGZjNTI1NGZlMTYyNmRlMWRlNTk1Yzk5ZDFj
|
14
|
-
ZDE1MTExODI0ZDBkNGZhZmZiOWUyZjlmODg5MzUxZDNkNzZjMTAyMWE5Mzgw
|
15
|
-
Y2JlODczZGY0ZDEzMjBjMTM3ZDhiNWEzYTlkY2U0MDA1ZDYxN2M=
|
6
|
+
metadata.gz: 5504bd937abfe1b4fc9b8c34feb333c06b496e96e53ebf1a7cdee0517682d512d377478d0c7deaaade9ce70a3b3cb6404e9893b67bb8b95016ea780c52232417
|
7
|
+
data.tar.gz: 72c9dd60c8771f7a653e1dd9b8d964296fb40081e9b75b5244aabcf1c7055f396122d59d2d7412d0649a86a3416c446371848ba0ba793d2dd1c42e15e61f71a6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/bin/iisconfig
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$:.push File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
3
|
-
|
4
|
-
require "rainbow"
|
5
|
-
require "iisconfig"
|
6
|
-
|
7
|
-
# Invoke the command
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.push File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
3
|
+
|
4
|
+
require "rainbow"
|
5
|
+
require "iisconfig"
|
6
|
+
|
7
|
+
# Invoke the command
|
8
8
|
exit GLI.run(ARGV)
|
data/lib/iisconfig.rb
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
-
|
3
|
-
require 'rainbow'
|
4
|
-
require 'gli'
|
5
|
-
require 'gli_version'
|
6
|
-
require 'iisconfig/version'
|
7
|
-
require 'iisconfig/configuration'
|
8
|
-
|
9
|
-
include GLI
|
10
|
-
|
11
|
-
program_desc 'Configures IIS on Windows'
|
12
|
-
|
13
|
-
version IISConfig::VERSION
|
14
|
-
|
15
|
-
desc 'executes the configuration file'
|
16
|
-
command :execute, :e do |c|
|
17
|
-
c.desc 'Only recycle the application pools'
|
18
|
-
c.switch :'recycle-apppools'
|
19
|
-
|
20
|
-
c.desc 'Dry run'
|
21
|
-
c.switch :'dry-run'
|
22
|
-
|
23
|
-
c.action do |global_options, options, args|
|
24
|
-
opts = {}
|
25
|
-
opts[:recycle_apppools] = true if options[:'recycle-apppools']
|
26
|
-
|
27
|
-
IISConfig::IISConfiguration.dry_run = true if options[:'dry-run']
|
28
|
-
|
29
|
-
config = IISConfig::IISConfiguration.new opts
|
30
|
-
|
31
|
-
file = args[0]
|
32
|
-
if file.nil?
|
33
|
-
puts 'No file specified to execute'
|
34
|
-
else
|
35
|
-
config.load file
|
36
|
-
config.run
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
1
|
+
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rainbow'
|
4
|
+
require 'gli'
|
5
|
+
require 'gli_version'
|
6
|
+
require 'iisconfig/version'
|
7
|
+
require 'iisconfig/configuration'
|
8
|
+
|
9
|
+
include GLI
|
10
|
+
|
11
|
+
program_desc 'Configures IIS on Windows'
|
12
|
+
|
13
|
+
version IISConfig::VERSION
|
14
|
+
|
15
|
+
desc 'executes the configuration file'
|
16
|
+
command :execute, :e do |c|
|
17
|
+
c.desc 'Only recycle the application pools'
|
18
|
+
c.switch :'recycle-apppools'
|
19
|
+
|
20
|
+
c.desc 'Dry run'
|
21
|
+
c.switch :'dry-run'
|
22
|
+
|
23
|
+
c.action do |global_options, options, args|
|
24
|
+
opts = {}
|
25
|
+
opts[:recycle_apppools] = true if options[:'recycle-apppools']
|
26
|
+
|
27
|
+
IISConfig::IISConfiguration.dry_run = true if options[:'dry-run']
|
28
|
+
|
29
|
+
config = IISConfig::IISConfiguration.new opts
|
30
|
+
|
31
|
+
file = args[0]
|
32
|
+
if file.nil?
|
33
|
+
puts 'No file specified to execute'
|
34
|
+
else
|
35
|
+
config.load file
|
36
|
+
config.run
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
data/lib/iisconfig/app_pool.rb
CHANGED
@@ -1,111 +1,119 @@
|
|
1
|
-
require 'site'
|
2
|
-
require 'ftp_site'
|
3
|
-
require 'iis_object'
|
4
|
-
require 'process_model'
|
5
|
-
|
6
|
-
module IISConfig
|
7
|
-
|
8
|
-
class AppPool < IISObject
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@pipeline_mode = :Classic
|
12
|
-
@runtime_version = :'v2.0'
|
13
|
-
@sites = []
|
14
|
-
@ftp_sites = []
|
15
|
-
@process_model = ProcessModel.new
|
16
|
-
@enable_32bit_app_on_win64 = false
|
17
|
-
end
|
18
|
-
|
19
|
-
def name(name = nil)
|
20
|
-
@name = name unless name.nil?
|
21
|
-
@name
|
22
|
-
end
|
23
|
-
|
24
|
-
def runtime_version(version = nil)
|
25
|
-
@runtime_version = version unless version.nil?
|
26
|
-
@runtime_version
|
27
|
-
end
|
28
|
-
|
29
|
-
def pipeline_mode(mode = nil)
|
30
|
-
@pipeline_mode = mode unless mode.nil?
|
31
|
-
@pipeline_mode
|
32
|
-
end
|
33
|
-
|
34
|
-
def enable_32bit_app_on_win64(value = true)
|
35
|
-
@enable_32bit_app_on_win64 = value
|
36
|
-
end
|
37
|
-
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
args
|
65
|
-
args
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
@
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
1
|
+
require 'site'
|
2
|
+
require 'ftp_site'
|
3
|
+
require 'iis_object'
|
4
|
+
require 'process_model'
|
5
|
+
|
6
|
+
module IISConfig
|
7
|
+
|
8
|
+
class AppPool < IISObject
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@pipeline_mode = :Classic
|
12
|
+
@runtime_version = :'v2.0'
|
13
|
+
@sites = []
|
14
|
+
@ftp_sites = []
|
15
|
+
@process_model = ProcessModel.new
|
16
|
+
@enable_32bit_app_on_win64 = false
|
17
|
+
end
|
18
|
+
|
19
|
+
def name(name = nil)
|
20
|
+
@name = name unless name.nil?
|
21
|
+
@name
|
22
|
+
end
|
23
|
+
|
24
|
+
def runtime_version(version = nil)
|
25
|
+
@runtime_version = version unless version.nil?
|
26
|
+
@runtime_version
|
27
|
+
end
|
28
|
+
|
29
|
+
def pipeline_mode(mode = nil)
|
30
|
+
@pipeline_mode = mode unless mode.nil?
|
31
|
+
@pipeline_mode
|
32
|
+
end
|
33
|
+
|
34
|
+
def enable_32bit_app_on_win64(value = true)
|
35
|
+
@enable_32bit_app_on_win64 = value
|
36
|
+
end
|
37
|
+
|
38
|
+
def start_mode(value)
|
39
|
+
@start_mode = value
|
40
|
+
@start_mode
|
41
|
+
end
|
42
|
+
|
43
|
+
def process_model
|
44
|
+
yield @process_model
|
45
|
+
end
|
46
|
+
|
47
|
+
def site(&block)
|
48
|
+
add_instance(@sites, IISConfig::Site, block)
|
49
|
+
end
|
50
|
+
|
51
|
+
def ftp_site(&block)
|
52
|
+
add_instance(@ftp_sites, IISConfig::FtpSite, block)
|
53
|
+
end
|
54
|
+
|
55
|
+
def sites
|
56
|
+
@sites
|
57
|
+
end
|
58
|
+
|
59
|
+
def delete
|
60
|
+
%W{DELETE APPPOOL #{@name}}
|
61
|
+
end
|
62
|
+
|
63
|
+
def add
|
64
|
+
args = []
|
65
|
+
args << 'ADD'
|
66
|
+
args << 'APPPOOL'
|
67
|
+
args << "/name:#{@name}"
|
68
|
+
args << "/managedRuntimeVersion:#{@runtime_version}"
|
69
|
+
args << "/managedPipelineMode:#{pipeline_mode}"
|
70
|
+
if @start_mode
|
71
|
+
args << "/startMode:#{@start_mode}"
|
72
|
+
end
|
73
|
+
args
|
74
|
+
end
|
75
|
+
|
76
|
+
def required_paths
|
77
|
+
paths = []
|
78
|
+
@sites.each do |s|
|
79
|
+
paths += s.required_paths
|
80
|
+
end
|
81
|
+
paths
|
82
|
+
end
|
83
|
+
|
84
|
+
def recycle
|
85
|
+
args = []
|
86
|
+
if exist? :apppool, @name
|
87
|
+
args << 'RECYCLE'
|
88
|
+
args << 'APPPOOL'
|
89
|
+
args << "/apppool.name:#{@name}"
|
90
|
+
end
|
91
|
+
args
|
92
|
+
end
|
93
|
+
|
94
|
+
def build_commands
|
95
|
+
commands = []
|
96
|
+
|
97
|
+
commands << delete if exist? :apppool, @name
|
98
|
+
commands << add
|
99
|
+
@process_model.settings.each_pair do |key, value|
|
100
|
+
commands << %W{SET CONFIG /section:applicationPools /[name='#{@name}'].processModel.#{key}:#{value}}
|
101
|
+
end
|
102
|
+
commands << %W{SET APPPOOL /apppool.name:#{@name} /enable32BitAppOnWin64:#{@enable_32bit_app_on_win64}}
|
103
|
+
|
104
|
+
@sites.each do |s|
|
105
|
+
s.app_pool @name.to_sym
|
106
|
+
commands += s.build_commands
|
107
|
+
end
|
108
|
+
|
109
|
+
@ftp_sites.each do |s|
|
110
|
+
s.app_pool @name.to_sym
|
111
|
+
commands += s.build_commands
|
112
|
+
end
|
113
|
+
|
114
|
+
commands
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
111
119
|
end
|
@@ -1,47 +1,47 @@
|
|
1
|
-
require 'iis_object'
|
2
|
-
require 'virtual_directory'
|
3
|
-
|
4
|
-
module IISConfig
|
5
|
-
|
6
|
-
class Application < IISObject
|
7
|
-
|
8
|
-
def name(name)
|
9
|
-
@name = name
|
10
|
-
@virtual_directories = []
|
11
|
-
@app_pool = nil
|
12
|
-
end
|
13
|
-
|
14
|
-
def path(path)
|
15
|
-
@path = path
|
16
|
-
end
|
17
|
-
|
18
|
-
def physical_path(path)
|
19
|
-
@physical_path = path
|
20
|
-
end
|
21
|
-
|
22
|
-
def app_pool(name)
|
23
|
-
@app_pool = name
|
24
|
-
end
|
25
|
-
|
26
|
-
def virtual_directory(&block)
|
27
|
-
add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
|
28
|
-
end
|
29
|
-
|
30
|
-
def build_commands(site, app_pool)
|
31
|
-
commands = []
|
32
|
-
|
33
|
-
commands << %W{ADD APP /site.name:#{site} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}
|
34
|
-
|
35
|
-
app_pool = @app_pool unless @app_pool.nil?
|
36
|
-
commands << %W{SET SITE /site.name:#{site}/#{@name} /[path='#{@path}'].applicationPool:#{app_pool}}
|
37
|
-
|
38
|
-
@virtual_directories.each do |s|
|
39
|
-
commands += s.build_commands "#{site}/#{@name}"
|
40
|
-
end
|
41
|
-
|
42
|
-
commands
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
1
|
+
require 'iis_object'
|
2
|
+
require 'virtual_directory'
|
3
|
+
|
4
|
+
module IISConfig
|
5
|
+
|
6
|
+
class Application < IISObject
|
7
|
+
|
8
|
+
def name(name)
|
9
|
+
@name = name
|
10
|
+
@virtual_directories = []
|
11
|
+
@app_pool = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def path(path)
|
15
|
+
@path = path
|
16
|
+
end
|
17
|
+
|
18
|
+
def physical_path(path)
|
19
|
+
@physical_path = path
|
20
|
+
end
|
21
|
+
|
22
|
+
def app_pool(name)
|
23
|
+
@app_pool = name
|
24
|
+
end
|
25
|
+
|
26
|
+
def virtual_directory(&block)
|
27
|
+
add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_commands(site, app_pool)
|
31
|
+
commands = []
|
32
|
+
|
33
|
+
commands << %W{ADD APP /site.name:#{site} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}
|
34
|
+
|
35
|
+
app_pool = @app_pool unless @app_pool.nil?
|
36
|
+
commands << %W{SET SITE /site.name:#{site}/#{@name} /[path='#{@path}'].applicationPool:#{app_pool}}
|
37
|
+
|
38
|
+
@virtual_directories.each do |s|
|
39
|
+
commands += s.build_commands "#{site}/#{@name}"
|
40
|
+
end
|
41
|
+
|
42
|
+
commands
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
47
|
end
|