capistrano-pyenv 0.0.1 → 0.0.2

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.
@@ -10,8 +10,7 @@ module Capistrano
10
10
  File.join(pyenv_path, 'bin', 'pyenv')
11
11
  }
12
12
  _cset(:pyenv_cmd) { # to use custom pyenv_path, we use `env` instead of cap's default_environment.
13
- path = "#{pyenv_path}/bin:#{pyenv_path}/shims:$PATH"
14
- "env PATH=#{path.dump()} #{pyenv_bin}"
13
+ "env PYENV_VERSION=#{pyenv_python_version.dump} #{pyenv_bin}"
15
14
  }
16
15
  _cset(:pyenv_repository, 'git://github.com/yyuu/pyenv.git')
17
16
  _cset(:pyenv_branch, 'master')
@@ -35,7 +34,6 @@ module Capistrano
35
34
  }
36
35
 
37
36
  _cset(:pyenv_python_version, '2.7.3')
38
- _cset(:pyenv_python_dependencies, %w(build-essential libreadline6-dev zlib1g-dev libssl-dev))
39
37
 
40
38
  desc("Setup pyenv.")
41
39
  task(:setup, :except => { :no_release => true }) {
@@ -85,9 +83,42 @@ module Capistrano
85
83
  # nop
86
84
  }
87
85
 
86
+ _cset(:pyenv_platform) {
87
+ capture((<<-EOS).gsub(/\s+/, ' ')).strip
88
+ if test -f /etc/debian_version; then
89
+ if test -f /etc/lsb-release && grep -i -q DISTRIB_ID=Ubuntu /etc/lsb-release; then
90
+ echo ubuntu;
91
+ else
92
+ echo debian;
93
+ fi;
94
+ elif test -f /etc/redhat-release; then
95
+ echo redhat;
96
+ else
97
+ echo unknown;
98
+ fi;
99
+ EOS
100
+ }
101
+ _cset(:pyenv_python_dependencies) {
102
+ case pyenv_platform
103
+ when /(debian|ubuntu)/i
104
+ %w(build-essential libreadline6-dev zlib1g-dev libssl-dev)
105
+ when /redhat/i
106
+ %w(autoconf glibc-devel patch readline readline-devel zlib zlib-devel openssl)
107
+ else
108
+ []
109
+ end
110
+ }
88
111
  task(:dependencies, :except => { :no_release => true }) {
89
- unless pyenv_python_dependencies.empty? # dpkg-query is faster than apt-get on querying if packages are installed
90
- run("dpkg-query --show #{pyenv_python_dependencies.join(' ')} 2>/dev/null || #{sudo} apt-get -y install #{pyenv_python_dependencies.join(' ')}")
112
+ unless pyenv_python_dependencies.empty?
113
+ case pyenv_platform
114
+ when /(debian|ubuntu)/i
115
+ # dpkg-query is faster than apt-get on querying if packages are installed
116
+ run("dpkg-query --show #{pyenv_python_dependencies.join(' ')} 2>/dev/null || #{sudo} apt-get -y install #{pyenv_python_dependencies.join(' ')}")
117
+ when /redhat/i
118
+ run("#{sudo} yum install -y #{pyenv_python_dependencies.join(' ')}")
119
+ else
120
+ # nop
121
+ end
91
122
  end
92
123
  }
93
124
 
@@ -95,7 +126,7 @@ module Capistrano
95
126
  task(:build, :except => { :no_release => true }) {
96
127
  python = fetch(:pyenv_python_cmd, 'python')
97
128
  run("#{pyenv_cmd} whence #{python} | grep -q #{pyenv_python_version} || #{pyenv_cmd} install #{pyenv_python_version}")
98
- run("#{pyenv_cmd} global #{pyenv_python_version} && #{pyenv_cmd} exec #{python} --version")
129
+ run("#{pyenv_cmd} exec #{python} --version")
99
130
  }
100
131
  }
101
132
  }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module PyEnv
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-pyenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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