iisconfig 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjgwNGQ2Yjk3Zjk0M2JjMWQyNmNlYzc3ZWE2YTkyMmNjM2QyODE3OA==
5
- data.tar.gz: !binary |-
6
- ZTM3YTUxNjk2MWZiMjJiMWUyY2YzODg0MjU1NDJmNWQxZmZmNjRlZg==
2
+ SHA1:
3
+ metadata.gz: 703bfb6ef00a88092ce6d6a1e176bab76d5be753
4
+ data.tar.gz: 79b95a6cb3423fccd3a9fd7d2137def96f489ca6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- Y2NkZmQxY2YyNDZiMzg0OGE3NmQwNDUwNzI0ODNlNDYwZDE5ZWU3NjgzZjY3
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.0
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
+
@@ -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 process_model
39
- yield @process_model
40
- end
41
-
42
- def site(&block)
43
- add_instance(@sites, IISConfig::Site, block)
44
- end
45
-
46
- def ftp_site(&block)
47
- add_instance(@ftp_sites, IISConfig::FtpSite, block)
48
- end
49
-
50
- def sites
51
- @sites
52
- end
53
-
54
- def delete
55
- %W{DELETE APPPOOL #{@name}}
56
- end
57
-
58
- def add
59
- args = []
60
- args << 'ADD'
61
- args << 'APPPOOL'
62
- args << "/name:#{@name}"
63
- args << "/managedRuntimeVersion:#{@runtime_version}"
64
- args << "/managedPipelineMode:#{pipeline_mode}"
65
- args
66
- end
67
-
68
- def required_paths
69
- paths = []
70
- @sites.each do |s|
71
- paths += s.required_paths
72
- end
73
- paths
74
- end
75
-
76
- def recycle
77
- args = []
78
- if exist? :apppool, @name
79
- args << 'RECYCLE'
80
- args << 'APPPOOL'
81
- args << "/apppool.name:#{@name}"
82
- end
83
- args
84
- end
85
-
86
- def build_commands
87
- commands = []
88
-
89
- commands << delete if exist? :apppool, @name
90
- commands << add
91
- @process_model.settings.each_pair do |key, value|
92
- commands << %W{SET CONFIG /section:applicationPools /[name='#{@name}'].processModel.#{key}:#{value}}
93
- end
94
- commands << %W{SET APPPOOL /apppool.name:#{@name} /enable32BitAppOnWin64:#{@enable_32bit_app_on_win64}}
95
-
96
- @sites.each do |s|
97
- s.app_pool @name.to_sym
98
- commands += s.build_commands
99
- end
100
-
101
- @ftp_sites.each do |s|
102
- s.app_pool @name.to_sym
103
- commands += s.build_commands
104
- end
105
-
106
- commands
107
- end
108
-
109
- end
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