noexec 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/noexec/auto.rb +56 -2
- data/lib/noexec/version.rb +1 -1
- metadata +3 -4
- data/lib/noexec.rb +0 -56
data/lib/noexec/auto.rb
CHANGED
@@ -1,3 +1,57 @@
|
|
1
|
-
|
1
|
+
DEBUG = ENV.key?('NOEXEC_DEBUG')
|
2
2
|
|
3
|
-
|
3
|
+
begin
|
4
|
+
require "rubygems"
|
5
|
+
require "bundler"
|
6
|
+
|
7
|
+
module Bundler
|
8
|
+
class << self
|
9
|
+
def reset!
|
10
|
+
@load = nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Noexec
|
16
|
+
CURRENT = Dir.pwd
|
17
|
+
|
18
|
+
extend self
|
19
|
+
|
20
|
+
def candidate?(gemfile, bin)
|
21
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
22
|
+
Bundler.load.specs.each do |spec|
|
23
|
+
next if spec.name == 'bundler'
|
24
|
+
return spec if %w(ruby irb).include?(bin) || spec.executables.include?(bin)
|
25
|
+
end
|
26
|
+
nil
|
27
|
+
ensure
|
28
|
+
Bundler.reset!
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup
|
32
|
+
puts "Noexec" if DEBUG
|
33
|
+
return if File.basename($0) == 'bundle'
|
34
|
+
return if ENV['BUNDLE_GEMFILE']
|
35
|
+
gemfile = File.join(CURRENT, "Gemfile")
|
36
|
+
while true
|
37
|
+
if File.exist?(gemfile)
|
38
|
+
puts "Examining #{gemfile}" if DEBUG
|
39
|
+
if Noexec.candidate?(gemfile, File.basename($0))
|
40
|
+
puts "Using #{gemfile}" if DEBUG
|
41
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
42
|
+
Bundler.setup
|
43
|
+
return
|
44
|
+
end
|
45
|
+
end
|
46
|
+
new_gemfile = File.expand_path("../../Gemfile", gemfile)
|
47
|
+
break if new_gemfile == gemfile
|
48
|
+
gemfile = new_gemfile
|
49
|
+
end
|
50
|
+
puts "No valid Gemfile found, moving on" if DEBUG
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Noexec.setup
|
55
|
+
rescue LoadError
|
56
|
+
warn "bundler not being used, unable to load" if DEBUG
|
57
|
+
end
|
data/lib/noexec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -24,7 +24,6 @@ files:
|
|
24
24
|
- README.md
|
25
25
|
- Rakefile
|
26
26
|
- bin/noexec
|
27
|
-
- lib/noexec.rb
|
28
27
|
- lib/noexec/auto.rb
|
29
28
|
- lib/noexec/version.rb
|
30
29
|
- noexec.gemspec
|
@@ -42,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
41
|
version: '0'
|
43
42
|
segments:
|
44
43
|
- 0
|
45
|
-
hash:
|
44
|
+
hash: 3029085704595461036
|
46
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
46
|
none: false
|
48
47
|
requirements:
|
@@ -51,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
50
|
version: '0'
|
52
51
|
segments:
|
53
52
|
- 0
|
54
|
-
hash:
|
53
|
+
hash: 3029085704595461036
|
55
54
|
requirements: []
|
56
55
|
rubyforge_project: noexec
|
57
56
|
rubygems_version: 1.8.15
|
data/lib/noexec.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
DEBUG = ENV.key?('NOEXEC_DEBUG')
|
2
|
-
|
3
|
-
begin
|
4
|
-
require "rubygems"
|
5
|
-
require "bundler"
|
6
|
-
|
7
|
-
module Bundler
|
8
|
-
class << self
|
9
|
-
def reset!
|
10
|
-
@load = nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
module Noexec
|
16
|
-
CURRENT = Dir.pwd
|
17
|
-
|
18
|
-
extend self
|
19
|
-
|
20
|
-
def candidate?(gemfile, bin)
|
21
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
22
|
-
Bundler.load.specs.each do |spec|
|
23
|
-
next if spec.name == 'bundler'
|
24
|
-
return spec if spec.executables.include?(bin)
|
25
|
-
end
|
26
|
-
nil
|
27
|
-
ensure
|
28
|
-
Bundler.reset!
|
29
|
-
end
|
30
|
-
|
31
|
-
def setup
|
32
|
-
puts "Noexec" if DEBUG
|
33
|
-
catch(:done) do
|
34
|
-
throw :done, false if File.basename($0) == 'bundle'
|
35
|
-
gemfile = File.join(CURRENT, "Gemfile")
|
36
|
-
while true
|
37
|
-
if File.exist?(gemfile)
|
38
|
-
puts "Examining #{gemfile}" if DEBUG
|
39
|
-
if Noexec.candidate?(gemfile, File.basename($0))
|
40
|
-
puts "Using #{gemfile}" if DEBUG
|
41
|
-
Bundler.setup
|
42
|
-
throw :done, true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
new_gemfile = File.expand_path("../../Gemfile", gemfile)
|
46
|
-
throw :done, false if new_gemfile == gemfile
|
47
|
-
gemfile = new_gemfile
|
48
|
-
end
|
49
|
-
puts "No valid Gemfile found, moving on" if DEBUG
|
50
|
-
false
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
rescue LoadError
|
55
|
-
warn "bundler not being used, unable to load" if DEBUG
|
56
|
-
end
|