inetmgr 0.2.0-mswin32 → 0.3.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,42 +1,150 @@
1
1
  = About inetmgr
2
2
 
3
- inetmgr is primarily a library that helps automate the configuration of IIS. It
4
- provides a straightforward ruby-like interface on top of the configuration API,
5
- which lets you inspect add/remove and modify various IIS objects like sites,
6
- application pools, bindings, virtual directories, etc.
3
+ inetmgr is primarily a library that helps automate the configuration of IIS (7+).
4
+ It is built on top of the standard IIS configuration API (http://www.iis.net/ConfigReference)
5
+ but provides a more elegant, ruby-like interface which, typically, can be used
6
+ from your rake tasks.
7
7
 
8
- Additionally, intemgr provides some basic rake tasks that help adding IIS
9
- deployment aspects to your build (& deploy) process.
8
+ The inetmgr library lets you inspect add/remove and alter various IIS objects
9
+ like sites, application pools, bindings, virtual directories, etc.
10
10
 
11
11
  == How to install
12
12
 
13
13
  Get the gem:
14
14
 
15
- > gem install inetmgr
16
-
17
- That should do the trick. Another option would be forking the source from github:
18
-
19
- > git clone git@github.com:typesafe/inetmgr.git inetmgr
15
+ gem install inetmgr
20
16
 
21
- == How to use
22
-
23
- *Note*: inetmgr requires a Windows machine (well, duh) with IIS7+ and depends on
24
- WIN32OLE (for the sake of wrapping), which should be available by default.
17
+ That should do the trick. Another option would be forking the source from the
18
+ github repository:
25
19
 
26
- require 'inetmgr'
20
+ git clone git@github.com:typesafe/inetmgr.git inetmgr
27
21
 
28
- cfg = IisConfiguration.new
29
-
30
- cfg.get_sites.each do |site|
31
- puts 'site: #{site.name}'
32
- end
22
+ == How to use
33
23
 
34
- cfg.application_pools.add { |p| p.name = "newPool" }
35
- cfg.apply_changes
24
+ *_Notes_*: inetmgr requires a Windows machine (well, duh) with IIS7+ and depends
25
+ on WIN32OLE (obviously), which should be available by default. Inetmgr has only
26
+ been tested with Ruby version 1.9.2 (on a Windows 7 box).
27
+
28
+ === Create a new site
29
+
30
+ The following code creates a new web site with an http and https binding. Note
31
+ the use of the +configure+ method to ensure the changes get committed.
32
+
33
+ require 'inetmgr'
34
+
35
+ IisConfiguration.configure do |cfg|
36
+ cfg.get_sites.add do |site|
37
+ site.name = "Contoso"
38
+ site.auto_start = true
39
+ site.bindings.add do |b|
40
+ b.protocol = "http"
41
+ b.binding_information = "*:80:www.******.be"
42
+ end
43
+
44
+ site.bindings.add do |b|
45
+ b.protocol = "https"
46
+ b.binding_information = "*:443:"
47
+ b.add_ssl_certificate "e2564766bad7ebec8cf6899caa2a27c6391c4f19", "MY"
48
+ end
49
+
50
+ site.applications.add do |app|
51
+ app.path = "/"
52
+ app.virtual_directories.add do |dir|
53
+ dir.path = "/"
54
+ dir.physical_path = "D:\\sites\\www.******.be"
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ === Print the currently configured pools
61
+
62
+ This code sample print the currently configured pools. Note the use of a newed
63
+ configuration instance (since were not applying any changes).
64
+
65
+ require 'inetmgr'
66
+ cfg = IisConfiguration.new
67
+ pools = cfg.get_application_pools
68
+
69
+ pools.each do |p|
70
+ puts "\r\nPOOL: #{p.name}"
71
+ puts "----"
72
+ puts " - auto_start:\t #{p.auto_start}"
73
+ puts " - always_running:\t #{p.always_running}"
74
+ puts " - CLRConfigFile:\t #{p.CLRConfigFile}" # not yet mapped
75
+ puts " - enable_32bit:\t #{p.enable_32bit}"
76
+ puts " - enableConfigurationOverride:\t #{p.enableConfigurationOverride}" # not yet mapped
77
+ puts " - classic_pipeline:\t #{p.classic_pipeline}"
78
+ puts " - runtime_version:\t #{p.runtime_version}"
79
+ puts " - passAnonymousToken:\t #{p.passAnonymousToken}"
80
+
81
+ puts "\r\n - process_model:"
82
+ puts " - identity_type: #{p.process_model.identity_type}"
83
+ puts " - idleTimeout: #{p.process_model.idleTimeout}"
84
+ puts " - logon_type: #{p.process_model.logon_type}"
85
+ puts " - user_name '#{p.process_model.user_name}'"
86
+ puts " - password '#{p.process_model.password.gsub(/./, '*')}'"
87
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
88
+
89
+ puts "\r\n - recycling:"
90
+ puts " - logEventOnRecycle: #{p.recycling.logEventOnRecycle}"
91
+ puts " - periodic_restart.schedulecount: #{p.recycling.periodic_restart.schedule.size}"
92
+ puts "----------------------------"
93
+ end
94
+
95
+ The output of the above code would be something like the following:
96
+
97
+ POOL: static.******.be
98
+ ----
99
+ - auto_start: false
100
+ - always_running: false
101
+ - CLRConfigFile:
102
+ - enable_32bit: false
103
+ - enableConfigurationOverride: true
104
+ - classic_pipeline: false
105
+ - runtime_version:
106
+ - passAnonymousToken: true
107
+
108
+ - process_model:
109
+ - identity_type: application_pool_identity
110
+ - idleTimeout: 12000000000
111
+ - logon_type: batch
112
+ - user_name ''
113
+ - password ''
114
+ - load_user_profile: false
115
+
116
+ - recycling:
117
+ - logEventOnRecycle: 137
118
+ - periodic_restart.schedulecount: 0
119
+ ----------------------------
120
+
121
+ POOL: www.******.be
122
+ ----
123
+ - auto_start: false
124
+ - always_running: true
125
+ - CLRConfigFile:
126
+ - enable_32bit: false
127
+ - enableConfigurationOverride: true
128
+ - classic_pipeline: false
129
+ - runtime_version: v4.0
130
+ - passAnonymousToken: true
131
+
132
+ - process_model:
133
+ - identity_type: specific_user
134
+ - idleTimeout: 12000000000
135
+ - logon_type: batch
136
+ - user_name 'gino'
137
+ - password '*********'
138
+ - load_user_profile: false
139
+
140
+ - recycling:
141
+ - logEventOnRecycle: 137
142
+ - periodic_restart.schedulecount: 0
143
+ ----------------------------
36
144
 
37
145
  == License
38
146
 
39
- Copyright (c) 2010 Gino Heyman
147
+ Copyright (c) 2010 Gino Heyman.
40
148
 
41
149
  Licensed under the Apache License, Version 2.0 (the "License");
42
150
  you may not use this file except in compliance with the License.
@@ -0,0 +1,35 @@
1
+ = inetmgr Release Notes
2
+
3
+ == Latest Version (0.3.0)
4
+
5
+ - more property mappings for ApplicationPool & Site.
6
+ - Added support for site-level configuration (only appSettings, for now).
7
+
8
+ == Previous Versions
9
+
10
+ === 0.2.1
11
+
12
+ - Added static configure method to IisConfiguratin to support atomic changes:
13
+
14
+ IisConfiguration.configure do |cfg|
15
+ #use cfg param to configure
16
+ end
17
+
18
+ - Added some RDoc
19
+ - Added application_pool prop to Application (alias for applicationPool)
20
+ - Added logon_type prop to ProcessModel (alias for logonType)
21
+ - Added physical_path to VirtualDirectory (alias for physicalPath)
22
+ - Extended SSL support to BindingInformation
23
+
24
+ === 0.2.0
25
+
26
+ Initial version with support for configuring the following IIS/Machine level objects:
27
+
28
+ - ApplicationPool
29
+ - Application
30
+ - AutoStartProvider
31
+ - Site
32
+ - ProcessModel
33
+ - PeriodicRestart
34
+ - Recycling
35
+
@@ -5,11 +5,11 @@ spec = Gem::Specification.new do |s|
5
5
 
6
6
  s.platform = 'mswin32'
7
7
  s.name = "inetmgr"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
  s.summary = "A library for managing IIS configuration settings."
10
10
  s.description = "inetmgr allows you to inspect/configure IIS configuration sections and elements."
11
11
 
12
- s.required_ruby_version = '>= 1.8.7'
12
+ s.required_ruby_version = '>= 1.9.2'
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
 
15
15
  s.author = "Gino Heyman"
@@ -20,4 +20,6 @@ Dir.glob(File.join(path, 'inetmgr/iis_object/*.rb')).each do |f|
20
20
  require f unless requires.include?(f)
21
21
  end
22
22
 
23
+ require File.join(path, 'inetmgr/configuration.rb')
23
24
  require File.join(path, 'inetmgr/iis_configuration.rb')
25
+ require File.join(path, 'inetmgr/Site_configuration.rb')
@@ -0,0 +1,21 @@
1
+
2
+ class Configuration
3
+
4
+ def initialize(path)
5
+ @admin_manager = WIN32OLE.new "Microsoft.ApplicationHost.WritableAdminManager"
6
+ @admin_manager.CommitPath = path;
7
+ end
8
+
9
+ # applies/commits all changes made since the creation of the
10
+ # IisConfiguration instance or the last time this method was called.
11
+ def apply_changes
12
+ @admin_manager.CommitChanges
13
+ end
14
+
15
+ private
16
+
17
+ def get_config_section section_name
18
+ @admin_manager.GetAdminSection(section_name, @admin_manager.CommitPath)
19
+ end
20
+
21
+ end
@@ -1,18 +1,17 @@
1
1
 
2
- # Represents the local IIS configuration settings (meta base)
3
- class IisConfiguration
4
-
2
+ # Represents the local IIS configuration settings (meta base).
3
+ class IisConfiguration < Configuration
4
+
5
5
  def initialize
6
- @admin_manager = WIN32OLE.new "Microsoft.ApplicationHost.WritableAdminManager"
7
- @admin_manager.CommitPath = "MACHINE/WEBROOT/APPHOST";
6
+ super "MACHINE/WEBROOT/APPHOST"
8
7
  end
9
8
 
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
-
9
+ def self.configure
10
+ cfg = IisConfiguration.new
11
+ yield cfg
12
+ cfg.apply_changes
13
+ end
14
+
16
15
  # Gets all configured web sites.
17
16
  def get_sites
18
17
  s = get_config_section "system.applicationHost/sites"
@@ -30,11 +29,5 @@ class IisConfiguration
30
29
  s = get_config_section "system.applicationHost/serviceAutoStartProviders"
31
30
  IisObjectCollection.new s.Collection, :add, AutoStartProvider
32
31
  end
33
-
34
- private
35
-
36
- def get_config_section section_name, path = "MACHINE/WEBROOT/APPHOST"
37
- @admin_manager.GetAdminSection(section_name, path)
38
- end
39
32
 
40
33
  end
@@ -1,11 +1,22 @@
1
-
1
+ # Represents an IIS configuration element. Serves as the base class for all
2
+ # IIS artifacts like Site, Application and VirtualDirectory.
2
3
  class IisObject
3
4
 
4
5
  def initialize element
5
6
  @element = element
6
7
  end
7
8
 
8
- def self.prop name, actual_name, setter = Proc.new { |v| v }, reader = Proc.new { |v| v }
9
+ # Creates a property with the specified name.
10
+ #
11
+ # ==== Parameters
12
+ # * <tt>name</tt> - The name of the property to create
13
+ # * <tt>actual_name</tt> - Optional, The actual name of the attribute or
14
+ # element in the IIS configuration schema.
15
+ # * <tt>setter</tt> - Optional, a lambda or proc to convert the property
16
+ # value to a value in the IIS configuration schema.
17
+ # * <tt>reader</tt> - Optional, a lambda or proc to convert the IIS
18
+ # configuration value to the desired property value.
19
+ def self.prop name, actual_name, setter = lambda { |v| v }, reader = lambda { |v| v }
9
20
  define_method(name.to_s) do
10
21
  reader.call(@element.Properties.Item(actual_name.to_s).Value)
11
22
  end
@@ -15,12 +26,23 @@ class IisObject
15
26
  end
16
27
  end
17
28
 
29
+ # Creates a collection property with the specified name.
30
+ #
31
+ # ==== Parameters
32
+ # * <tt>name</tt> - The name of the property to create
33
+ # * <tt>type</tt> - The collection's item type.
18
34
  def self.collection name, item_name, type
19
35
  define_method(name.to_s) do
20
36
  IisObjectCollection.new @element.Collection, item_name.to_s, type
21
37
  end
22
38
  end
23
39
 
40
+ # Creates a collection property with the specified name.
41
+ #
42
+ # ==== Parameters
43
+ # * <tt>name</tt> - The name of the property to create
44
+ # * <tt>item_name</tt> - The name of the element in the configuration schema.
45
+ # * <tt>type</tt> - The collection's item type.
24
46
  def self.children name, item_name, type
25
47
  define_method(name.to_s) do
26
48
  IisObjectCollection.new @element.ChildElements.Item(name.to_s).Collection, item_name.to_s, type
@@ -33,8 +55,16 @@ class IisObject
33
55
  end
34
56
  end
35
57
 
36
- def element
37
- @element
58
+ def invoke_method name
59
+ method = @element.Methods.Item(name.to_s).CreateInstance()
60
+
61
+ # TODO: if block_given? change method_missing to change this:
62
+ # method.Input.Properties.Item("key").Value = value
63
+ # in to this:
64
+ # method.key = value
65
+
66
+ yield method if block_given?
67
+ method.Execute()
38
68
  end
39
69
 
40
70
  private
@@ -46,6 +76,8 @@ private
46
76
  else
47
77
  @element.Properties.Item(name).Value
48
78
  end
79
+ rescue WIN32OLERuntimeError
80
+ raise "property '#{symbol}'"
49
81
  end
50
82
 
51
83
  end
@@ -3,7 +3,8 @@ class Application < IisObject
3
3
 
4
4
  prop :auto_start, "serviceAutoStartEnabled"
5
5
  prop :auto_start_provider, "serviceAutoStartProvider"
6
-
6
+ prop :application_pool, :applicationPool
7
+
7
8
  collection :virtual_directories, :virtualDirectory, VirtualDirectory
8
9
 
9
10
  end
@@ -1,6 +1,14 @@
1
1
 
2
2
  class ProcessModel < IisObject
3
3
 
4
+ Identity_type_map = [:system, :local_service, :network_service, :specific_user, :application_pool_identity]
5
+
6
+ prop :logon_type, :logonType, lambda {|value| value == :batch ? 0 : 1 }, lambda { |a| a == 0 ? :batch : :service }
7
+ prop :identity_type, :identityType, lambda {|value| Identity_type_map.index(value)}, lambda { |a| Identity_type_map[a] }
8
+ prop :user_name, :userName
9
+ #prop :password
10
+ prop :load_user_profile, :loadUserProfile
11
+
4
12
  end
5
13
 
6
14
  class PeriodicRestart < IisObject
@@ -13,14 +21,18 @@ end
13
21
 
14
22
  class ApplicationPool < IisObject
15
23
 
16
- prop :auto_start, :autoStart, Proc.new { |a| a == true ? "true" : "false" }, Proc.new {|value| value == "true" }
17
- prop :runtime_version, :managedRuntimeVersion, Proc.new { |a| a }, Proc.new {|value| value }
18
- prop :classic_pipeline, :managedPipelineMode, Proc.new { |a| a == true ? 1 : 0 }, Proc.new {|value| value.to_i == 1 }
19
- prop :enable_32bit, :enable32BitAppOnWin64, Proc.new { |a| a }, Proc.new {|value| value }
20
- prop :always_running, :startMode, Proc.new { |a| a == true ? "AlwaysRunning" : "OnDemand" },Proc.new {|value| value.to_i == 1 }
24
+ prop :auto_start, :autoStart, lambda { |a| a == true ? "true" : "false" }, lambda {|value| value == "true" }
25
+ prop :runtime_version, :managedRuntimeVersion
26
+ prop :classic_pipeline, :managedPipelineMode, lambda { |a| a == true ? 1 : 0 }, lambda {|value| value.to_i == 1 }
27
+ prop :enable_32bit, :enable32BitAppOnWin64
28
+ prop :always_running, :startMode, lambda { |a| a == true ? "AlwaysRunning" : "OnDemand" },lambda {|value| value.to_i == 1 }
29
+ prop :pass_anonymous_token, :passAnonymousToken
30
+ prop :queue_length, :queueLength
21
31
 
22
32
  child :process_model, :processModel, ProcessModel
23
33
  child :recycling, :recycling, Recycling
24
34
 
25
35
  end
26
36
 
37
+
38
+
@@ -1,8 +1,26 @@
1
1
 
2
2
  class BindingInformation < IisObject
3
3
 
4
- #prop :protocol, "protocol"
5
-
4
+ #prop :protocol
6
5
  prop :binding_information, :bindingInformation
6
+ prop :ds_mapper_enabled?, :isDsMapperEnabled
7
+
8
+ def add_ssl_certificate thumprint, store
9
+ invoke_method("AddSslCertificate") do |method|
10
+ method.Input.Properties.Item("certificateHash").Value = thumprint
11
+ method.Input.Properties.Item("certificateStoreName").Value = store
12
+ end
13
+ end
14
+
15
+ def remove_ssl_certificate
16
+ invoke_method("RemoveSslCertificate")
17
+ end
18
+
19
+ def enable_ds_mapper
20
+ invoke_method("EnableDsMapper")
21
+ end
7
22
 
23
+ def disable_ds_mapper
24
+ invoke_method("DisableDsMapper")
25
+ end
8
26
  end
@@ -1,10 +1,29 @@
1
1
 
2
+ class SiteLimit < IisObject
3
+
4
+ prop :max_bandwidth, :maxBandwidth
5
+ prop :max_connections, :maxConnections
6
+ prop :connection_timeout, :connectionTimeout
7
+
8
+ end
9
+
2
10
  class Site < IisObject
3
11
 
12
+ # name
13
+ # id
14
+
4
15
  prop :auto_start, :serverAutoStart
5
16
 
6
17
  collection :applications, :application, Application
7
18
 
8
19
  children :bindings, :binding, BindingInformation
9
-
20
+
21
+ child :limits, :limits, SiteLimit
22
+
23
+ def configure
24
+ cfg = SiteConfiguration.new name
25
+ yield cfg
26
+ cfg.apply_changes
27
+ end
28
+
10
29
  end
@@ -1,5 +1,5 @@
1
1
  class VirtualDirectory < IisObject
2
2
 
3
3
  #prop :path, "path"
4
-
4
+ prop :physical_path, :physicalPath
5
5
  end
@@ -12,12 +12,16 @@ class IisObjectCollection
12
12
  @collection_element.Count
13
13
  end
14
14
 
15
+ def count
16
+ size
17
+ end
18
+
15
19
  def [](index)
16
20
  return @type.new @collection_element.Item index
17
21
  end
18
22
 
19
23
  def each
20
- size.times { |i| yield self[i] }
24
+ size.times { |i| yield self[i] }
21
25
  end
22
26
 
23
27
  def add
@@ -36,6 +40,10 @@ class IisObjectCollection
36
40
  end
37
41
  nil
38
42
  end
43
+
44
+ def exists(name)
45
+ !(find {|s| s.name == name}).nil?
46
+ end
39
47
 
40
48
  def remove(index)
41
49
  @collection_element.DeleteElement index
@@ -0,0 +1,13 @@
1
+
2
+ class SiteConfiguration < Configuration
3
+
4
+ def initialize(name)
5
+ super "MACHINE/WEBROOT/APPHOST/#{name}"
6
+ end
7
+
8
+ def get_app_settings
9
+ s = get_config_section "appSettings"
10
+ IisObjectCollection.new s.Collection, :add, IisObject
11
+ end
12
+
13
+ end
@@ -2,7 +2,7 @@ file.reference.inetmgr-lib=lib
2
2
  file.reference.inetmgr-spec=spec
3
3
  file.reference.inetmgr-test=test
4
4
  javac.classpath=
5
- main.file=
5
+ main.file=create_site.rb
6
6
  platform.active=Ruby
7
7
  source.encoding=UTF-8
8
8
  src.dir=${file.reference.inetmgr-lib}
@@ -85,4 +85,36 @@ describe "When updating application pool" do
85
85
  @pool.always_running.should == true
86
86
  end
87
87
 
88
+ end
89
+
90
+ describe "When updating an application pool's proces model" do
91
+
92
+ before(:all) do
93
+
94
+ @name = generate_random_name()
95
+
96
+ configure do |cfg|
97
+
98
+ pool = cfg.get_application_pools.add { |p| p.name = @name } # defaults
99
+
100
+ m = pool.process_model
101
+ m.logon_type = :service
102
+ m.identity_type = :network_service
103
+ end
104
+
105
+ configure do |cfg|
106
+ pool = cfg.get_application_pools.find { |p| p.name == @name }
107
+ @proces_model = pool.process_model
108
+ end
109
+
110
+ end
111
+
112
+ it "the logon type should be changed" do
113
+ @proces_model.logon_type.should == :service
114
+ end
115
+
116
+ it "the identity type should be changed" do
117
+ @proces_model.identity_type.should == :network_service
118
+ end
119
+
88
120
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_env'
2
+
3
+ describe "When adding an SSL certificate" do
4
+
5
+ before(:all) do
6
+ configure false do |cfg|
7
+ @binding = cfg.get_sites[0].bindings[0]
8
+ @binding.add_ssl_certificate "e2564766bad7ebec8cf6899caa2a27c6391c4f19", "MY"
9
+ end
10
+ end
11
+
12
+ it "the cert hash should be set" do
13
+ @binding.certificateHash.downcase.should == "e2564766bad7ebec8cf6899caa2a27c6391c4f19"
14
+ end
15
+
16
+ it "the cert store name should be set" do
17
+ @binding.certificateStoreName.should == "MY"
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,61 @@
1
+ require './spec_env.rb'
2
+
3
+ describe "When getting a sites app settings" do
4
+
5
+ before(:all) do
6
+ iis_cfg = IisConfiguration.new
7
+ site = iis_cfg.get_sites.find { |s| s.name= 'thuis.jolena.be' }
8
+ site.configure do |site_cfg|
9
+ @app_settings = site_cfg.get_app_settings
10
+ end
11
+ end
12
+
13
+ it "the settings should be returned" do
14
+ @app_settings.size.should == 1
15
+ end
16
+
17
+ end
18
+
19
+ describe "When changing an app setting" do
20
+
21
+ before(:all) do
22
+ @iis_cfg = IisConfiguration.new
23
+ site = @iis_cfg.get_sites.find { |s| s.name= 'thuis.jolena.be' }
24
+ site.configure do |site_cfg|
25
+ @previous = site_cfg.get_app_settings[0].value
26
+ site_cfg.get_app_settings[0].value = "foo"
27
+ end
28
+ end
29
+
30
+ it "the settings should be persisted" do
31
+ site = @iis_cfg.get_sites.find { |s| s.name= 'thuis.jolena.be' }
32
+ site.configure do |site_cfg|
33
+ site_cfg.get_app_settings[0].value.should == "foo"
34
+ site_cfg.get_app_settings[0].value = @previous
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ describe "When adding an app setting" do
41
+
42
+ before(:all) do
43
+ @iis_cfg = IisConfiguration.new
44
+ site = @iis_cfg.get_sites.find { |s| s.name= 'thuis.jolena.be' }
45
+ site.configure do |site_cfg|
46
+ @previous = site_cfg.get_app_settings.size
47
+ site_cfg.get_app_settings.add do |setting|
48
+ setting.key ="foo"
49
+ setting.value = "bar"
50
+ end
51
+ end
52
+ end
53
+
54
+ it "the settings should be persisted" do
55
+ site = @iis_cfg.get_sites.find { |s| s.name= 'thuis.jolena.be' }
56
+ site.configure do |site_cfg|
57
+ site_cfg.get_app_settings.size.should == (@previous + 1)
58
+ end
59
+ end
60
+
61
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_env'
1
+ require './spec_env.rb'
2
2
 
3
3
  describe "When getting the configured sites" do
4
4
 
@@ -9,7 +9,7 @@ describe "When getting the configured sites" do
9
9
  end
10
10
 
11
11
  it "at least one item should be returned" do
12
- @sites.size > 1
12
+ @sites.size.should > 1
13
13
  end
14
14
 
15
15
  end
@@ -1,6 +1,5 @@
1
- require 'spec'
1
+ require 'rspec'
2
2
  require 'test/unit'
3
- require 'spec_env'
4
3
  require 'uuid'
5
4
  require File.expand_path(File.join(File.dirname(__FILE__), "../lib/inetmgr"))
6
5
 
@@ -18,6 +17,6 @@ module RSpecExtensions
18
17
 
19
18
  end
20
19
 
21
- Spec::Runner.configure do |config|
20
+ RSpec::Runner.configure do |config|
22
21
  config.include RSpecExtensions
23
22
  end
@@ -0,0 +1,26 @@
1
+ require '..\lib\inetmgr.rb'
2
+
3
+ IisConfiguration.configure do |cfg|
4
+ cfg.get_sites.add do |site|
5
+ site.name = "Contoso"
6
+ site.auto_start = true
7
+ site.bindings.add do |b|
8
+ b.protocol = "http"
9
+ b.binding_information = "*:80:www.contoso.com"
10
+ end
11
+
12
+ site.bindings.add do |b|
13
+ b.protocol = "https"
14
+ b.binding_information = "*:443:"
15
+ b.add_ssl_certificate "e2564766bad7ebec8cf6899caa2a27c6391c4f19", "MY"
16
+ end
17
+
18
+ site.applications.add do |app|
19
+ app.path = "/"
20
+ app.virtual_directories.add do |dir|
21
+ dir.path = "/"
22
+ dir.physical_path = "D:\\temp"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -8,29 +8,54 @@ pools = cfg.get_application_pools
8
8
  pools.each do |p|
9
9
  puts "\r\nPOOL: #{p.name}"
10
10
  puts "----"
11
-
12
- puts " - process_model:"
13
- puts " - identityType: #{p.process_model.identityType}"
14
-
15
- puts " - recycling:"
11
+ puts " - auto_start:\t #{p.auto_start}"
12
+ puts " - always_running:\t #{p.always_running}"
13
+ puts " - CLRConfigFile:\t #{p.CLRConfigFile}" # not yet mapped
14
+ puts " - enable_32bit:\t #{p.enable_32bit}"
15
+ puts " - enableConfigurationOverride:\t #{p.enableConfigurationOverride}" # not yet mapped
16
+ puts " - classic_pipeline:\t #{p.classic_pipeline}"
17
+ puts " - runtime_version:\t #{p.runtime_version}"
18
+ puts " - passAnonymousToken:\t #{p.passAnonymousToken}"
19
+
20
+ puts "\r\n - process_model:"
21
+ puts " - identity_type: #{p.process_model.identity_type}"
22
+ puts " - idleTimeout: #{p.process_model.idleTimeout}"
23
+ puts " - logon_type: #{p.process_model.logon_type}"
24
+ puts " - user_name '#{p.process_model.user_name}'"
25
+ puts " - password '#{p.process_model.password.gsub(/./, '*')}'"
26
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
27
+
28
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
29
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
30
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
31
+ puts " - load_user_profile: #{p.process_model.load_user_profile}"
32
+
33
+ puts "\r\n - recycling:"
16
34
  puts " - logEventOnRecycle: #{p.recycling.logEventOnRecycle}"
17
35
  puts " - periodic_restart.schedulecount: #{p.recycling.periodic_restart.schedule.size}"
36
+ puts "----------------------------"
18
37
 
19
38
  end
20
39
 
21
40
  sites.each do |s|
22
41
 
23
42
  puts "SITE: #{s.name} #{s.bindings.size}"
24
-
43
+ puts "----"
44
+
25
45
  s.bindings.each do |b|
26
- puts "binding: #{b.protocol} - #{b.binding_information}"
46
+ puts " - binding: #{b.protocol}|#{b.binding_information}"
27
47
  end
28
48
 
49
+ puts " - limits: bandwitdth: #{s.limits.max_bandwidth}, connections: #{s.limits.max_connections}, connection timout: #{s.limits.connection_timeout}"
50
+
29
51
  s.applications.each do |a|
30
- puts " app: #{a.path}"
52
+ puts " - app: #{a.path}"
31
53
  a.virtual_directories.each do |d|
32
- puts " dir: #{d.path}"
54
+ puts " - dir: #{d.path} -> #{d.physical_path}"
33
55
  end
34
56
  end
35
-
57
+ puts "----------------------------"
58
+
36
59
  end
60
+
61
+
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: mswin32
11
11
  authors:
12
12
  - Gino Heyman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-14 00:00:00 +02:00
17
+ date: 2011-01-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -28,6 +28,7 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - inetmgr.gemspec
31
+ - lib/inetmgr/configuration.rb
31
32
  - lib/inetmgr/iis_configuration.rb
32
33
  - lib/inetmgr/iis_object/application.rb
33
34
  - lib/inetmgr/iis_object/application_pool.rb
@@ -37,6 +38,7 @@ files:
37
38
  - lib/inetmgr/iis_object/virtual_directory.rb
38
39
  - lib/inetmgr/iis_object.rb
39
40
  - lib/inetmgr/iis_object_collection.rb
41
+ - lib/inetmgr/site_configuration.rb
40
42
  - lib/inetmgr.rb
41
43
  - lib/rake/inetmgrtask.rb
42
44
  - nbproject/private/config.properties
@@ -45,13 +47,17 @@ files:
45
47
  - nbproject/project.properties
46
48
  - nbproject/project.xml
47
49
  - README.rdoc
50
+ - RELEASE-NOTES.rdoc
48
51
  - spec/application_pool_spec.rb
49
52
  - spec/application_spec.rb
50
53
  - spec/auto_start_provider_spec.rb
54
+ - spec/bingin_information_spec.rb
51
55
  - spec/iis_configuration_spec.rb
56
+ - spec/site_app_settings_spec.rb
52
57
  - spec/site_spec.rb
53
58
  - spec/spec_env.rb
54
59
  - spec/virtual_directory_spec.rb
60
+ - test/create_site.rb
55
61
  - test/print_iis_config.rb
56
62
  - test/rakefile.rb
57
63
  has_rdoc: true
@@ -70,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
76
  - !ruby/object:Gem::Version
71
77
  segments:
72
78
  - 1
73
- - 8
74
- - 7
75
- version: 1.8.7
79
+ - 9
80
+ - 2
81
+ version: 1.9.2
76
82
  required_rubygems_version: !ruby/object:Gem::Requirement
77
83
  none: false
78
84
  requirements: