trooper 0.6.2 → 0.6.3
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.
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/trooper/cli.rb +2 -2
- data/lib/trooper/configuration.rb +5 -5
- data/lib/trooper/host.rb +1 -1
- data/lib/trooper/run_list.rb +42 -0
- data/lib/trooper/runner.rb +2 -0
- data/lib/trooper/version.rb +1 -1
- metadata +7 -6
data/LICENSE
CHANGED
data/README.md
CHANGED
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
|
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", "
|
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:
|
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.
|
70
|
+
# @config.runner(:my_strategy_name) # => <Runner>
|
71
71
|
#
|
72
|
-
# Returns
|
73
|
-
def
|
72
|
+
# Returns a runner.
|
73
|
+
def runner(strategy_name)
|
74
74
|
strategy = Arsenal.strategies[strategy_name]
|
75
|
-
Runner.new(strategy, self)
|
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
|
data/lib/trooper/runner.rb
CHANGED
data/lib/trooper/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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:
|
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:
|
224
|
+
hash: 3369402586764392296
|
224
225
|
requirements: []
|
225
226
|
rubyforge_project:
|
226
227
|
rubygems_version: 1.8.24
|