capistrano-rbenv 0.0.6 → 0.0.7
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/lib/capistrano-rbenv/deploy.rb +38 -29
- data/lib/capistrano-rbenv/version.rb +1 -1
- metadata +2 -2
@@ -1,3 +1,7 @@
|
|
1
|
+
|
2
|
+
require "capistrano/configuration"
|
3
|
+
require "capistrano/recipes/deploy/scm"
|
4
|
+
|
1
5
|
module Capistrano
|
2
6
|
module RbEnv
|
3
7
|
def self.extended(configuration)
|
@@ -24,20 +28,7 @@ module Capistrano
|
|
24
28
|
_cset(:rbenv_plugins_path) {
|
25
29
|
File.join(rbenv_path, 'plugins')
|
26
30
|
}
|
27
|
-
|
28
|
-
_cset(:rbenv_git) {
|
29
|
-
if scm == :git
|
30
|
-
if fetch(:scm_command, :default) == :default
|
31
|
-
fetch(:git, 'git')
|
32
|
-
else
|
33
|
-
scm_command
|
34
|
-
end
|
35
|
-
else
|
36
|
-
fetch(:git, 'git')
|
37
|
-
end
|
38
|
-
}
|
39
|
-
|
40
|
-
_cset(:rbenv_ruby_version, '1.9.3-p194')
|
31
|
+
_cset(:rbenv_ruby_version, "1.9.3-p327")
|
41
32
|
|
42
33
|
_cset(:rbenv_use_bundler, true)
|
43
34
|
set(:bundle_cmd) { # override bundle_cmd in "bundler/capistrano"
|
@@ -54,22 +45,40 @@ module Capistrano
|
|
54
45
|
}
|
55
46
|
after 'deploy:setup', 'rbenv:setup'
|
56
47
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
48
|
+
def rbenv_update_repository(destination, options={})
|
49
|
+
configuration = Capistrano::Configuration.new()
|
50
|
+
variables.merge(options).each do |key, val|
|
51
|
+
configuration.set(key, val)
|
52
|
+
end
|
53
|
+
configuration.set(:source) { Capistrano::Deploy::SCM.new(configuration[:scm], configuration) }
|
54
|
+
configuration.set(:revision) { configuration[:source].head }
|
55
|
+
configuration.set(:real_revision) {
|
56
|
+
configuration[:source].local.query_revision(configuration[:revision]) { |cmd|
|
57
|
+
with_env("LC_ALL", "C") { run_locally(cmd) }
|
58
|
+
}
|
59
|
+
}
|
60
|
+
source = configuration[:source]
|
61
|
+
revision = configuration[:real_revision]
|
62
|
+
#
|
63
|
+
# we cannot use source.sync since it cleans up untacked files in the repository.
|
64
|
+
# currently we are just calling git sub-commands directly to avoid the problems.
|
65
|
+
#
|
66
|
+
verbose = configuration[:scm_verbose] ? nil : "-q"
|
67
|
+
run((<<-EOS).gsub(/\s+/, ' ').strip)
|
68
|
+
if [ -d #{destination} ]; then
|
69
|
+
cd #{destination} &&
|
70
|
+
#{source.command} fetch #{verbose} #{source.origin} &&
|
71
|
+
#{source.command} fetch --tags #{verbose} #{source.origin} &&
|
72
|
+
#{source.command} reset #{verbose} --hard #{revision};
|
64
73
|
else
|
65
|
-
#{
|
66
|
-
fi
|
67
|
-
|
74
|
+
#{source.checkout(revision, destination)};
|
75
|
+
fi
|
76
|
+
EOS
|
68
77
|
end
|
69
78
|
|
70
79
|
desc("Update rbenv installation.")
|
71
80
|
task(:update, :except => { :no_release => true }) {
|
72
|
-
|
81
|
+
rbenv_update_repository(rbenv_path, :scm => :git, :repository => rbenv_repository, :branch => rbenv_branch)
|
73
82
|
plugins.update
|
74
83
|
}
|
75
84
|
|
@@ -84,7 +93,7 @@ module Capistrano
|
|
84
93
|
rbenv_plugins.each { |name, repository|
|
85
94
|
options = ( rbenv_plugins_options[name] || {})
|
86
95
|
branch = ( options[:branch] || 'master' )
|
87
|
-
|
96
|
+
rbenv_update_repository(File.join(rbenv_plugins_path, name), :scm => :git, :repository => repository, :branch => branch)
|
88
97
|
}
|
89
98
|
}
|
90
99
|
}
|
@@ -187,7 +196,7 @@ module Capistrano
|
|
187
196
|
task(:build, :except => { :no_release => true }) {
|
188
197
|
ruby = fetch(:rbenv_ruby_cmd, 'ruby')
|
189
198
|
if rbenv_ruby_version != 'system'
|
190
|
-
run("#{
|
199
|
+
run("#{rbenv_bin} whence #{ruby} | fgrep -q #{rbenv_ruby_version} || #{rbenv_bin} install #{rbenv_ruby_version}")
|
191
200
|
end
|
192
201
|
run("#{rbenv_cmd} exec #{ruby} --version && #{rbenv_cmd} global #{rbenv_ruby_version}")
|
193
202
|
}
|
@@ -197,11 +206,11 @@ module Capistrano
|
|
197
206
|
gem = "#{rbenv_cmd} exec gem"
|
198
207
|
if v = fetch(:rbenv_bundler_version, nil)
|
199
208
|
q = "-n #{rbenv_bundler_gem} -v #{v}"
|
200
|
-
f = "
|
209
|
+
f = "fgrep #{rbenv_bundler_gem} | fgrep #{v}"
|
201
210
|
i = "-v #{v} #{rbenv_bundler_gem}"
|
202
211
|
else
|
203
212
|
q = "-n #{rbenv_bundler_gem}"
|
204
|
-
f = "
|
213
|
+
f = "fgrep #{rbenv_bundler_gem}"
|
205
214
|
i = "#{rbenv_bundler_gem}"
|
206
215
|
end
|
207
216
|
run("unset -v GEM_HOME; #{gem} query #{q} 2>/dev/null | #{f} || #{gem} install -q #{i}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-rbenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
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-
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|