rubygems-bundler 1.3.0.rc1 → 1.3.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ else
33
33
  puts msg if RubygemsBundler::DEBUG
34
34
  end
35
35
 
36
- def candidate?(gemfile, bin)
36
+ def candidate?(gemfile, bin, rubygems_spec)
37
37
  config_file = File.expand_path('../.noexec.yaml', gemfile)
38
38
  log "Considering #{config_file.inspect}"
39
39
  if File.exist?(config_file)
@@ -49,12 +49,21 @@ else
49
49
  end
50
50
  log "Config based matching didn't find it, resorting to Gemfile lookup"
51
51
  end
52
+ return true if %w(ruby irb).include?(bin)
52
53
  ENV['BUNDLE_GEMFILE'] = gemfile
53
- Bundler.with_bundle do |bundler|
54
- bundler.specs.each do |spec|
55
- next if spec.name == 'bundler'
56
- return true if %w(ruby irb).include?(bin) || spec.executables.include?(bin)
54
+ Bundler.with_bundle do |runtime|
55
+ if rubygems_spec
56
+ missing_spec = runtime.
57
+ instance_variable_get(:@definition).
58
+ missing_specs.
59
+ detect{|spec| spec.name == rubygems_spec.name}
60
+ if missing_spec
61
+ puts "\e[31mCould not find proper version of #{missing_spec.to_s} in any of the sources\e[0m"
62
+ puts "\e[33mRun `bundle install` to install missing gems.\e[0m"
63
+ exit Bundler::GemNotFound.new.status_code
64
+ end
57
65
  end
66
+ return true if runtime.specs.detect{ |spec| spec.executables.include?(bin) }
58
67
  end
59
68
  false
60
69
  rescue Bundler::BundlerError, Bundler::GemfileError => e
@@ -62,12 +71,13 @@ else
62
71
  false
63
72
  end
64
73
 
65
- def setup
74
+ def setup(bin)
66
75
  gemfile = ENV['BUNDLE_GEMFILE'] || File.join(RubygemsBundler::CURRENT, "Gemfile")
76
+ rubygems_spec = Bundler.rubygems.plain_specs.detect{|spec| spec.executables.include?(bin) }
67
77
  while true
68
78
  if File.file?(gemfile)
69
79
  log "Examining #{gemfile}"
70
- if Noexec.candidate?(gemfile, File.basename($0))
80
+ if Noexec.candidate?(gemfile, bin, rubygems_spec)
71
81
  log "Using #{gemfile}"
72
82
  ENV['BUNDLE_GEMFILE'] = gemfile
73
83
  Bundler.setup
@@ -82,7 +92,7 @@ else
82
92
  end
83
93
  end
84
94
 
85
- Noexec.setup
95
+ Noexec.setup(File.basename($0))
86
96
  rescue LoadError
87
97
  warn "bundler not being used, unable to load" if RubygemsBundler::DEBUG
88
98
  end
@@ -1,3 +1,3 @@
1
1
  module RubygemsBundler
2
- VERSION = "1.3.0.rc1"
2
+ VERSION = "1.3.0.rc2"
3
3
  end
@@ -10,20 +10,20 @@ gem install bundler # status=0
10
10
  bundle install
11
11
 
12
12
  : exclusion
13
- head -n 1 $(which haml) # match=/env ruby_noexec_wrapper/
13
+ head -n 1 $(which haml) # match=/env ruby_executable_hooks/
14
14
  NOEXEC_DEBUG=1 haml --version # match=/Using .*/rubygems-bunelr_bundler-test/Gemfile/; match!=/Binary excluded by config/
15
15
  printf "exclude:\n - haml\n" > ${BUNDLE_GEMFILE%/*}/.noexec.yaml
16
16
  NOEXEC_DEBUG=1 haml --version # match!=/Using .*/rubygems-bunelr_bundler-test/Gemfile/; match=/Binary excluded by config/
17
17
 
18
18
  : generated/removed
19
- head -n 1 $(which haml) # match=/env ruby_noexec_wrapper/
20
- which ruby_noexec_wrapper # status=0
19
+ head -n 1 $(which haml) # match=/env ruby_executable_hooks/
20
+ which ruby_executable_hooks # status=0
21
21
 
22
22
  gem list # match=/haml/
23
- rubygems-bundler-uninstaller # match=/haml/
23
+ executable-hooks-uninstaller # match=/haml/
24
24
 
25
- head -n 1 $(which haml) # match!=/env ruby_noexec_wrapper/
26
- which ruby_noexec_wrapper # status=1
25
+ head -n 1 $(which haml) # match!=/env ruby_executable_hooks/
26
+ which ruby_executable_hooks # status=1
27
27
 
28
28
  gem uninstall -ax haml # match=/Successfully uninstalled/
29
29
  rm -rf ${BUNDLE_GEMFILE%/*} # status=0
@@ -3,13 +3,13 @@ sm gem install # match=/installed/
3
3
 
4
4
  yes | gem install haml # match=/1 gem installed/
5
5
 
6
- head -n 1 $(which haml) # match=/env ruby_noexec_wrapper/
7
- which ruby_noexec_wrapper # status=0
6
+ head -n 1 $(which haml) # match=/env ruby_executable_hooks/
7
+ which ruby_executable_hooks # status=0
8
8
 
9
9
  gem list # match=/haml/
10
- rubygems-bundler-uninstaller # match=/haml/
10
+ executable-hooks-uninstaller # match=/haml/
11
11
 
12
- head -n 1 $(which haml) # match!=/env ruby_noexec_wrapper/
13
- which ruby_noexec_wrapper # status=1
12
+ head -n 1 $(which haml) # match!=/env ruby_executable_hooks/
13
+ which ruby_executable_hooks # status=1
14
14
 
15
15
  gem uninstall -x haml # match=/Successfully uninstalled/
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1228271734
5
- prerelease: true
4
+ hash: 995727847
5
+ prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
9
  - 0
10
- - rc1
11
- version: 1.3.0.rc1
10
+ - rc
11
+ - 2
12
+ version: 1.3.0.rc2
12
13
  platform: ruby
13
14
  authors:
14
15
  - Josh Hull
@@ -17,8 +18,7 @@ autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2013-07-11 00:00:00 +02:00
21
- default_executable:
21
+ date: 2013-07-12 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: bundler-unload
@@ -92,7 +92,6 @@ files:
92
92
  - test/dtf/bundler_comment_test.sh
93
93
  - test/dtf/rails_and_gemfile_comment_test.sh
94
94
  - test/dtf/rubygems_comment_test.sh
95
- has_rdoc: true
96
95
  homepage: http://mpapis.github.com/rubygems-bundler
97
96
  licenses: []
98
97
 
@@ -124,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
123
  requirements: []
125
124
 
126
125
  rubyforge_project:
127
- rubygems_version: 1.3.7
126
+ rubygems_version: 1.8.24
128
127
  signing_key:
129
128
  specification_version: 3
130
129
  summary: Stop using bundle exec