capistrano-rbenv 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,7 @@ module Capistrano
10
10
  File.join(rbenv_path, 'bin', 'rbenv')
11
11
  }
12
12
  _cset(:rbenv_cmd) { # to use custom rbenv_path, we use `env` instead of cap's default_environment.
13
- path = "#{rbenv_path}/bin:#{rbenv_path}/shims:$PATH"
14
- "env PATH=#{path.dump()} #{rbenv_bin}"
13
+ "env RBENV_VERSION=#{rbenv_ruby_version.dump} #{rbenv_bin}"
15
14
  }
16
15
  _cset(:rbenv_repository, 'git://github.com/sstephenson/rbenv.git')
17
16
  _cset(:rbenv_branch, 'master')
@@ -39,7 +38,6 @@ module Capistrano
39
38
  }
40
39
 
41
40
  _cset(:rbenv_ruby_version, '1.9.3-p194')
42
- _cset(:rbenv_ruby_dependencies, %w(build-essential libreadline6-dev zlib1g-dev libssl-dev bison))
43
41
 
44
42
  _cset(:rbenv_use_bundler, true)
45
43
  set(:bundle_cmd) { # override bundle_cmd in "bundler/capistrano"
@@ -95,9 +93,42 @@ module Capistrano
95
93
  # nop
96
94
  }
97
95
 
96
+ _cset(:rbenv_platform) {
97
+ capture((<<-EOS).gsub(/\s+/, ' '))
98
+ if test -f /etc/debian_version; then
99
+ if test -f /etc/lsb-release && grep -i -q DISTRIB_ID=Ubuntu /etc/lsb-release; then
100
+ echo ubuntu;
101
+ else
102
+ echo debian;
103
+ fi;
104
+ elif test -f /etc/redhat-release; then
105
+ echo redhat;
106
+ else
107
+ echo unknown;
108
+ fi;
109
+ EOS
110
+ }
111
+ _cset(:rbenv_ruby_dependencies) {
112
+ case rbenv_platform
113
+ when /(debian|ubuntu)/i
114
+ %w(build-essential libreadline6-dev zlib1g-dev libssl-dev bison)
115
+ when /redhat/i
116
+ %w(autoconf glibc-devel patch readline readline-devel zlib zlib-devel openssl bison)
117
+ else
118
+ []
119
+ end
120
+ }
98
121
  task(:dependencies, :except => { :no_release => true }) {
99
- unless rbenv_ruby_dependencies.empty? # dpkg-query is faster than apt-get on querying if packages are installed
100
- run("dpkg-query --show #{rbenv_ruby_dependencies.join(' ')} 2>/dev/null || #{sudo} apt-get -y install #{rbenv_ruby_dependencies.join(' ')}")
122
+ unless rbenv_ruby_dependencies.empty?
123
+ case rbenv_platform
124
+ when /(debian|ubuntu)/i
125
+ # dpkg-query is faster than apt-get on querying if packages are installed
126
+ run("dpkg-query --show #{rbenv_ruby_dependencies.join(' ')} 2>/dev/null || #{sudo} apt-get -y install #{rbenv_ruby_dependencies.join(' ')}")
127
+ when /redhat/i
128
+ run("#{sudo} yum install -y #{rbenv_ruby_dependencies.join(' ')}")
129
+ else
130
+ # nop
131
+ end
101
132
  end
102
133
  }
103
134
 
@@ -105,7 +136,7 @@ module Capistrano
105
136
  task(:build, :except => { :no_release => true }) {
106
137
  ruby = fetch(:rbenv_ruby_cmd, 'ruby')
107
138
  run("#{rbenv_cmd} whence #{ruby} | grep -q #{rbenv_ruby_version} || #{rbenv_cmd} install #{rbenv_ruby_version}")
108
- run("#{rbenv_cmd} global #{rbenv_ruby_version} && #{rbenv_cmd} exec #{ruby} --version")
139
+ run("#{rbenv_cmd} exec #{ruby} --version")
109
140
  }
110
141
 
111
142
  _cset(:rbenv_bundler_gem, 'bundler')
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module RbEnv
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
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.2
4
+ version: 0.0.3
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-09-19 00:00:00.000000000 Z
12
+ date: 2012-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano