iisconfig 0.4.1 → 0.5.0
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 +13 -5
- data/VERSION +1 -1
- data/bin/iisconfig +7 -7
- data/lib/iisconfig/app_pool.rb +118 -118
- data/lib/iisconfig/application.rb +58 -47
- data/lib/iisconfig/configuration.rb +109 -101
- data/lib/iisconfig/ftp_site.rb +91 -91
- data/lib/iisconfig/iis_object.rb +48 -35
- data/lib/iisconfig/iisconfig.rb +2 -2
- data/lib/iisconfig/process_model.rb +77 -77
- data/lib/iisconfig/runner.rb +27 -26
- data/lib/iisconfig/site.rb +84 -84
- data/lib/iisconfig/version.rb +4 -4
- data/lib/iisconfig/virtual_directory.rb +29 -29
- data/lib/iisconfig.rb +43 -42
- data/test/example.rb +55 -54
- metadata +33 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MWZiOWYzMTVmYTg4Y2Q0ZGE2OWJmZTAwZjAxNjJlNTBmMmFjNjk1NA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2YyZDEyZDE1ODcxZjNmMWM5ODA3ZDJmMjZmZmFjZWI0MmMzMDIyZA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NWY0ZGY4MDExZWFkNjYyOTMzMDhlZDE1OTNiNjE5NGYzOWViYTg5MmNjYTI4
|
10
|
+
NmM3N2I5ZWJkMmYyZTQxZTUwMTkwZGQwNTkyNjBiZTlkMzg2M2Y1NWU3YTNi
|
11
|
+
MDczMzcxNGEwZGUxZDUzMjliNTBmNzc3MzFhMzhhMzc2MTZmODA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZWIzN2NhYjc5N2I0NTg2YWQ3NzdkMmU2MzA2MGM2ZTIyMDk4YTE3NmY5YWJi
|
14
|
+
ZGU3YzFmYjUxZTcwZjVkYjYyZmJhNjM5OTJmYjNhOGM4ODg2YjdhMzc2MGNm
|
15
|
+
MTFjZGMwMGJhMTAzYjdkNDQ1MGMyNTEwOWQ3YmE2ZGQ2NDU0ZDU=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
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/app_pool.rb
CHANGED
@@ -1,119 +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 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
|
-
|
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
|
+
|
119
119
|
end
|
@@ -1,47 +1,58 @@
|
|
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
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
commands
|
37
|
-
|
38
|
-
@
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
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 auto_start_provider(name, type)
|
19
|
+
@start_provider_name = name
|
20
|
+
@start_provider_type = type
|
21
|
+
end
|
22
|
+
|
23
|
+
def physical_path(path)
|
24
|
+
@physical_path = path
|
25
|
+
end
|
26
|
+
|
27
|
+
def app_pool(name)
|
28
|
+
@app_pool = name
|
29
|
+
end
|
30
|
+
|
31
|
+
def virtual_directory(&block)
|
32
|
+
add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_commands(site, app_pool)
|
36
|
+
commands = []
|
37
|
+
|
38
|
+
commands << %W{ADD APP /site.name:#{site} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}
|
39
|
+
|
40
|
+
app_pool = @app_pool unless @app_pool.nil?
|
41
|
+
commands << %W{SET SITE /site.name:#{site}/#{@name} /[path='#{@path}'].applicationPool:#{app_pool}}
|
42
|
+
|
43
|
+
if @start_provider_name
|
44
|
+
commands << %W{set config -section:system.applicationHost/serviceAutoStartProviders /-"[name='#{@start_provider_name}']" /commit:apphost} if start_provider_exist? @start_provider_name
|
45
|
+
commands << %W{set config -section:system.applicationHost/serviceAutoStartProviders /+"[name='#{@start_provider_name}',type='#{@start_provider_type}']" /commit:apphost}
|
46
|
+
commands << %W{set app #{site}/#{@name} /serviceAutoStartEnabled:True /serviceAutoStartProvider:#{@start_provider_name}}
|
47
|
+
end
|
48
|
+
|
49
|
+
@virtual_directories.each do |s|
|
50
|
+
commands += s.build_commands "#{site}/#{@name}"
|
51
|
+
end
|
52
|
+
|
53
|
+
commands
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -1,101 +1,109 @@
|
|
1
|
-
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
-
|
3
|
-
require 'rexml/document'
|
4
|
-
require 'app_pool'
|
5
|
-
require 'ftp_site'
|
6
|
-
require 'site'
|
7
|
-
|
8
|
-
module IISConfig
|
9
|
-
|
10
|
-
class IISConfiguration
|
11
|
-
@@dry_run = false
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
1
|
+
$:.push File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'app_pool'
|
5
|
+
require 'ftp_site'
|
6
|
+
require 'site'
|
7
|
+
|
8
|
+
module IISConfig
|
9
|
+
|
10
|
+
class IISConfiguration
|
11
|
+
@@dry_run = false
|
12
|
+
@@verbose = false
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
@options = {recycle_apppools: false}.merge(options)
|
16
|
+
@app_pools = []
|
17
|
+
@sites = []
|
18
|
+
@ftp_sites = []
|
19
|
+
@before = []
|
20
|
+
@after = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.dry_run=dry_run
|
24
|
+
@@dry_run = dry_run
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.dry_run?
|
28
|
+
@@dry_run
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.verbose=verbose
|
32
|
+
@@verbose = verbose
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.verbose?
|
36
|
+
@@verbose
|
37
|
+
end
|
38
|
+
|
39
|
+
def app_pool(&block)
|
40
|
+
add_instance @app_pools, IISConfig::AppPool, block
|
41
|
+
end
|
42
|
+
|
43
|
+
def site(&block)
|
44
|
+
add_instance @sites, IISConfig::Site, block
|
45
|
+
end
|
46
|
+
|
47
|
+
def ftp_site(&block)
|
48
|
+
add_instance @ftp_sites, IISConfig::FtpSite, block
|
49
|
+
end
|
50
|
+
|
51
|
+
def before(&block)
|
52
|
+
@before << block
|
53
|
+
end
|
54
|
+
|
55
|
+
def after(&block)
|
56
|
+
@after << block
|
57
|
+
end
|
58
|
+
|
59
|
+
def load(path)
|
60
|
+
instance_eval IO.read(path), path
|
61
|
+
end
|
62
|
+
|
63
|
+
def run
|
64
|
+
@before.each { |a| a.call }
|
65
|
+
|
66
|
+
if @options[:recycle_apppools]
|
67
|
+
recycle_application_pools
|
68
|
+
else
|
69
|
+
rebuild_all
|
70
|
+
end
|
71
|
+
|
72
|
+
@after.each { |a| a.call }
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def rebuild_all
|
78
|
+
execute @app_pools
|
79
|
+
execute @sites
|
80
|
+
execute @ftp_sites
|
81
|
+
end
|
82
|
+
|
83
|
+
def recycle_application_pools
|
84
|
+
@app_pools.each do |p|
|
85
|
+
commands = p.recycle
|
86
|
+
Runner.run_commands [commands] unless commands.empty?
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def execute(objects)
|
91
|
+
objects.each do |p|
|
92
|
+
commands = p.build_commands
|
93
|
+
Runner.run_commands commands
|
94
|
+
|
95
|
+
p.required_paths.each do |path|
|
96
|
+
FileUtils.mkdir_p path unless Dir.exist? path
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def add_instance(collection, type, block)
|
102
|
+
instance = type.new
|
103
|
+
collection << instance
|
104
|
+
block.call instance if block
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|