rubygems-bundler 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/rubygems-bundler/noexec.rb +37 -29
- data/lib/rubygems-bundler/version.rb +1 -1
- data/rubygems-bundler.gemspec +1 -1
- data/test/dtf/bundler_comment_test.sh +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA512:
|
3
|
-
metadata.gz: a54f0dfa7d84cec266825776da8b2d3cc8acb8992da8aff941755c43471fb558a57b43d99323ae1d416095458fe68bd3dd46ee2182c09e3659dd3ef913d7d924
|
4
|
-
data.tar.gz: df2ba5391f44296308697923b6bf209f055b915dc9fd7a839c8f13a289d96e5d1edcfca9a79d70a19f2f07c1a4617acf4e44d31bf9467c4bcf507fc0374e6a02
|
5
2
|
SHA1:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: e2924818f0358170cdbc6b2161193baf44e36c8f
|
4
|
+
metadata.gz: ed28cbeb5191d6e07851576bee9540ef6d1aa440
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: ee9c2c15fb987ea87265835216f3317175f1d684e807dd49e7d5397560541f0484dee2c52ca186a54af111ba2698599070d56366fd8649369cad64e67d789797
|
7
|
+
metadata.gz: 1e3fc6e5079a460e9ddef58c661a70326972a178642efd811640e7067e1d59c0069cbc021ab4c1084c4390eeb6d18f41ace1ae1a23fa960d940785a4ef3dd4d0
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
|
3
3
|
class Noexec
|
4
|
-
DEBUG = ENV
|
4
|
+
DEBUG = ENV['NOEXEC_DEBUG']
|
5
5
|
CURRENT = Dir.pwd
|
6
6
|
|
7
|
-
attr_reader :bin
|
7
|
+
attr_reader :bin, :gemfile, :rubygems_specs
|
8
8
|
|
9
9
|
def initialize(bin)
|
10
10
|
log "Bin used: #{bin}"
|
@@ -17,14 +17,20 @@ class Noexec
|
|
17
17
|
puts msg if Noexec::DEBUG
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def log2(msg)
|
21
|
+
puts msg if Noexec::DEBUG == "2"
|
22
|
+
end
|
23
|
+
|
24
|
+
def candidate?
|
25
|
+
log "Examining #{gemfile}"
|
21
26
|
config_file = File.expand_path('../.noexec.yaml', gemfile)
|
22
|
-
log "Considering #{config_file.inspect}"
|
23
27
|
if File.exist?(config_file)
|
24
28
|
log "Using config file at #{config_file}"
|
25
29
|
require "yaml"
|
26
30
|
config = YAML::load_file(config_file)
|
27
|
-
|
31
|
+
unless config['include'].nil? ^ config['exclude'].nil?
|
32
|
+
raise "You cannot have both an include and exclude section in your #{config_file.inspect}"
|
33
|
+
end
|
28
34
|
if config['include'] && config['include'].include?(bin)
|
29
35
|
log "Binary included by config"
|
30
36
|
return true
|
@@ -34,22 +40,24 @@ class Noexec
|
|
34
40
|
end
|
35
41
|
log "Config based matching didn't find it, resorting to Gemfile lookup"
|
36
42
|
end
|
37
|
-
return true if %w(ruby irb).include?(bin)
|
38
43
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
39
|
-
Bundler.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
runtime = Bundler.load
|
45
|
+
log2 "runtime specs: #{runtime.specs.map{|g| "#{g.name}-#{g.version}"}*" "}"
|
46
|
+
if rubygems_spec # that single gem
|
47
|
+
missing_spec = runtime.
|
48
|
+
instance_variable_get(:@definition).
|
49
|
+
missing_specs.
|
50
|
+
detect{|spec| spec.name == rubygems_spec.name}
|
51
|
+
if missing_spec
|
52
|
+
puts "\e[31mCould not find proper version of #{missing_spec.to_s} in any of the sources\e[0m"
|
53
|
+
puts "\e[33mRun `bundle install` to install missing gems.\e[0m"
|
54
|
+
exit Bundler::GemNotFound.new.status_code
|
50
55
|
end
|
51
|
-
return true if runtime.specs.detect{ |spec| spec.executables.include?(bin) }
|
52
56
|
end
|
57
|
+
if runtime.specs.detect{ |spec| spec.executables.include?(bin) }
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
Bundler.unload!(rubygems_specs)
|
53
61
|
false
|
54
62
|
rescue Bundler::BundlerError, Bundler::GemfileError => e
|
55
63
|
warn "Ignoring candidate #{gemfile}:\n#{e}" if Noexec::DEBUG
|
@@ -57,27 +65,26 @@ class Noexec
|
|
57
65
|
end
|
58
66
|
|
59
67
|
def rubygems_spec
|
60
|
-
@rubygems_spec ||=
|
68
|
+
@rubygems_spec ||= rubygems_specs.detect{|spec| spec.executables.include?(bin) }
|
61
69
|
end
|
62
70
|
|
63
71
|
def setup
|
64
72
|
puts "Noexec - starting check" if Noexec::DEBUG
|
65
73
|
require "bundler-unload"
|
66
74
|
|
67
|
-
|
75
|
+
@rubygems_specs = Bundler.rubygems.plain_specs # save it for unloading and checking binary
|
76
|
+
log2 "rubygems_specs: #{rubygems_specs.map{|g| "#{g.name}-#{g.version}"}*" "}"
|
77
|
+
|
78
|
+
@gemfile = ENV['BUNDLE_GEMFILE'] || File.join(Noexec::CURRENT, "Gemfile")
|
79
|
+
|
68
80
|
while true
|
69
|
-
if File.file?(gemfile)
|
70
|
-
log "
|
71
|
-
|
72
|
-
log "Using #{gemfile}"
|
73
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
74
|
-
Bundler.setup
|
75
|
-
return
|
76
|
-
end
|
81
|
+
if File.file?(gemfile) && candidate?
|
82
|
+
log "Keeping #{gemfile} loaded"
|
83
|
+
return
|
77
84
|
end
|
78
85
|
new_gemfile = File.expand_path("../../Gemfile", gemfile)
|
79
86
|
break if new_gemfile == gemfile
|
80
|
-
gemfile = new_gemfile
|
87
|
+
@gemfile = new_gemfile
|
81
88
|
end
|
82
89
|
log "No valid Gemfile found, moving on"
|
83
90
|
rescue LoadError
|
@@ -101,6 +108,7 @@ class Noexec
|
|
101
108
|
|
102
109
|
else
|
103
110
|
setup
|
111
|
+
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
data/rubygems-bundler.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
|
19
19
|
s.add_dependency "bundler-unload", ">=1.0.2"
|
20
|
-
s.add_dependency "executable-hooks", ">=1.2.
|
20
|
+
s.add_dependency "executable-hooks", ">=1.2.5"
|
21
21
|
s.add_development_dependency "tf"
|
22
22
|
#s.add_development_dependency "smf-gem"
|
23
23
|
end
|
@@ -13,9 +13,9 @@ bundle install # status=0
|
|
13
13
|
|
14
14
|
: exclusion
|
15
15
|
head -n 1 "$(which haml)" # match=/env ruby_executable_hooks/
|
16
|
-
haml --version # match=/
|
16
|
+
haml --version # match=/Keeping .*/rubygems-bunelr_bundler-test/Gemfile loaded/; match!=/Binary excluded by config/
|
17
17
|
printf "exclude:\n - haml\n" > ${BUNDLE_GEMFILE%/*}/.noexec.yaml
|
18
|
-
haml --version # match!=/
|
18
|
+
haml --version # match!=/Keeping .*/rubygems-bunelr_bundler-test/Gemfile loaded/; match=/Binary excluded by config/
|
19
19
|
|
20
20
|
: generated/removed
|
21
21
|
head -n 1 "$(which haml)" # match=/env ruby_executable_hooks/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Hull
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-10-
|
13
|
+
date: 2013-10-20 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler-unload
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.2.
|
32
|
+
version: 1.2.5
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id002
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements: []
|
90
90
|
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.0.
|
92
|
+
rubygems_version: 2.0.12
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Stop using bundle exec
|