trooper 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 Richard Adams
1
+ Copyright 2013 Richard Adams
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -98,7 +98,7 @@ end
98
98
 
99
99
  ## LICENSE
100
100
 
101
- Copyright 2012 Richard Adams
101
+ Copyright 2013 Richard Adams
102
102
 
103
103
  Permission is hereby granted, free of charge, to any person obtaining
104
104
  a copy of this software and associated documentation files (the
data/lib/trooper/cli.rb CHANGED
@@ -32,7 +32,7 @@ module Trooper
32
32
  Configuration.init
33
33
  else
34
34
  config = Configuration.new(options)
35
- config.execute command
35
+ config.runner(command).execute
36
36
  end
37
37
  end
38
38
 
@@ -43,7 +43,7 @@ module Trooper
43
43
  op.banner = 'Usage: trooper <command> [options]'
44
44
  op.separator ''
45
45
 
46
- op.on "-d", "--debug", "Debuy" do
46
+ op.on "-d", "--debug", "Debug" do
47
47
  $trooper_log_level = ::Logger::DEBUG
48
48
  @options[:debug] = true
49
49
  end
@@ -61,18 +61,18 @@ module Trooper
61
61
  config.map {|k,v| "#{k}: #{v}" }.join("\n")
62
62
  end
63
63
 
64
- # Public: Find and Execute the Strategy.
64
+ # Public: Finds a Strategy and returns a runner for that strategy.
65
65
  #
66
66
  # strategy_name - The name of the strategy as a symbol.
67
67
  #
68
68
  # Examples
69
69
  #
70
- # @config.execute(:my_strategy_name)
70
+ # @config.runner(:my_strategy_name) # => <Runner>
71
71
  #
72
- # Returns boolean.
73
- def execute(strategy_name)
72
+ # Returns a runner.
73
+ def runner(strategy_name)
74
74
  strategy = Arsenal.strategies[strategy_name]
75
- Runner.new(strategy, self).execute
75
+ Runner.new(strategy, self)
76
76
  end
77
77
 
78
78
  # Public: Set variables that will be available to all actions.
data/lib/trooper/host.rb CHANGED
@@ -20,7 +20,7 @@ module Trooper
20
20
  # Host.new('my.example.com', 'admin', :forward_agent => false)
21
21
  #
22
22
  # Returns a Host object.
23
- def initialize(host, user, options = { :forward_agent => true })
23
+ def initialize(host, user, options = { :forward_agent => true, :paranoid => Net::SSH::Verifiers::Null.new })
24
24
  @host = host
25
25
  @user = user
26
26
  @connection = Net::SSH.start(host, user, options)
@@ -0,0 +1,42 @@
1
+ module Trooper
2
+ class RunList < Array
3
+
4
+ attr_reader :strategy, :action_type
5
+
6
+ def initialize(strategy, options = {})
7
+ @strategy = strategy
8
+ @action_type = options[:action_type] if options[:action_type]
9
+ end
10
+
11
+ # Public: Is the run list blank.
12
+ #
13
+ # Examples
14
+ #
15
+ # blank? => true
16
+ #
17
+ # Returns a boolean.
18
+ def blank?
19
+ self == []
20
+ end
21
+
22
+ # Public: Added items to the runlist.
23
+ #
24
+ # itema - Can be an action or array
25
+ #
26
+ # Examples
27
+ #
28
+ # @run_list << <Actions>
29
+ #
30
+ # Returns Action.
31
+ def <<(item)
32
+ if item.respond_to?(:name)
33
+ type = action_type ? action_type : item.type
34
+ super [strategy.name, type, item.name]
35
+ else
36
+ super(item)
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -1,3 +1,5 @@
1
+ require 'trooper/host'
2
+
1
3
  module Trooper
2
4
  class Runner
3
5
 
@@ -2,7 +2,7 @@ module Trooper
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- TINY = 2
5
+ TINY = 3
6
6
  PRE = nil
7
7
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
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-07-17 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.5.2
21
+ version: 2.6.8
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 2.5.2
29
+ version: 2.6.8
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +188,7 @@ files:
188
188
  - lib/trooper/dsl/rake.rb
189
189
  - lib/trooper/host.rb
190
190
  - lib/trooper/logger.rb
191
+ - lib/trooper/run_list.rb
191
192
  - lib/trooper/runner.rb
192
193
  - lib/trooper/strategy.rb
193
194
  - lib/trooper/template/troopfile.rb
@@ -211,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
212
  version: '0'
212
213
  segments:
213
214
  - 0
214
- hash: 370573009495457313
215
+ hash: 3369402586764392296
215
216
  required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  none: false
217
218
  requirements:
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  version: '0'
221
222
  segments:
222
223
  - 0
223
- hash: 370573009495457313
224
+ hash: 3369402586764392296
224
225
  requirements: []
225
226
  rubyforge_project:
226
227
  rubygems_version: 1.8.24