vlad-rainbows 0.1.3 → 0.1.4

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 CHANGED
@@ -1,4 +1,10 @@
1
- # Rainbows for Vlad
1
+ # An opinionated Rainbows for Vlad
2
+
3
+ This plugin assumes the following:
4
+
5
+ * You have existing rake tasks to start/stop [Rainbows](http://rainbows.rubyforge.org/).
6
+ * Your target system(s) have a [system wide](http://rvm.beginrescueend.com/deployment/system-wide/) install of [RVM](http://rvm.beginrescueend.com/).
7
+ * Your application is [Rack](http://rack.rubyforge.org/) based, and makes use of the 'RACK_ENV' environment variable.
2
8
 
3
9
  ## Description
4
10
 
@@ -10,7 +16,7 @@ A [Vlad](http://rubyhitsquad.com/Vlad_the_Deployer.html) plugin for controlling
10
16
 
11
17
  Add the following to your Gemfile.
12
18
 
13
- gem "vlad-rainbows", "~> 0.1.0"
19
+ gem "vlad-rainbows", "~> 0.1.4"
14
20
 
15
21
  ## Usage
16
22
 
@@ -28,23 +34,27 @@ This plugin assumes you have rake tasks to handle stopping/starting Rainbows. B
28
34
  * app:start
29
35
  * app:stop
30
36
 
31
- The tasks invoked can be overriden by updating deploy.rb with:
37
+ The tasks can be overriden by updating deploy.rb with:
32
38
 
33
39
  set :app_start_task, "task_name"
34
40
  set :app_stop_task, "task_name"
35
41
 
36
- The plugin provides a run_rake method for executing rake tasks remotely. If you wish to override the methods
37
- implementation, simply provide a block to the :run_rake_proc variable.
42
+ The plugin provides a run_rake method for executing rake tasks remotely. If you wish to override the method's
43
+ implementation, provide a block to :run_rake_proc in deploy.rb.
38
44
 
39
- set :rake_cmd, "bundle exec rake"
40
45
  set :run_rake_proc, Proc.new {
41
46
  run [
42
- "source /usr/local/lib/rvm",
43
47
  "cd #{current_path}",
44
48
  "#{rake_cmd} RACK_ENV=#{rack_env} #{task}",
45
49
  ]
46
50
  }
47
51
 
52
+ You can also override the following defaults in deploy.rb:
53
+
54
+ * :rvmrc
55
+ * :rack_env
56
+ * :rake_cmd
57
+
48
58
  ## Credits
49
59
 
50
60
  John Barnette's [vlad-git](https://github.com/jbarnette/vlad-git), for which this was based on.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/lib/vlad/rainbows.rb CHANGED
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Recipe to start/stop Rainbows.
3
+
1
4
  require "vlad"
2
5
  require "vlad/utils"
3
6
 
data/lib/vlad/utils.rb CHANGED
@@ -1,8 +1,15 @@
1
+ ##
2
+ # Utility Class which provides basic support to Vlad::Rainbows.
3
+ # If tasks tend to call these methods directly, it should probably
4
+ # spawn into it's own gem.
5
+
1
6
  class Vlad::Utils
7
+ set :rake_cmd, Rake::RemoteTask.fetch(:rake_cmd, "bundle exec rake")
8
+ set :rvmrc, Rake::RemoteTask.fetch(:rvmrc, "/usr/local/lib/rvm")
2
9
 
3
10
  ##
4
11
  # Invokes the given rake task remotely; setting up the proper environment.
5
- # If a block is provided, it will be excuted instead.
12
+ # If :run_rake_proc is provided it's proc will be called.
6
13
  #
7
14
  # +task+ is the fully qualified task name.
8
15
  # +rake_cmd+ is the rake command to execute remotely.
@@ -11,10 +18,21 @@ class Vlad::Utils
11
18
  if defined? run_rake_proc
12
19
  run_rake_proc.call
13
20
  else
14
- run [
21
+ rvm_run [
15
22
  "cd #{current_path}",
16
23
  "#{rake_cmd} RACK_ENV=#{rack_env} #{task}",
17
- ].join " && "
24
+ ]
18
25
  end
19
26
  end
27
+
28
+ ##
29
+ # A wrapper to rake-remote_task's +run+, making sure to setup
30
+ # rvm's environment.
31
+ #
32
+ # +cmds+ is expected to be an array.
33
+
34
+ def self.rvm_run cmds
35
+ cmds.unshift "source #{rvmrc}"
36
+ run cmds.join " && "
37
+ end
20
38
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vlad-rainbows}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["retr0h"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vlad-rainbows
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - retr0h