capistrano-strategy-copy-bundled 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ require 'capistrano-strategy-copy-bundled'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "capistrano-strategy-copy-bundled"
7
- s.version =CapistranoStrategyCopyBundled::VERSION
7
+ s.version = CapistranoStrategyCopyBundled::VERSION
8
8
  s.authors = ["Rudolf Schmidt"]
9
9
 
10
10
  s.homepage = "http://github.com/rudionrails/capistrano-strategy-copy-bundled"
@@ -1,5 +1,4 @@
1
1
  module CapistranoStrategyCopyBundled
2
-
3
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
4
3
 
5
4
  end
@@ -17,7 +17,7 @@ module Capistrano
17
17
  system(source.checkout(revision, copy_cache))
18
18
  end
19
19
 
20
- # Check the return code of last system command and rollback if not 0
20
+ # Check the return code of last system command and rollback if not 0
21
21
  unless $? == 0
22
22
  raise Capistrano::Error, "shell command failed with return code #{$?}"
23
23
  end
@@ -53,7 +53,7 @@ module Capistrano
53
53
 
54
54
  copy_exclude.each do |pattern|
55
55
  delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)
56
- # avoid the /.. trap that deletes the parent directories
56
+ # avoid the /.. trap that deletes the parent directories
57
57
  delete_list.delete_if { |dir| dir =~ /\/\.\.$/ }
58
58
  FileUtils.rm_rf(delete_list.compact)
59
59
  end
@@ -62,7 +62,7 @@ module Capistrano
62
62
 
63
63
  File.open(File.join(destination, "REVISION"), "w") { |f| f.puts(revision) }
64
64
 
65
- # execute bundler
65
+ # execute bundler
66
66
  bundle!
67
67
 
68
68
  logger.trace "compressing #{destination} to #{filename}"
@@ -92,12 +92,23 @@ module Capistrano
92
92
  args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
93
93
 
94
94
  cmd = "#{bundle_cmd} install #{args.join(' ')}"
95
- Dir.chdir( destination ) do
96
- if defined?( Bundler )
97
- Bundler.with_clean_env { system(cmd) }
98
- else
99
- system(cmd)
100
- end
95
+ Dir.chdir(destination) do
96
+ defined?( Bundler ) ? with_original_env { system(cmd) } : system(cmd)
97
+ end
98
+ end
99
+
100
+ # This method should be built-in to Bundler 1.1+
101
+ def with_original_env
102
+ original_env = ENV.to_hash
103
+
104
+ begin
105
+ # clean the ENV from Bundler settings
106
+ ENV.delete( 'RUBYOPT' )
107
+ ENV.keys.each { |k| ENV.delete(k) if k =~ /^bundle_/i } #remove any BUNDLE_* keys
108
+
109
+ yield
110
+ ensure
111
+ ENV.replace( original_env )
101
112
  end
102
113
  end
103
114
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: capistrano-strategy-copy-bundled
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rudolf Schmidt
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-15 00:00:00 +02:00
13
+ date: 2011-09-19 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency