capistrano-pyenv 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,6 +35,9 @@ Following options are available to manage your pyenv.
35
35
  * `:pyenv_repository` - repository URL of pyenv.
36
36
  * `:pyenv_python_dependencies` - depedency packages.
37
37
  * `:pyenv_python_version` - the python version to install. install `2.7.3` by default.
38
+ * `:pyenv_use_virtualenv` - create new virtualenv from `:pyenv_virtualenv_python_version`. `false` by default. `:pyenv_python_version` will be treated as the name of the virtualenv if this is turned `true`.
39
+ * `:pyenv_virtualenv_python_version` - the python version to create virtualenv. `2.7.3` by default.
40
+ * `:pyenv_virtualenv_options` - command-line options for virtualenv.
38
41
 
39
42
  ## Contributing
40
43
 
@@ -38,6 +38,9 @@ module Capistrano
38
38
  }
39
39
 
40
40
  _cset(:pyenv_python_version, '2.7.3')
41
+ _cset(:pyenv_use_virtualenv, false)
42
+ _cset(:pyenv_virtualenv_python_version, '2.7.3')
43
+ _cset(:pyenv_virtualenv_options, %w(--distribute --quiet --system-site-packages))
41
44
 
42
45
  desc("Setup pyenv.")
43
46
  task(:setup, :except => { :no_release => true }) {
@@ -91,7 +94,7 @@ module Capistrano
91
94
  File.join(pyenv_configure_home, basename)
92
95
  }
93
96
  else
94
- bash_profile File.join(pyenv_configure_home, '.bash_profile')
97
+ bash_profile = File.join(pyenv_configure_home, '.bash_profile')
95
98
  profile = File.join(pyenv_configure_home, '.profile')
96
99
  case File.basename(pyenv_configure_shell)
97
100
  when /bash/
@@ -180,9 +183,23 @@ module Capistrano
180
183
  desc("Build python within pyenv.")
181
184
  task(:build, :except => { :no_release => true }) {
182
185
  python = fetch(:pyenv_python_cmd, 'python')
183
- if pyenv_python_version != 'system'
184
- run("#{pyenv_cmd} whence #{python} | grep -q #{pyenv_python_version} || #{pyenv_cmd} install #{pyenv_python_version}")
186
+ if pyenv_use_virtualenv
187
+ if pyenv_virtualenv_python_version != 'system'
188
+ # build python for virtualenv
189
+ run("#{pyenv_bin} whence #{python} | fgrep -q #{pyenv_virtualenv_python_version} || " +
190
+ "#{pyenv_bin} install #{pyenv_virtualenv_python_version}")
191
+ end
192
+ if pyenv_python_version != 'system'
193
+ # create virtualenv
194
+ run("#{pyenv_bin} whence #{python} | fgrep -q #{pyenv_python_version} || " +
195
+ "#{pyenv_bin} virtualenv #{pyenv_virtualenv_options.join(' ')} #{pyenv_virtualenv_python_version} #{pyenv_python_version}")
196
+ end
197
+ else
198
+ if pyenv_python_version != 'system'
199
+ run("#{pyenv_bin} whence #{python} | fgrep -q #{pyenv_python_version} || #{pyenv_bin} install #{pyenv_python_version}")
200
+ end
185
201
  end
202
+
186
203
  run("#{pyenv_cmd} exec #{python} --version && #{pyenv_cmd} global #{pyenv_python_version}")
187
204
  }
188
205
  }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module PyEnv
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-pyenv
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: