capistrano-alice 0.0.3 → 0.0.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/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in capistrano-alice.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake'
@@ -3,6 +3,8 @@ class Capistrano::Alice::Release
3
3
  attr_accessor :processes
4
4
  attr_accessor :path_rules
5
5
  attr_accessor :environment
6
+ attr_accessor :deploy_reference
7
+ attr_accessor :repository_reference
6
8
 
7
9
  attr_accessor :id
8
10
  attr_accessor :number
@@ -14,11 +16,13 @@ class Capistrano::Alice::Release
14
16
 
15
17
  def create!
16
18
  body = {
17
- "application" => @config.application,
18
- "machines" => @servers,
19
- "processes" => @processes,
20
- "path_rules" => (@path_rules || {}).to_a,
21
- "environment" => @environment
19
+ "application" => @config.application,
20
+ "machines" => @servers,
21
+ "processes" => @processes,
22
+ "path_rules" => (@path_rules || {}).to_a,
23
+ "environment" => @environment,
24
+ "deploy_reference" => @deploy_reference,
25
+ "repository_reference" => @repository_reference
22
26
  }
23
27
 
24
28
  Net::HTTP.start(@config.alice_host, @config.alice_port) do |http|
@@ -75,6 +79,9 @@ Capistrano::Configuration.instance(:must_exist).load do
75
79
  find_and_execute_task("alice:release:_create:detect_ruby_version")
76
80
  find_and_execute_task("alice:release:_create:detect_node_version")
77
81
 
82
+ alice_release.deploy_reference = fetch(:release_name, nil)
83
+ alice_release.repository_reference = fetch(:real_revision, nil)
84
+
78
85
  on_rollback { find_and_execute_task("alice:release:destroy") }
79
86
 
80
87
  begin
@@ -85,9 +92,15 @@ Capistrano::Configuration.instance(:must_exist).load do
85
92
 
86
93
  default_environment.merge! alice_release.environment
87
94
 
88
- if alice_release.environment['RUBY_VERSION']
89
- set :rvm_ruby_string, alice_release.environment['RUBY_VERSION']
95
+ if version = alice_release.environment['RUBY_VERSION']
96
+ set :rvm_ruby_string, version
90
97
  reset!(:default_shell)
98
+
99
+ if fetch(:alice_env, false)
100
+ path = default_environment['PATH'] || '$PATH'
101
+ path = [File.join(fetch(:alice_prefix, '/var/alice'), 'env', 'ruby', version, 'bin'), path].join(':')
102
+ default_environment['PATH'] = path
103
+ end
91
104
  end
92
105
 
93
106
  if alice_release.environment['RAILS_ENV']
@@ -199,6 +212,15 @@ Capistrano::Configuration.instance(:must_exist).load do
199
212
  end
200
213
  end
201
214
 
215
+ if rails_env = fetch(:rails_env, nil)
216
+ env['RAILS_ENV'] = rails_env
217
+ env['RACK_ENV'] = rails_env
218
+ end
219
+
220
+ if node_env = fetch(:node_env, nil)
221
+ env['NODE_ENV'] = node_env
222
+ end
223
+
202
224
  env.merge! fetch(:alice_environment, {})
203
225
 
204
226
  alice_release.environment.merge! env
@@ -0,0 +1,5 @@
1
+ begin
2
+ require "rvm/capistrano"
3
+ rescue LoadError
4
+ require "capistrano-alice/rvm_capistrano"
5
+ end
@@ -0,0 +1,62 @@
1
+
2
+ # Recipes for using RVM on a server with capistrano.
3
+
4
+ unless Capistrano::Configuration.respond_to?(:instance)
5
+ abort "rvm/capistrano requires Capistrano >= 2."
6
+ end
7
+
8
+ Capistrano::Configuration.instance(true).load do
9
+
10
+ # Taken from the capistrano code.
11
+ def _cset(name, *args, &block)
12
+ unless exists?(name)
13
+ set(name, *args, &block)
14
+ end
15
+ end
16
+
17
+ set :default_shell do
18
+ shell = File.join(rvm_bin_path, "rvm-shell")
19
+ ruby = rvm_ruby_string.to_s.strip
20
+ shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
21
+ shell
22
+ end
23
+
24
+ # Let users set the type of their rvm install.
25
+ _cset(:rvm_type, :system)
26
+
27
+ # Define rvm_path
28
+ # This is used in the default_shell command to pass the required variable to rvm-shell, allowing
29
+ # rvm to boostrap using the proper path. This is being lost in Capistrano due to the lack of a
30
+ # full environment.
31
+ _cset(:rvm_path) do
32
+ case rvm_type
33
+ when :root, :system
34
+ "/usr/local/rvm"
35
+ when :local, :user, :default
36
+ "$HOME/.rvm/"
37
+ else
38
+ rvm_type.to_s.empty? ? "$HOME/.rvm" : rvm_type.to_s
39
+ end
40
+ end
41
+
42
+ # Let users override the rvm_bin_path
43
+ _cset(:rvm_bin_path) do
44
+ case rvm_type
45
+ when :root, :system
46
+ "/usr/local/rvm/bin"
47
+ when :local, :user, :default
48
+ "$HOME/.rvm/bin"
49
+ else
50
+ rvm_type.to_s.empty? ? "#{rvm_path}/bin" : rvm_type.to_s
51
+ end
52
+ end
53
+
54
+ # Use the default ruby on the server, by default :)
55
+ _cset(:rvm_ruby_string, "default")
56
+ end
57
+
58
+ # E.g, to use ree and rails 3:
59
+ #
60
+ # require 'rvm/capistrano'
61
+ # set :rvm_ruby_string, "ree@rails3"
62
+ #
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Alice
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,46 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-alice
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Simon Menke
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: yajl-ruby
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70356617209300 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: *70356617209300
34
25
  description: This makes deploying apps to alice/pluto much easier.
35
- email:
26
+ email:
36
27
  - simon.menke@gmail.com
37
28
  executables: []
38
-
39
29
  extensions: []
40
-
41
30
  extra_rdoc_files: []
42
-
43
- files:
31
+ files:
44
32
  - .gitignore
45
33
  - Gemfile
46
34
  - Rakefile
@@ -48,39 +36,37 @@ files:
48
36
  - lib/capistrano-alice.rb
49
37
  - lib/capistrano-alice/maintenance_mode.rb
50
38
  - lib/capistrano-alice/release_managment.rb
39
+ - lib/capistrano-alice/rvm.rb
40
+ - lib/capistrano-alice/rvm_capistrano.rb
51
41
  - lib/capistrano-alice/version.rb
52
- homepage: ""
42
+ homepage: ''
53
43
  licenses: []
54
-
55
44
  post_install_message:
56
45
  rdoc_options: []
57
-
58
- require_paths:
46
+ require_paths:
59
47
  - lib
60
- required_ruby_version: !ruby/object:Gem::Requirement
48
+ required_ruby_version: !ruby/object:Gem::Requirement
61
49
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- hash: 3
66
- segments:
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ segments:
67
55
  - 0
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
56
+ hash: 2999335112235911117
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
58
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ segments:
76
64
  - 0
77
- version: "0"
65
+ hash: 2999335112235911117
78
66
  requirements: []
79
-
80
67
  rubyforge_project: capistrano-alice
81
- rubygems_version: 1.8.6
68
+ rubygems_version: 1.8.11
82
69
  signing_key:
83
70
  specification_version: 3
84
- summary: "[ALICE] capistrano extention for alice"
71
+ summary: ! '[ALICE] capistrano extention for alice'
85
72
  test_files: []
86
-