guignol 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- guignol (0.3.4)
4
+ guignol (0.3.5)
5
5
  activesupport
6
6
  fog (~> 1.6.0)
7
7
  parallel (~> 0.5.14)
@@ -16,7 +16,7 @@ module Guignol::Commands
16
16
 
17
17
  # Run the block for each server in +configs+ (in parallel).
18
18
  def run
19
- before_run(@configs) or return
19
+ before_run(@configs, @options) or return
20
20
  results = {}
21
21
 
22
22
  Parallel.each(@configs, parallel_options) do |name,config|
@@ -49,8 +49,13 @@ module Guignol::Commands
49
49
  end
50
50
 
51
51
 
52
- private
52
+ def self.add_force_option
53
+ method_option :force,
54
+ :aliases => %w(-f), :type => :boolean, :default => false,
55
+ :desc => 'Do not ask for confirmation'
56
+ end
53
57
 
58
+ private
54
59
 
55
60
  def parallel_options
56
61
  if RUBY_VERSION >= '1.9.3'
@@ -4,6 +4,7 @@ require 'guignol/models/instance'
4
4
 
5
5
  Guignol::Shell.class_eval do
6
6
  desc 'kill PATTERNS', 'Terminate all instances matching PATTERNS'
7
+ add_force_option
7
8
  def kill(*patterns)
8
9
  if patterns.empty?
9
10
  raise Thor::Error.new('You must specify at least one PATTERN.')
@@ -16,8 +17,9 @@ end
16
17
  module Guignol::Commands
17
18
  class Kill < Base
18
19
 
19
- def before_run(configs)
20
+ def before_run(configs, options = {})
20
21
  return true if configs.empty?
22
+ return true if options[:force]
21
23
  names = configs.keys.join(", ")
22
24
  shell.yes? "Are you sure you want to destroy servers #{names}? [y/N]", :cyan
23
25
  end
@@ -19,7 +19,7 @@ module Guignol::Commands
19
19
  end
20
20
  end
21
21
 
22
- def before_run(configs)
22
+ def before_run(configs, options = {})
23
23
  @max_width = configs.keys.map(&:size).max
24
24
  end
25
25
 
@@ -4,19 +4,21 @@ require 'guignol/models/instance'
4
4
 
5
5
  Guignol::Shell.class_eval do
6
6
  desc 'stop PATTERNS', 'Stop all instances matching PATTERNS, and remove DNS records'
7
+ add_force_option
7
8
  def stop(*patterns)
8
9
  if patterns.empty?
9
10
  raise Thor::Error.new('You must specify at least one PATTERN.')
10
11
  end
11
- Guignol::Commands::Stop.new(patterns).run
12
+ Guignol::Commands::Stop.new(patterns, options).run
12
13
  end
13
14
  end
14
15
 
15
16
 
16
17
  module Guignol::Commands
17
18
  class Stop < Base
18
- def before_run(configs)
19
+ def before_run(configs, options = {})
19
20
  return true if configs.empty?
21
+ return true if options[:force]
20
22
  names = configs.keys.join(", ")
21
23
  shell.yes? "Are you sure you want to stop servers #{names}? [y/N]", :cyan
22
24
  end
@@ -24,6 +24,13 @@ module Guignol
24
24
  def self.exit_on_failure?
25
25
  true
26
26
  end
27
+
28
+
29
+ def self.add_force_option
30
+ method_option :force,
31
+ :aliases => %w(-f), :type => :boolean, :default => false,
32
+ :desc => 'Do not ask for confirmation'
33
+ end
27
34
  end
28
35
  end
29
36
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Guignol
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guignol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  segments:
234
234
  - 0
235
- hash: 3995789011153401416
235
+ hash: 3108163077006615043
236
236
  required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements: