trooper 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ Trooper comes with some built in actions that you can use in your own strategies
6
6
 
7
7
  ## Installation
8
8
 
9
- 1. Super easy! `gem install trooper` or add it to your Gemfile `gem "trooper", "~> 0.6.1"`
9
+ 1. Super easy! `gem install trooper` or add it to your Gemfile `gem "trooper", "~> 0.6"`
10
10
  2. Pop into your terminal and run `=> trooper init`
11
11
  3. Start building you deployment strategy :)
12
12
 
@@ -8,8 +8,8 @@ module Trooper
8
8
  include Trooper::DSL::Rake
9
9
  include Trooper::DSL::Bundler
10
10
 
11
- attr_reader :name, :description, :config, :block, :options
12
- attr_accessor :commands
11
+ attr_reader :name, :description, :block, :options
12
+ attr_accessor :config, :commands
13
13
 
14
14
  # Public: Define a new action.
15
15
  #
@@ -43,7 +43,7 @@ module Trooper
43
43
  @config = configuration
44
44
  @call_count += 1
45
45
 
46
- if continue_call?
46
+ if everything_ok? && continue_call?
47
47
  reset_commands!
48
48
 
49
49
  build_commands
@@ -70,16 +70,23 @@ module Trooper
70
70
  "touch #{prerequisite_list}; if grep -vz #{self.name} #{prerequisite_list}; then #{original_commands.join(' && ')}; else echo 'Already Done'; fi"
71
71
  end
72
72
 
73
- # Public: Validates the action object. (NOT WORKING)
73
+ # Public: Validates the action object.
74
74
  #
75
75
  # Examples
76
76
  #
77
77
  # @action.ok? # => true
78
78
  #
79
- # Returns true.
79
+ # Returns true or raise an InvalidActionError exception.
80
80
  def ok?
81
- true
81
+ begin
82
+ build_commands
83
+ reset_commands!
84
+ true
85
+ rescue Exception => e
86
+ raise InvalidActionError, "Action missing config variables - #{e.message}"
87
+ end
82
88
  end
89
+ alias :everything_ok? :ok?
83
90
 
84
91
  # Public: What type of action this is.
85
92
  #
@@ -25,6 +25,13 @@ module Trooper
25
25
  @commands = []
26
26
  end
27
27
 
28
+ # Always returns true because default actions are
29
+ # loaded before the troopfile, so varibles will
30
+ # always be missing.
31
+ def ok?
32
+ true
33
+ end
34
+
28
35
  private
29
36
 
30
37
  def build_commands
@@ -0,0 +1,20 @@
1
+ require 'trooper/actions/default_action'
2
+
3
+ module Trooper
4
+ module Actions
5
+
6
+ class PrecompileAssetsAction < DefaultAction
7
+ name :precompile_assets
8
+ description "Precompile Application Assets"
9
+ options :local => true, :on => :first_host
10
+
11
+ private
12
+
13
+ def build_commands
14
+ run "bundle exec rake assets:precompile RAILS_ENV=production RAILS_GROUPS=assets"
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -9,6 +9,7 @@ require 'trooper/actions/rollback_migrate_action'
9
9
  require 'trooper/actions/setup_database_action'
10
10
  require 'trooper/actions/setup_trooper_action'
11
11
  require 'trooper/actions/update_repository_action'
12
+ require 'trooper/actions/precompile_assets_action'
12
13
 
13
14
  module Trooper
14
15
  module Config
@@ -18,10 +19,12 @@ module Trooper
18
19
  Actions::CloneRepositoryAction, Actions::InstallGemsAction,
19
20
  Actions::MigrateDatabaseAction, Actions::RestartServerAction,
20
21
  Actions::RollbackMigrateAction, Actions::SetupDatabaseAction,
21
- Actions::UpdateRepositoryAction]
22
+ Actions::UpdateRepositoryAction, Actions::PrecompileAssetsAction]
22
23
 
23
24
  def action(name, description = "No Description", options = {}, &block)
24
25
  action = Trooper::Action.new name, description, options, &block
26
+ action.config = self
27
+
25
28
  Trooper::Arsenal.actions.add action
26
29
  end
27
30
 
data/lib/trooper/host.rb CHANGED
@@ -73,7 +73,7 @@ module Trooper
73
73
 
74
74
  return [commands, :stdout, stdout.read]
75
75
  rescue Exception => e
76
- raise Trooper::StdError, "#{stderr}\n[ERROR INFO] #{commands}"
76
+ raise Trooper::StdError, "#{e.message}\n[ERROR INFO] #{commands}"
77
77
  end
78
78
  end
79
79
 
@@ -2,7 +2,7 @@ module Trooper
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- TINY = 1
5
+ TINY = 2
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.1
4
+ version: 0.6.2
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-16 00:00:00.000000000 Z
12
+ date: 2012-07-17 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.3.0
21
+ version: 2.5.2
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.3.0
29
+ version: 2.5.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '2.8'
37
+ version: '2.11'
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '2.8'
45
+ version: '2.11'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: guard-rspec
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0.6'
53
+ version: '1.2'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0.6'
61
+ version: '1.2'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rb-fsevent
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0.7'
85
+ version: '0.8'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0.7'
93
+ version: '0.8'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: pry
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 0.5.4
133
+ version: 0.6.4
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 0.5.4
141
+ version: 0.6.4
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: rake
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -169,6 +169,7 @@ files:
169
169
  - lib/trooper/actions/default_action.rb
170
170
  - lib/trooper/actions/install_gems_action.rb
171
171
  - lib/trooper/actions/migrate_database_action.rb
172
+ - lib/trooper/actions/precompile_assets_action.rb
172
173
  - lib/trooper/actions/prepare_prerequisite_action.rb
173
174
  - lib/trooper/actions/restart_server_action.rb
174
175
  - lib/trooper/actions/rollback_migrate_action.rb
@@ -195,7 +196,7 @@ files:
195
196
  - LICENSE
196
197
  - Rakefile
197
198
  - README.md
198
- homepage: https://github.com/madwire/trooper
199
+ homepage: http://madwire.github.com/trooper
199
200
  licenses:
200
201
  - MIT
201
202
  post_install_message:
@@ -210,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
210
211
  version: '0'
211
212
  segments:
212
213
  - 0
213
- hash: 3446711087193426780
214
+ hash: 370573009495457313
214
215
  required_rubygems_version: !ruby/object:Gem::Requirement
215
216
  none: false
216
217
  requirements:
@@ -219,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
220
  version: '0'
220
221
  segments:
221
222
  - 0
222
- hash: 3446711087193426780
223
+ hash: 370573009495457313
223
224
  requirements: []
224
225
  rubyforge_project:
225
226
  rubygems_version: 1.8.24