trooper 0.6.0.alpha1 → 0.6.0.alpha2
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/README.md +5 -0
- data/lib/trooper/actions/update_repository_action.rb +4 -0
- data/lib/trooper/cli.rb +10 -4
- data/lib/trooper/config/action.rb +1 -0
- data/lib/trooper/logger.rb +10 -4
- data/lib/trooper/strategy.rb +3 -2
- data/lib/trooper/version.rb +1 -1
- metadata +7 -5
data/README.md
CHANGED
@@ -4,6 +4,11 @@ Trooper is designed to give you the flexibility to deploy your code to any serve
|
|
4
4
|
You design your deployment strategy to best fit your application and its needs.
|
5
5
|
Trooper comes with some built in actions that you can use in your own strategies or come up with entirely new ones.
|
6
6
|
|
7
|
+
#### Please give me a try on your small project for now
|
8
|
+
|
9
|
+
We have been using earlier versions of trooper were I work for the best part of 2 years,
|
10
|
+
but I re-wrote it for public release and so has lost a lot of its maturity.
|
11
|
+
|
7
12
|
## Installation
|
8
13
|
|
9
14
|
1. Super easy! `gem install trooper` or add it to your Gemfile `gem 'trooper'`
|
data/lib/trooper/cli.rb
CHANGED
@@ -18,16 +18,21 @@ module Trooper
|
|
18
18
|
@options = { :environment => :production }
|
19
19
|
|
20
20
|
@command = option_parser.parse!(@argv)[0]
|
21
|
-
|
21
|
+
|
22
|
+
if @command
|
23
|
+
@command = @command.to_sym
|
24
|
+
else
|
25
|
+
raise CliArgumentError, "You didnt pass an action"
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
def execute
|
25
|
-
case command
|
30
|
+
case command
|
26
31
|
when :init
|
27
32
|
Configuration.init
|
28
33
|
else
|
29
34
|
config = Configuration.new(options)
|
30
|
-
config.execute
|
35
|
+
config.execute command
|
31
36
|
end
|
32
37
|
end
|
33
38
|
|
@@ -38,7 +43,8 @@ module Trooper
|
|
38
43
|
op.banner = 'Usage: trooper <command> [options]'
|
39
44
|
op.separator ''
|
40
45
|
|
41
|
-
op.on "-d", "--debug", "Debuy" do
|
46
|
+
op.on "-d", "--debug", "Debuy" do
|
47
|
+
$trooper_log_level = ::Logger::DEBUG
|
42
48
|
@options[:debug] = true
|
43
49
|
end
|
44
50
|
|
data/lib/trooper/logger.rb
CHANGED
@@ -7,9 +7,10 @@ module Trooper
|
|
7
7
|
class Logger < ::Logger
|
8
8
|
ACTION = 6
|
9
9
|
SUCCESS = 7
|
10
|
+
STRATEGY = 8
|
10
11
|
|
11
|
-
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN < ACTION < SUCCESS
|
12
|
-
LABELS = %w(DEBUG INFO WARN ERROR FATAL ANY ACTION SUCCESS)
|
12
|
+
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN < ACTION < SUCCESS < STRATEGY
|
13
|
+
LABELS = %w(DEBUG INFO WARN ERROR FATAL ANY ACTION SUCCESS STRATEGY)
|
13
14
|
|
14
15
|
def action(progname = nil, &block)
|
15
16
|
add(ACTION, nil, progname, &block)
|
@@ -19,6 +20,10 @@ module Trooper
|
|
19
20
|
add(SUCCESS, nil, progname, &block)
|
20
21
|
end
|
21
22
|
|
23
|
+
def strategy(progname = nil, &block)
|
24
|
+
add(STRATEGY, nil, progname, &block)
|
25
|
+
end
|
26
|
+
|
22
27
|
private
|
23
28
|
|
24
29
|
def format_severity(severity)
|
@@ -52,6 +57,8 @@ module Trooper
|
|
52
57
|
colour("#{progname} => [#{severity}] #{message}\n", :magenta)
|
53
58
|
when "SUCCESS"
|
54
59
|
colour("#{progname} => [#{severity}] #{message}\n", :green)
|
60
|
+
when "STRATEGY"
|
61
|
+
colour("#{progname} => [#{severity}] #{message}\n", :cyan)
|
55
62
|
when "ERROR", "FATAL"
|
56
63
|
colour("#{progname} => [#{severity}] #{message}\n", :red)
|
57
64
|
else
|
@@ -71,11 +78,10 @@ module Trooper
|
|
71
78
|
|
72
79
|
end
|
73
80
|
|
74
|
-
|
75
81
|
def self.logger
|
76
82
|
@logger ||= begin
|
77
83
|
logger = Logger.new($stdout)
|
78
|
-
logger.level = ::Logger::
|
84
|
+
logger.level = $trooper_log_level || ::Logger::INFO
|
79
85
|
logger.progname = 'Trooper'
|
80
86
|
logger.formatter = LogFormat.new
|
81
87
|
logger
|
data/lib/trooper/strategy.rb
CHANGED
@@ -14,6 +14,7 @@ module Trooper
|
|
14
14
|
def execute(config = {})
|
15
15
|
@config = config
|
16
16
|
Trooper.logger.debug "Configuration\n#{config}"
|
17
|
+
Trooper.logger.strategy description
|
17
18
|
successful = nil
|
18
19
|
|
19
20
|
runners.each do |runner|
|
@@ -52,7 +53,7 @@ module Trooper
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def actions(*action_names)
|
55
|
-
[*action_names].each do |name|
|
56
|
+
[*action_names].each do |name|
|
56
57
|
@run_list << [:action, name]
|
57
58
|
end
|
58
59
|
end
|
@@ -77,7 +78,7 @@ module Trooper
|
|
77
78
|
action = Arsenal.actions[name]
|
78
79
|
|
79
80
|
if action
|
80
|
-
commands = action.
|
81
|
+
commands = action.call config
|
81
82
|
Trooper.logger.action action.description
|
82
83
|
runner_execute!(runner, commands)
|
83
84
|
end
|
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.0.
|
4
|
+
version: 0.6.0.alpha2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -158,7 +158,8 @@ dependencies:
|
|
158
158
|
description: Simple but powerful deployment
|
159
159
|
email:
|
160
160
|
- richard@madwire.co.uk
|
161
|
-
executables:
|
161
|
+
executables:
|
162
|
+
- trooper
|
162
163
|
extensions: []
|
163
164
|
extra_rdoc_files: []
|
164
165
|
files:
|
@@ -189,8 +190,9 @@ files:
|
|
189
190
|
- LICENSE
|
190
191
|
- Rakefile
|
191
192
|
- README.md
|
192
|
-
homepage:
|
193
|
-
licenses:
|
193
|
+
homepage: https://github.com/madwire/trooper
|
194
|
+
licenses:
|
195
|
+
- MIT
|
194
196
|
post_install_message:
|
195
197
|
rdoc_options: []
|
196
198
|
require_paths:
|
@@ -203,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
205
|
version: '0'
|
204
206
|
segments:
|
205
207
|
- 0
|
206
|
-
hash:
|
208
|
+
hash: 987069315358731721
|
207
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
210
|
none: false
|
209
211
|
requirements:
|