capistrano-pyenv 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.
@@ -1,3 +1,7 @@
1
+
2
+ require "capistrano/configuration"
3
+ require "capistrano/recipes/deploy/scm"
4
+
1
5
  module Capistrano
2
6
  module PyEnv
3
7
  def self.extended(configuration)
@@ -24,20 +28,8 @@ module Capistrano
24
28
  _cset(:pyenv_plugins_path) {
25
29
  File.join(pyenv_path, 'plugins')
26
30
  }
31
+ _cset(:pyenv_python_version, "2.7.3")
27
32
 
28
- _cset(:pyenv_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(:pyenv_python_version, '2.7.3')
41
33
  _cset(:pyenv_use_virtualenv, false)
42
34
  _cset(:pyenv_virtualenv_python_version, '2.7.3')
43
35
  _cset(:pyenv_virtualenv_options, %w(--distribute --quiet --system-site-packages))
@@ -51,22 +43,40 @@ module Capistrano
51
43
  }
52
44
  after 'deploy:setup', 'pyenv:setup'
53
45
 
54
- def _pyenv_sync(repository, destination, revision)
55
- git = pyenv_git
56
- remote = 'origin'
57
- verbose = "-q"
58
- run((<<-E).gsub(/\s+/, ' '))
59
- if test -d #{destination}; then
60
- cd #{destination} && #{git} fetch #{verbose} #{remote} && #{git} fetch --tags #{verbose} #{remote} && #{git} merge #{verbose} #{remote}/#{revision};
46
+ def pyenv_update_repository(destination, options={})
47
+ configuration = Capistrano::Configuration.new()
48
+ variables.merge(options).each do |key, val|
49
+ configuration.set(key, val)
50
+ end
51
+ configuration.set(:source) { Capistrano::Deploy::SCM.new(configuration[:scm], configuration) }
52
+ configuration.set(:revision) { configuration[:source].head }
53
+ configuration.set(:real_revision) {
54
+ configuration[:source].local.query_revision(configuration[:revision]) { |cmd|
55
+ with_env("LC_ALL", "C") { run_locally(cmd) }
56
+ }
57
+ }
58
+ source = configuration[:source]
59
+ revision = configuration[:real_revision]
60
+ #
61
+ # we cannot use source.sync since it cleans up untacked files in the repository.
62
+ # currently we are just calling git sub-commands directly to avoid the problems.
63
+ #
64
+ verbose = configuration[:scm_verbose] ? nil : "-q"
65
+ run((<<-EOS).gsub(/\s+/, ' ').strip)
66
+ if [ -d #{destination} ]; then
67
+ cd #{destination} &&
68
+ #{source.command} fetch #{verbose} #{source.origin} &&
69
+ #{source.command} fetch --tags #{verbose} #{source.origin} &&
70
+ #{source.command} reset #{verbose} --hard #{revision};
61
71
  else
62
- #{git} clone #{verbose} #{repository} #{destination} && cd #{destination} && #{git} checkout #{verbose} #{revision};
63
- fi;
64
- E
72
+ #{source.checkout(revision, destination)};
73
+ fi
74
+ EOS
65
75
  end
66
76
 
67
77
  desc("Update pyenv installation.")
68
78
  task(:update, :except => { :no_release => true }) {
69
- _pyenv_sync(pyenv_repository, pyenv_path, pyenv_branch)
79
+ pyenv_update_repository(pyenv_path, :scm => :git, :repository => pyenv_repository, :branch => pyenv_branch)
70
80
  plugins.update
71
81
  }
72
82
 
@@ -81,7 +91,7 @@ module Capistrano
81
91
  pyenv_plugins.each { |name, repository|
82
92
  options = ( pyenv_plugins_options[name] || {})
83
93
  branch = ( options[:branch] || 'master' )
84
- _pyenv_sync(repository, File.join(pyenv_plugins_path, name), branch)
94
+ pyenv_update_repository(File.join(pyenv_plugins_path, name), :scm => :git, :repository => repository, :branch => branch)
85
95
  }
86
96
  }
87
97
  }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module PyEnv
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
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.6
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-10-24 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano