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.
@@ -1,3 +1,3 @@
1
- module IISConfig
2
-
1
+ module IISConfig
2
+
3
3
  end
@@ -1,78 +1,78 @@
1
- module IISConfig
2
-
3
- # Configuration of the Process Model Settings for an Application Pool
4
- # Reference: http://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
5
- #
6
- class ProcessModel
7
-
8
- def initialize
9
- @settings = {}
10
- end
11
-
12
- def identity_type(type = nil)
13
- setting(:identityType, type)
14
- end
15
-
16
- # Specifies how long a worker process should run idle.
17
- def idle_timeout(timeout = nil)
18
- setting(:idleTimeout, timeout)
19
- end
20
-
21
- def load_user_profile(value = nil)
22
- setting(:loadUserProfile, value)
23
- end
24
-
25
- def logon_type(value = nil)
26
- setting(:logonType, value)
27
- end
28
-
29
- def manual_group_membership(value = nil)
30
- setting(:manualGroupMembership, value)
31
- end
32
-
33
- def max_processes(value = nil)
34
- setting(:maxProcesses, value)
35
- end
36
-
37
- def password(value = nil)
38
- setting(:password, value)
39
- end
40
-
41
- def pinging_enabled(value = nil)
42
- setting(:pingingEnabled, value)
43
- end
44
-
45
- def ping_interval(value = nil)
46
- setting(:pingInterval, value)
47
- end
48
-
49
- def ping_response_time(value = nil)
50
- setting(:pingResponseTime, value)
51
- end
52
-
53
- def shutdown_time_limit(value = nil)
54
- setting(:shutdownTimeLimit, value)
55
- end
56
-
57
- def startup_time_limit(value = nil)
58
- setting(:startupTimeLimit, value)
59
- end
60
-
61
- def username(value = nil)
62
- setting(:userName, value)
63
- end
64
-
65
- def settings
66
- @settings
67
- end
68
-
69
- private
70
-
71
- def setting(key, value)
72
- @settings[key] = value unless value.nil?
73
- @settings[key]
74
- end
75
-
76
- end
77
-
1
+ module IISConfig
2
+
3
+ # Configuration of the Process Model Settings for an Application Pool
4
+ # Reference: http://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
5
+ #
6
+ class ProcessModel
7
+
8
+ def initialize
9
+ @settings = {}
10
+ end
11
+
12
+ def identity_type(type = nil)
13
+ setting(:identityType, type)
14
+ end
15
+
16
+ # Specifies how long a worker process should run idle.
17
+ def idle_timeout(timeout = nil)
18
+ setting(:idleTimeout, timeout)
19
+ end
20
+
21
+ def load_user_profile(value = nil)
22
+ setting(:loadUserProfile, value)
23
+ end
24
+
25
+ def logon_type(value = nil)
26
+ setting(:logonType, value)
27
+ end
28
+
29
+ def manual_group_membership(value = nil)
30
+ setting(:manualGroupMembership, value)
31
+ end
32
+
33
+ def max_processes(value = nil)
34
+ setting(:maxProcesses, value)
35
+ end
36
+
37
+ def password(value = nil)
38
+ setting(:password, value)
39
+ end
40
+
41
+ def pinging_enabled(value = nil)
42
+ setting(:pingingEnabled, value)
43
+ end
44
+
45
+ def ping_interval(value = nil)
46
+ setting(:pingInterval, value)
47
+ end
48
+
49
+ def ping_response_time(value = nil)
50
+ setting(:pingResponseTime, value)
51
+ end
52
+
53
+ def shutdown_time_limit(value = nil)
54
+ setting(:shutdownTimeLimit, value)
55
+ end
56
+
57
+ def startup_time_limit(value = nil)
58
+ setting(:startupTimeLimit, value)
59
+ end
60
+
61
+ def username(value = nil)
62
+ setting(:userName, value)
63
+ end
64
+
65
+ def settings
66
+ @settings
67
+ end
68
+
69
+ private
70
+
71
+ def setting(key, value)
72
+ @settings[key] = value unless value.nil?
73
+ @settings[key]
74
+ end
75
+
76
+ end
77
+
78
78
  end
@@ -1,26 +1,26 @@
1
- module IISConfig
2
-
3
- class Runner
4
-
5
- def self.execute_command(args)
6
- args.flatten!
7
- tool = :appcmd
8
-
9
- puts " #{tool.to_s} #{args.join(' ')}"
10
-
11
- unless IISConfiguration.dry_run?
12
- result = `c:/windows/system32/inetsrv/appcmd #{args.join(' ')}"`
13
- raise Exception.new($?.exitstatus) unless $?.success?
14
- result
15
- end
16
- end
17
-
18
- def self.run_commands(commands)
19
- commands.each do |c|
20
- Runner.execute_command c
21
- end
22
- end
23
-
24
- end
25
-
1
+ module IISConfig
2
+
3
+ class Runner
4
+
5
+ def self.execute_command(args)
6
+ args.flatten!
7
+ tool = :appcmd
8
+
9
+ puts " #{tool.to_s} #{args.join(' ')}"
10
+
11
+ unless IISConfiguration.dry_run?
12
+ result = `c:/windows/system32/inetsrv/appcmd #{args.join(' ')}"`
13
+ raise Exception.new($?.exitstatus) unless $?.success?
14
+ result
15
+ end
16
+ end
17
+
18
+ def self.run_commands(commands)
19
+ commands.each do |c|
20
+ Runner.execute_command c
21
+ end
22
+ end
23
+
24
+ end
25
+
26
26
  end
@@ -1,85 +1,85 @@
1
- require 'iis_object'
2
- require 'application'
3
-
4
- module IISConfig
5
-
6
- class Site < IISObject
7
-
8
- def initialize
9
- @bindings = []
10
- @applications = []
11
- @virtual_directories = []
12
- @path = '/'
13
- end
14
-
15
- def name(name = nil)
16
- @name = name unless name.nil?
17
- @name
18
- end
19
-
20
- def binding(binding)
21
- @bindings << binding
22
- end
23
-
24
- def path(path)
25
- @path = path
26
- end
27
-
28
- def app_pool(pool)
29
- @app_pool = pool
30
- end
31
-
32
- def physical_path(path)
33
- @physical_path = path
34
- end
35
-
36
- def application(&block)
37
- add_instance(@applications, IISConfig::Application, block)
38
- end
39
-
40
- def virtual_directory(&block)
41
- add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
42
- end
43
-
44
- def delete
45
- %W{DELETE SITE #{@name}}
46
- end
47
-
48
- def add
49
- args = []
50
- args << 'ADD'
51
- args << 'SITE'
52
- args << "/name:#{@name}"
53
- args << "/bindings:\"#{@bindings.join('","')}\""
54
- args << "/physicalPath:#{@physical_path.gsub(/\//, '\\')}"
55
-
56
- args
57
- end
58
-
59
- def required_paths
60
- paths = []
61
- paths << @physical_path
62
- paths
63
- end
64
-
65
- def build_commands()
66
- commands = []
67
- commands << delete if exist? :site, @name
68
- commands << add
69
- commands << %W{SET SITE /site.name:#{@name} /[path='#{@path}'].applicationPool:#{@app_pool}} unless @app_pool.nil?
70
- commands << %W{SET SITE /site.name:#{@name} /[path='#{@path}']} if @app_pool.nil?
71
-
72
- @applications.each do |s|
73
- commands += s.build_commands @name, @app_pool
74
- end
75
-
76
- @virtual_directories.each do |s|
77
- commands += s.build_commands "#{name}/"
78
- end
79
-
80
- commands
81
- end
82
-
83
- end
84
-
1
+ require 'iis_object'
2
+ require 'application'
3
+
4
+ module IISConfig
5
+
6
+ class Site < IISObject
7
+
8
+ def initialize
9
+ @bindings = []
10
+ @applications = []
11
+ @virtual_directories = []
12
+ @path = '/'
13
+ end
14
+
15
+ def name(name = nil)
16
+ @name = name unless name.nil?
17
+ @name
18
+ end
19
+
20
+ def binding(binding)
21
+ @bindings << binding
22
+ end
23
+
24
+ def path(path)
25
+ @path = path
26
+ end
27
+
28
+ def app_pool(pool)
29
+ @app_pool = pool
30
+ end
31
+
32
+ def physical_path(path)
33
+ @physical_path = path
34
+ end
35
+
36
+ def application(&block)
37
+ add_instance(@applications, IISConfig::Application, block)
38
+ end
39
+
40
+ def virtual_directory(&block)
41
+ add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
42
+ end
43
+
44
+ def delete
45
+ %W{DELETE SITE #{@name}}
46
+ end
47
+
48
+ def add
49
+ args = []
50
+ args << 'ADD'
51
+ args << 'SITE'
52
+ args << "/name:#{@name}"
53
+ args << "/bindings:\"#{@bindings.join('","')}\""
54
+ args << "/physicalPath:#{@physical_path.gsub(/\//, '\\')}"
55
+
56
+ args
57
+ end
58
+
59
+ def required_paths
60
+ paths = []
61
+ paths << @physical_path
62
+ paths
63
+ end
64
+
65
+ def build_commands()
66
+ commands = []
67
+ commands << delete if exist? :site, @name
68
+ commands << add
69
+ commands << %W{SET SITE /site.name:#{@name} /[path='#{@path}'].applicationPool:#{@app_pool}} unless @app_pool.nil?
70
+ commands << %W{SET SITE /site.name:#{@name} /[path='#{@path}']} if @app_pool.nil?
71
+
72
+ @applications.each do |s|
73
+ commands += s.build_commands @name, @app_pool
74
+ end
75
+
76
+ @virtual_directories.each do |s|
77
+ commands += s.build_commands "#{name}/"
78
+ end
79
+
80
+ commands
81
+ end
82
+
83
+ end
84
+
85
85
  end
@@ -1,5 +1,5 @@
1
- module IISConfig
2
-
3
- VERSION = File.read(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../../VERSION')).strip
4
-
1
+ module IISConfig
2
+
3
+ VERSION = File.read(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../../VERSION')).strip
4
+
5
5
  end
@@ -1,30 +1,30 @@
1
- require 'iis_object'
2
-
3
- module IISConfig
4
-
5
- class VirtualDirectory < IISObject
6
-
7
- def name(name)
8
- @name = name
9
- @app_pool = nil
10
- end
11
-
12
- def path(path)
13
- @path = path
14
- end
15
-
16
- def physical_path(path)
17
- @physical_path = path
18
- end
19
-
20
- def build_commands(application)
21
- commands = []
22
-
23
- commands << %W{ADD VDIR /app.name:#{application} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}
24
-
25
- commands
26
- end
27
-
28
- end
29
-
1
+ require 'iis_object'
2
+
3
+ module IISConfig
4
+
5
+ class VirtualDirectory < IISObject
6
+
7
+ def name(name)
8
+ @name = name
9
+ @app_pool = nil
10
+ end
11
+
12
+ def path(path)
13
+ @path = path
14
+ end
15
+
16
+ def physical_path(path)
17
+ @physical_path = path
18
+ end
19
+
20
+ def build_commands(application)
21
+ commands = []
22
+
23
+ commands << %W{ADD VDIR /app.name:#{application} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}
24
+
25
+ commands
26
+ end
27
+
28
+ end
29
+
30
30
  end