capistrano-rbenv 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -97,13 +97,15 @@ module Capistrano
97
97
  File.join(rbenv_configure_home, basename)
98
98
  }
99
99
  else
100
+ bash_profile = File.join(rbenv_configure_home, '.bash_profile')
101
+ profile = File.join(rbenv_configure_home, '.profile')
100
102
  case File.basename(rbenv_configure_shell)
101
103
  when /bash/
102
- [ File.join(rbenv_configure_home, '.bash_profile') ]
104
+ [ capture("test -f #{profile.dump} && echo #{profile.dump} || echo #{bash_profile.dump}") ]
103
105
  when /zsh/
104
106
  [ File.join(rbenv_configure_home, '.zshenv') ]
105
107
  else # other sh compatible shell such like dash
106
- [ File.join(rbenv_configure_home, '.profile') ]
108
+ [ profile ]
107
109
  end
108
110
  end
109
111
  }
@@ -125,7 +127,8 @@ module Capistrano
125
127
  put(rbenv_configure_script, script)
126
128
  config_map.each { |file, temp|
127
129
  ## (1) copy original config to temporaly file and then modify
128
- execute << "( cp -fp #{file} #{temp} || touch #{temp} )"
130
+ execute << "( test -f #{file} || touch #{file} )"
131
+ execute << "cp -fp #{file} #{temp}"
129
132
  execute << "sed -i -e '/^#{Regexp.escape(rbenv_configure_signature)}/,/^#{Regexp.escape(rbenv_configure_signature)}/d' #{temp}"
130
133
  execute << "echo #{rbenv_configure_signature.dump} >> #{temp}"
131
134
  execute << "cat #{script} >> #{temp}"
@@ -186,7 +189,7 @@ module Capistrano
186
189
  if rbenv_ruby_version != 'system'
187
190
  run("#{rbenv_cmd} whence #{ruby} | grep -q #{rbenv_ruby_version} || #{rbenv_cmd} install #{rbenv_ruby_version}")
188
191
  end
189
- run("#{rbenv_cmd} exec #{ruby} --version")
192
+ run("#{rbenv_cmd} exec #{ruby} --version && #{rbenv_cmd} global #{rbenv_ruby_version}")
190
193
  }
191
194
 
192
195
  _cset(:rbenv_bundler_gem, 'bundler')
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module RbEnv
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
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.5
4
+ version: 0.0.6
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-10-15 00:00:00.000000000 Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano