iisconfig 0.2.3 → 0.3.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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2RiZmYzM2Q3NWUzZWEwZTllMTUwYWFiNjE2OGJmYjIzMDliN2Q2YQ==
5
+ data.tar.gz: !binary |-
6
+ MjA2ZDYzZDAwNWU0YzJjYjY5YzY3MmYzMmFiM2ZjYTNkMGQ5YWIwYQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MmFkMzc0ZDIzMzhlZTU1YjAzZjc0NzMyOGIzYjQ0Y2RjOTAxZTQyODU0NmNl
10
+ MGQwODE1Nzk4ZjE0ZDE0MDhiMGE1MTkwY2JmYjZkMzlkNTA3OWFhZGIxMTk4
11
+ MzNkMDdiYzU2M2FiOWZjZmYzNTIzYjBmZDgxZmY4NDEyNGIzNmI=
12
+ data.tar.gz: !binary |-
13
+ NzliMWMzNGJiOGIyYTQ3M2NjZDViZWQ5MjMyMWQ3ODRlOTE4Yzc4YjYwNzM3
14
+ ZmRmZGI0Y2E0MzlmNDE3ZDg4Mjk1ZDI0MDRlYWE1MTZjNWI2MWE3OGVjNTUz
15
+ ZDNjODZlMGE1OWUzNjQ0Nzk1Y2I1NGFlNjY1ZTA2ZTQ2NzYzMTc=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
@@ -8,14 +8,33 @@ require 'iisconfig/configuration'
8
8
 
9
9
  include GLI
10
10
 
11
+ program_desc 'Configures IIS on Windows'
12
+
11
13
  version IISConfig::VERSION
12
14
 
13
15
  desc 'executes the configuration file'
14
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
+
15
23
  c.action do |global_options, options, args|
16
- config = IISConfig::IISConfiguration.new
17
- config.load args[0]
18
- config.run
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
19
38
  end
20
39
  end
21
40
 
@@ -73,6 +73,16 @@ module IISConfig
73
73
  paths
74
74
  end
75
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
+
76
86
  def build_commands
77
87
  commands = []
78
88
 
@@ -8,8 +8,10 @@ require 'site'
8
8
  module IISConfig
9
9
 
10
10
  class IISConfiguration
11
+ @@dry_run = false
11
12
 
12
- def initialize
13
+ def initialize(options = {})
14
+ @options = {recycle_apppools: false}.merge(options)
13
15
  @app_pools = []
14
16
  @sites = []
15
17
  @ftp_sites = []
@@ -17,6 +19,14 @@ module IISConfig
17
19
  @after = []
18
20
  end
19
21
 
22
+ def self.dry_run=dry_run
23
+ @@dry_run = dry_run
24
+ end
25
+
26
+ def self.dry_run?
27
+ @@dry_run
28
+ end
29
+
20
30
  def app_pool(&block)
21
31
  add_instance @app_pools, IISConfig::AppPool, block
22
32
  end
@@ -44,15 +54,30 @@ module IISConfig
44
54
  def run
45
55
  @before.each { |a| a.call }
46
56
 
47
- execute @app_pools
48
- execute @sites
49
- execute @ftp_sites
57
+ if @options[:recycle_apppools]
58
+ recycle_application_pools
59
+ else
60
+ rebuild_all
61
+ end
50
62
 
51
63
  @after.each { |a| a.call }
52
64
  end
53
65
 
54
66
  private
55
67
 
68
+ def rebuild_all
69
+ execute @app_pools
70
+ execute @sites
71
+ execute @ftp_sites
72
+ end
73
+
74
+ def recycle_application_pools
75
+ @app_pools.each do |p|
76
+ commands = p.recycle
77
+ Runner.run_commands [commands] unless commands.empty?
78
+ end
79
+ end
80
+
56
81
  def execute(objects)
57
82
  objects.each do |p|
58
83
  commands = p.build_commands
@@ -7,9 +7,12 @@ module IISConfig
7
7
  tool = :appcmd
8
8
 
9
9
  puts " #{tool.to_s} #{args.join(' ')}"
10
- result = `c:/windows/system32/inetsrv/appcmd #{args.join(' ')}"`
11
- raise Exception.new($?.exitstatus) unless $?.success?
12
- result
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
13
16
  end
14
17
 
15
18
  def self.run_commands(commands)
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iisconfig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Luke Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-14 00:00:00.000000000Z
11
+ date: 2013-07-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: gli
16
- requirement: &23199084 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *23199084
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rainbow
27
- requirement: &23198568 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *23198568
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  description: IIS Configuration
37
42
  email:
38
43
  - stuff@lukesmith.net
@@ -58,33 +63,26 @@ files:
58
63
  - bin/iisconfig
59
64
  homepage: https://github.com/lukesmith/iisconfig
60
65
  licenses: []
66
+ metadata: {}
61
67
  post_install_message:
62
68
  rdoc_options: []
63
69
  require_paths:
64
70
  - lib
65
71
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
72
  requirements:
68
73
  - - ! '>='
69
74
  - !ruby/object:Gem::Version
70
75
  version: '0'
71
- segments:
72
- - 0
73
- hash: 467665089
74
76
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
77
  requirements:
77
78
  - - ! '>='
78
79
  - !ruby/object:Gem::Version
79
80
  version: '0'
80
- segments:
81
- - 0
82
- hash: 467665089
83
81
  requirements: []
84
82
  rubyforge_project: iisconfig
85
- rubygems_version: 1.8.12
83
+ rubygems_version: 2.0.3
86
84
  signing_key:
87
- specification_version: 3
85
+ specification_version: 4
88
86
  summary: IIS Config
89
87
  test_files:
90
88
  - test/example.rb