inetmgr 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/RELEASE-NOTES.rdoc +5 -1
- data/inetmgr.gemspec +4 -1
- data/lib/inetmgr/configuration.rb +24 -21
- data/lib/inetmgr/iis_configuration.rb +18 -8
- data/lib/inetmgr/iis_object.rb +6 -3
- data/lib/inetmgr/iis_object/application.rb +5 -3
- data/lib/inetmgr/iis_object/application_pool.rb +5 -3
- data/lib/inetmgr/iis_object/auto_start_provider.rb +3 -1
- data/lib/inetmgr/iis_object/binding_information.rb +2 -0
- data/lib/inetmgr/iis_object/periodic_restart.rb +6 -3
- data/lib/inetmgr/iis_object/process_model.rb +21 -18
- data/lib/inetmgr/iis_object/recycling.rb +8 -5
- data/lib/inetmgr/iis_object/site.rb +3 -1
- data/lib/inetmgr/iis_object/site_limit.rb +10 -7
- data/lib/inetmgr/iis_object/site_logfile.rb +4 -1
- data/lib/inetmgr/iis_object/virtual_directory.rb +3 -1
- data/lib/inetmgr/iis_object_collection.rb +7 -4
- data/lib/inetmgr/site_configuration.rb +37 -34
- data/lib/string.rb +4 -4
- data/spec/application_pool_spec.rb +1 -1
- data/spec/bingin_information_spec.rb +21 -21
- data/spec/site_app_settings_spec.rb +3 -3
- data/spec/site_configuration_spec.rb +1 -1
- data/spec/site_connection_strings_spec.rb +1 -1
- data/spec/site_spec.rb +16 -4
- data/spec/site_validation_settings_spec.rb +1 -1
- data/spec/spec_env.rb +1 -5
- data/spec/string_spec.rb +16 -16
- data/test/print_iis_config.rb +0 -4
- metadata +53 -89
- data/doc/Application.html +0 -177
- data/doc/ApplicationPool.html +0 -177
- data/doc/AutoStartProvider.html +0 -177
- data/doc/BindingInformation.html +0 -349
- data/doc/Configuration.html +0 -283
- data/doc/IisConfiguration.html +0 -383
- data/doc/IisObject.html +0 -484
- data/doc/IisObjectCollection.html +0 -534
- data/doc/Inetmgr.html +0 -179
- data/doc/Inetmgr/InetmgrTask.html +0 -338
- data/doc/Object.html +0 -254
- data/doc/PeriodicRestart.html +0 -177
- data/doc/ProcessModel.html +0 -192
- data/doc/README_rdoc.html +0 -114
- data/doc/RSpecExtensions.html +0 -257
- data/doc/Recycling.html +0 -177
- data/doc/Site.html +0 -228
- data/doc/SiteConfiguration.html +0 -269
- data/doc/SiteLimit.html +0 -177
- data/doc/VirtualDirectory.html +0 -177
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -166
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/rdoc.css +0 -706
data/Gemfile
ADDED
data/RELEASE-NOTES.rdoc
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
= inetmgr Release Notes
|
2
2
|
|
3
|
-
== Latest Version (0.
|
3
|
+
== Latest Version (0.7.0)
|
4
|
+
|
5
|
+
- Merged changes from Maxim-Filimonov (https://github.com/Maxim-Filimonov/inetmgr) who was so kind to make adding sites safer and namespacing the configuration classes to avoid conflicts with other libraries.
|
6
|
+
|
7
|
+
== 0.6.0
|
4
8
|
|
5
9
|
- Merged pull request from Scott Baldwin (https://github.com/scottsbaldwin) who was so kind to add support for configuring site log files.
|
6
10
|
|
data/inetmgr.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
|
6
6
|
s.name = "inetmgr"
|
7
|
-
s.version = "0.
|
7
|
+
s.version = "0.7.0"
|
8
8
|
s.summary = "A library for managing IIS configuration settings."
|
9
9
|
s.description = "inetmgr allows you to inspect/configure IIS configuration sections and elements."
|
10
10
|
|
@@ -18,4 +18,7 @@ spec = Gem::Specification.new do |s|
|
|
18
18
|
s.files = FileList["**/**/*"].to_a
|
19
19
|
s.require_path = "lib"
|
20
20
|
|
21
|
+
s.add_development_dependency 'uuid'
|
22
|
+
s.add_development_dependency 'rspec'
|
23
|
+
|
21
24
|
end
|
@@ -1,21 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
@admin_manager
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
module Inetmgr
|
2
|
+
|
3
|
+
class Configuration
|
4
|
+
|
5
|
+
def initialize(path, server = nil)
|
6
|
+
@admin_manager = WIN32OLE.new "Microsoft.ApplicationHost.WritableAdminManager", server
|
7
|
+
@admin_manager.CommitPath = path;
|
8
|
+
end
|
9
|
+
|
10
|
+
# applies/commits all changes made since the creation of the
|
11
|
+
# IisConfiguration instance or the last time this method was called.
|
12
|
+
def apply_changes
|
13
|
+
@admin_manager.CommitChanges
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def get_admin_section(section_name)
|
19
|
+
@admin_manager.GetAdminSection(section_name, @admin_manager.CommitPath)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'inetmgr/iis_object/site.rb'
|
2
|
+
require 'inetmgr/iis_object/application_pool.rb'
|
3
|
+
require 'inetmgr/iis_object/auto_start_provider.rb'
|
4
4
|
|
5
|
+
module Inetmgr
|
5
6
|
# Represents the local IIS configuration settings (meta base).
|
6
7
|
class IisConfiguration < Configuration
|
7
8
|
|
@@ -14,11 +15,17 @@ class IisConfiguration < Configuration
|
|
14
15
|
yield cfg
|
15
16
|
cfg.apply_changes
|
16
17
|
end
|
17
|
-
|
18
|
-
|
18
|
+
|
19
|
+
def generate_id(collection)
|
20
|
+
count = collection.Count
|
21
|
+
arr = (0...count).map {|index| collection.Item(index).Properties.Item('Id').Value }
|
22
|
+
(arr.max) ? (arr.max + 1) : 1
|
23
|
+
end
|
24
|
+
|
25
|
+
# Gets all configured web sites.
|
19
26
|
def get_sites
|
20
|
-
|
21
|
-
|
27
|
+
s = get_admin_section "system.applicationHost/sites"
|
28
|
+
IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = generate_id(s.Collection) }
|
22
29
|
end
|
23
30
|
|
24
31
|
# Gets all configure application pools.
|
@@ -33,4 +40,7 @@ class IisConfiguration < Configuration
|
|
33
40
|
IisObjectCollection.new s.Collection, :add, AutoStartProvider
|
34
41
|
end
|
35
42
|
|
36
|
-
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
IisConfiguration = Inetmgr::IisConfiguration
|
data/lib/inetmgr/iis_object.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
module Inetmgr
|
2
|
+
# Represents an IIS configuration element. Serves as the base class for all
|
2
3
|
# IIS artifacts like Site, Application and VirtualDirectory.
|
3
4
|
class IisObject
|
4
5
|
|
@@ -57,7 +58,7 @@ class IisObject
|
|
57
58
|
|
58
59
|
def invoke_method name
|
59
60
|
method = @element.Methods.Item(name.to_s).CreateInstance()
|
60
|
-
|
61
|
+
|
61
62
|
# TODO: if block_given? change method_missing to change this:
|
62
63
|
# method.Input.Properties.Item("key").Value = value
|
63
64
|
# in to this:
|
@@ -72,7 +73,7 @@ private
|
|
72
73
|
def method_missing(symbol, *args)
|
73
74
|
name = symbol.to_s.to_camel_case
|
74
75
|
if (/=$/.match(name))
|
75
|
-
|
76
|
+
|
76
77
|
@element.Properties.Item(name.sub(/=$/, '')).Value = args[0]
|
77
78
|
else
|
78
79
|
@element.Properties.Item(name).Value
|
@@ -83,3 +84,5 @@ private
|
|
83
84
|
|
84
85
|
end
|
85
86
|
|
87
|
+
|
88
|
+
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'virtual_directory.rb')
|
2
2
|
|
3
|
-
|
3
|
+
module Inetmgr
|
4
|
+
class Application < IisObject
|
4
5
|
|
5
6
|
prop :auto_start, "serviceAutoStartEnabled"
|
6
7
|
prop :auto_start_provider, "serviceAutoStartProvider"
|
7
8
|
prop :application_pool, :applicationPool
|
8
|
-
|
9
|
+
|
9
10
|
collection :virtual_directories, :virtualDirectory, VirtualDirectory
|
10
|
-
|
11
|
+
|
12
|
+
end
|
11
13
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'process_model.rb')
|
2
2
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'recycling.rb')
|
3
3
|
|
4
|
-
|
4
|
+
module Inetmgr
|
5
|
+
class ApplicationPool < IisObject
|
5
6
|
|
6
7
|
# prop :managed_runtime_version, :managedRuntimeVersion
|
7
8
|
# prop :pass_anonymous_token, :passAnonymousToken
|
@@ -12,9 +13,10 @@ class ApplicationPool < IisObject
|
|
12
13
|
prop :classic_pipeline, :managedPipelineMode, lambda { |a| a == true ? 1 : 0 }, lambda {|value| value.to_i == 1 }
|
13
14
|
prop :enable_32bit, :enable32BitAppOnWin64
|
14
15
|
prop :always_running, :startMode, lambda { |a| a == true ? "AlwaysRunning" : "OnDemand" },lambda {|value| value.to_i == 1 }
|
15
|
-
|
16
|
+
|
16
17
|
child :process_model, :processModel, ProcessModel
|
17
|
-
child :recycling, :recycling, Recycling
|
18
|
+
child :recycling, :recycling, Recycling
|
18
19
|
|
19
20
|
end
|
20
21
|
|
22
|
+
end
|
@@ -1,18 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
# - :
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
prop :
|
15
|
-
|
16
|
-
prop :
|
17
|
-
|
18
|
-
|
1
|
+
module Inetmgr
|
2
|
+
# Specifies security, performance, health, and reliability features of application pools.
|
3
|
+
class ProcessModel < IisObject
|
4
|
+
|
5
|
+
Identity_type_map = [:system, :local_service, :network_service, :specific_user, :application_pool_identity]
|
6
|
+
|
7
|
+
##
|
8
|
+
# Specifies the logon type for the process identity.
|
9
|
+
# - :batch indicates that the application pool identity should logon as a batch user.
|
10
|
+
# - :service indicates that the application pool identity should logon as a service.
|
11
|
+
|
12
|
+
prop :logon_type, :logonType, lambda {|value| value == :batch ? 0 : 1 }, lambda { |a| a == 0 ? :batch : :service }
|
13
|
+
|
14
|
+
prop :identity_type, :identityType, lambda {|value| Identity_type_map.index(value)}, lambda { |a| Identity_type_map[a] }
|
15
|
+
prop :user_name, :userName
|
16
|
+
#prop :password
|
17
|
+
prop :load_user_profile, :loadUserProfile
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -1,5 +1,8 @@
|
|
1
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'periodic_restart.rb')
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'periodic_restart.rb')
|
2
|
+
|
3
|
+
module Inetmgr
|
4
|
+
class Recycling < IisObject
|
5
|
+
child :periodic_restart, :periodicRestart, PeriodicRestart
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
@@ -3,7 +3,8 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'site_logfile.rb')
|
|
3
3
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'binding_information.rb')
|
4
4
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'application.rb')
|
5
5
|
|
6
|
-
|
6
|
+
module Inetmgr
|
7
|
+
class Site < IisObject
|
7
8
|
|
8
9
|
# name
|
9
10
|
# id
|
@@ -25,3 +26,4 @@ class Site < IisObject
|
|
25
26
|
end
|
26
27
|
|
27
28
|
end
|
29
|
+
end
|
@@ -1,7 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module Inetmgr
|
2
|
+
class SiteLimit < IisObject
|
3
|
+
|
4
|
+
prop :max_bandwidth, :maxBandwidth
|
5
|
+
prop :max_connections, :maxConnections
|
6
|
+
prop :connection_timeout, :connectionTimeout
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
module Inetmgr
|
2
|
+
|
1
3
|
# Represents a collection of IIS configuration objects.
|
2
4
|
class IisObjectCollection
|
3
|
-
|
5
|
+
include Enumerable
|
4
6
|
def initialize element, item_name, type, add_callback = nil
|
5
7
|
@collection_element = element
|
6
8
|
@item_name = item_name
|
@@ -15,7 +17,7 @@ class IisObjectCollection
|
|
15
17
|
def count
|
16
18
|
size
|
17
19
|
end
|
18
|
-
|
20
|
+
|
19
21
|
def [](index)
|
20
22
|
return @type.new @collection_element.Item index
|
21
23
|
end
|
@@ -33,14 +35,14 @@ class IisObjectCollection
|
|
33
35
|
added
|
34
36
|
end
|
35
37
|
|
36
|
-
def find
|
38
|
+
def find
|
37
39
|
size.times do |i|
|
38
40
|
instance = self[i]
|
39
41
|
return instance if yield(instance)
|
40
42
|
end
|
41
43
|
nil
|
42
44
|
end
|
43
|
-
|
45
|
+
|
44
46
|
def exists(name)
|
45
47
|
!(find {|s| s.name == name}).nil?
|
46
48
|
end
|
@@ -48,4 +50,5 @@ class IisObjectCollection
|
|
48
50
|
def remove(index)
|
49
51
|
@collection_element.DeleteElement index
|
50
52
|
end
|
53
|
+
end
|
51
54
|
end
|
@@ -1,34 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
module Inetmgr
|
2
|
+
|
3
|
+
class SiteConfiguration < Configuration
|
4
|
+
|
5
|
+
def initialize(name, server = nil)
|
6
|
+
super "MACHINE/WEBROOT/APPHOST/#{name}", server
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_app_settings
|
10
|
+
get_collection "appSettings"
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_connection_strings
|
14
|
+
get_collection "connectionStrings"
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_validation_settings
|
18
|
+
IisObject.new get_admin_section("system.webServer/validation")
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_static_content_settings
|
22
|
+
IisObject.new get_admin_section("system.webServer/staticContent")
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_service_model_settings
|
26
|
+
IisObject.new get_admin_section("system.serviceModel")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def get_collection(name)
|
32
|
+
IisObjectCollection.new get_admin_section(name).Collection, :add, IisObject
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|