rubygems-bundler 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gem.config +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +22 -11
- data/lib/rubygems-bundler/noexec.rb +76 -64
- data/lib/rubygems-bundler/version.rb +1 -1
- data/rubygems-bundler.gemspec +3 -5
- metadata +5 -33
- data/Rakefile +0 -1
data/.gem.config
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem_tag_prefix=v
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
date: 2012-09-05
|
5
|
+
|
6
|
+
- move precheck to the beginning - fix `bundle _1.0.7_ ...`
|
7
|
+
- fix #33, do not pollute global namespace
|
8
|
+
- allow disabling with `NOEXEC_DISABLE=1` and deprecate `NOEXEC=0`
|
9
|
+
|
3
10
|
## 1.0.7
|
4
11
|
date: 2012-08-21
|
5
12
|
|
data/README.md
CHANGED
@@ -30,46 +30,51 @@ you can define it in `~/.gemrc` to override the default:
|
|
30
30
|
|
31
31
|
### ./.noexec.yaml
|
32
32
|
|
33
|
-
Though you can let noexec do it's own thing and rely on looking up your binary via your Gemfile,
|
34
|
-
you can also specify which binaries you want included or excluded.
|
35
|
-
Create a .noexec.yaml file along side any Gemfiles you want to use.
|
36
|
-
Then, to enable (or disable) the usage of your particular binary into your bundle,
|
33
|
+
Though you can let noexec do it's own thing and rely on looking up your binary via your Gemfile,
|
34
|
+
you can also specify which binaries you want included or excluded.
|
35
|
+
Create a .noexec.yaml file along side any Gemfiles you want to use.
|
36
|
+
Then, to enable (or disable) the usage of your particular binary into your bundle,
|
37
37
|
add an include or exclude section. For example:
|
38
38
|
|
39
39
|
```yml
|
40
40
|
exclude: [rake]
|
41
41
|
```
|
42
|
-
Or,
|
42
|
+
Or,
|
43
43
|
|
44
44
|
```yml
|
45
45
|
include: [haml]
|
46
46
|
```
|
47
47
|
|
48
|
-
###
|
48
|
+
### Disabling
|
49
49
|
|
50
|
-
In case you need explicitly skip loading Bundler.setup
|
50
|
+
In case you need explicitly skip loading `Bundler.setup`, prefix your command with `NOEXEC_DISABLE=1`:
|
51
|
+
|
52
|
+
NOEXEC_DISABLE=1
|
53
|
+
|
54
|
+
The old method is still available and might kick in if your tools use `NOEXEC` environment variable:
|
51
55
|
|
52
56
|
NOEXEC=0 rails new app
|
53
57
|
NOEXEC=skip gist
|
54
58
|
|
55
|
-
both `0` and `skip` will
|
59
|
+
both `0` and `skip` will disable the gem, this method is deprecated and will be removed with 1.2.0.
|
56
60
|
|
57
61
|
## Problems?
|
58
62
|
|
59
|
-
Things not going the way you'd like? Try your command again with
|
63
|
+
Things not going the way you'd like? Try your command again with
|
60
64
|
`NOEXEC_DEBUG=1` set and create a ticket. I'll fix it right away!
|
61
65
|
|
62
66
|
### IRC support:
|
63
67
|
|
64
68
|
[#rubygems-bundler on irc.freenode.net](http://webchat.freenode.net/?channels=#rubygems-bundler)
|
65
69
|
|
70
|
+
If you do not get relatively fast an answer make sure to leave an email to secure an later answer.
|
66
71
|
|
67
72
|
## How does this work (ruby_noexec_wrapper)
|
68
73
|
|
69
74
|
It modifies gem wrappers shebang to load `ruby_noexec_wrapper`.
|
70
75
|
Then, when you run gem binaries, it takes a look at your working directory,
|
71
|
-
and every directory above it until it can find a `Gemfile`.
|
72
|
-
If the executable you're running is present in your Gemfile,
|
76
|
+
and every directory above it until it can find a `Gemfile`.
|
77
|
+
If the executable you're running is present in your Gemfile,
|
73
78
|
it switches to using that `Gemfile` instead (via `Bundle.setup`).
|
74
79
|
|
75
80
|
Rubygems and Bundler integration, makes executable wrappers
|
@@ -84,6 +89,12 @@ rubygems-bundler was merged with [noexec gem](https://github.com/joshbuddy/noexe
|
|
84
89
|
|
85
90
|
this will set all gems to `/usr/bin/env ruby` which is one of the safest choices (especially when using rvm).
|
86
91
|
|
92
|
+
In case of rvm additional steps will ensure this gem is removed and not installed again:
|
93
|
+
|
94
|
+
rvm get stable --without-gems=rubygems-bundler
|
95
|
+
rvm all-gemsets do gem uninstall --all --executables rubygems-bundler
|
96
|
+
|
97
|
+
|
87
98
|
## Authors
|
88
99
|
|
89
100
|
- Joshua Hull <joshbuddy@gmail.com>
|
@@ -1,81 +1,93 @@
|
|
1
|
-
|
1
|
+
module RubygemsBundler
|
2
|
+
end
|
3
|
+
RubygemsBundler::DEBUG = ENV.key?('NOEXEC_DEBUG')
|
4
|
+
|
5
|
+
if %w(bundle rubygems-bundler-uninstaller).include?(File.basename($0))
|
6
|
+
puts "Noexec - skipped binary: #{File.basename($0)}" if RubygemsBundler::DEBUG
|
7
|
+
|
8
|
+
elsif ENV['BUNDLE_GEMFILE'] && ENV['BUNDLE_BIN_PATH'] && ENV['RUBYOPT']
|
9
|
+
puts "Noexec - already in 'bundle exec'" if RubygemsBundler::DEBUG
|
10
|
+
|
11
|
+
elsif %w(0 skip).include?( ENV['NOEXEC'] ) || ENV.key?('NOEXEC_DISABLE')
|
12
|
+
#TODO: deprecated in 1.1.0, to be removed in 1.2.0 -- 2012.09.05
|
13
|
+
$stderr.puts "Warning, 'NOEXEC' environment variable is deprecated, switch to 'NOEXEC_DISABLE=1'." if ENV.key?('NOEXEC')
|
14
|
+
puts "Noexec - disabled with environment variable" if RubygemsBundler::DEBUG
|
2
15
|
|
3
|
-
|
4
|
-
|
5
|
-
|
16
|
+
else
|
17
|
+
begin
|
18
|
+
puts "Noexec - starting check" if RubygemsBundler::DEBUG
|
19
|
+
require "rubygems"
|
20
|
+
require "bundler"
|
6
21
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
22
|
+
module Bundler
|
23
|
+
class << self
|
24
|
+
def reset!
|
25
|
+
@load = nil
|
26
|
+
end
|
11
27
|
end
|
12
28
|
end
|
13
|
-
end
|
14
29
|
|
15
|
-
|
16
|
-
|
30
|
+
module Noexec
|
31
|
+
RubygemsBundler::CURRENT = Dir.pwd
|
17
32
|
|
18
|
-
|
33
|
+
extend self
|
19
34
|
|
20
|
-
|
21
|
-
|
22
|
-
|
35
|
+
def log(msg)
|
36
|
+
puts msg if RubygemsBundler::DEBUG
|
37
|
+
end
|
23
38
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
def candidate?(gemfile, bin)
|
40
|
+
config_file = File.expand_path('../.noexec.yaml', gemfile)
|
41
|
+
log "Considering #{config_file.inspect}"
|
42
|
+
if File.exist?(config_file)
|
43
|
+
log "Using config file at #{config_file}"
|
44
|
+
config = YAML::load_file(config_file)
|
45
|
+
raise "You cannot have both an include and exclude section in your #{config_file.inspect}" unless config['include'].nil? ^ config['exclude'].nil?
|
46
|
+
if config['include'] && config['include'].include?(bin)
|
47
|
+
log "Binary included by config"
|
48
|
+
return true
|
49
|
+
elsif config['exclude'] && config['exclude'].include?(bin)
|
50
|
+
log "Binary excluded by config"
|
51
|
+
return false
|
52
|
+
end
|
53
|
+
log "Config based matching didn't find it, resorting to Gemfile lookup"
|
37
54
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
55
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
56
|
+
Bundler.load.specs.each do |spec|
|
57
|
+
next if spec.name == 'bundler'
|
58
|
+
return true if %w(ruby irb).include?(bin) || spec.executables.include?(bin)
|
59
|
+
end
|
60
|
+
false
|
61
|
+
rescue Bundler::BundlerError => e
|
62
|
+
warn "Ignoring candidate #{gemfile}:\n#{e}" if RubygemsBundler::DEBUG
|
63
|
+
false
|
64
|
+
ensure
|
65
|
+
Bundler.reset!
|
66
|
+
ENV['BUNDLE_GEMFILE'] = nil
|
44
67
|
end
|
45
|
-
false
|
46
|
-
rescue Bundler::BundlerError => e
|
47
|
-
warn "Ignoring candidate #{gemfile}:\n#{e}" if DEBUG
|
48
|
-
false
|
49
|
-
ensure
|
50
|
-
Bundler.reset!
|
51
|
-
ENV['BUNDLE_GEMFILE'] = nil
|
52
|
-
end
|
53
68
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
66
|
-
Bundler.setup
|
67
|
-
return
|
69
|
+
def setup
|
70
|
+
gemfile = ENV['BUNDLE_GEMFILE'] || File.join(RubygemsBundler::CURRENT, "Gemfile")
|
71
|
+
while true
|
72
|
+
if File.file?(gemfile)
|
73
|
+
log "Examining #{gemfile}"
|
74
|
+
if Noexec.candidate?(gemfile, File.basename($0))
|
75
|
+
log "Using #{gemfile}"
|
76
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
77
|
+
Bundler.setup
|
78
|
+
return
|
79
|
+
end
|
68
80
|
end
|
81
|
+
new_gemfile = File.expand_path("../../Gemfile", gemfile)
|
82
|
+
break if new_gemfile == gemfile
|
83
|
+
gemfile = new_gemfile
|
69
84
|
end
|
70
|
-
|
71
|
-
break if new_gemfile == gemfile
|
72
|
-
gemfile = new_gemfile
|
85
|
+
log "No valid Gemfile found, moving on"
|
73
86
|
end
|
74
|
-
log "No valid Gemfile found, moving on"
|
75
87
|
end
|
76
|
-
end
|
77
88
|
|
78
|
-
|
79
|
-
rescue LoadError
|
80
|
-
|
89
|
+
Noexec.setup
|
90
|
+
rescue LoadError
|
91
|
+
warn "bundler not being used, unable to load" if RubygemsBundler::DEBUG
|
92
|
+
end
|
81
93
|
end
|
data/rubygems-bundler.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- encoding: utf-8 -*-
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
Kernel.load File.expand_path("../lib/rubygems-bundler/version.rb", __FILE__)
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rubygems-bundler"
|
@@ -17,7 +17,5 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = %w( rubygems-bundler-uninstaller )
|
18
18
|
|
19
19
|
s.add_development_dependency "tf"
|
20
|
-
#
|
21
|
-
s.add_development_dependency "rake"
|
22
|
-
s.add_development_dependency "bundler"
|
20
|
+
#s.add_development_dependency "smf-gem"
|
23
21
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.7
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Hull
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-09-05 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: tf
|
@@ -32,34 +32,6 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
47
|
-
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: bundler
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
61
|
-
type: :development
|
62
|
-
version_requirements: *id003
|
63
35
|
description: Stop using bundle exec. Integrate Rubygems and Bundler. Make rubygems generate bundler aware executable wrappers.
|
64
36
|
email:
|
65
37
|
- joshbuddy@gmail.com
|
@@ -71,6 +43,7 @@ extensions: []
|
|
71
43
|
extra_rdoc_files: []
|
72
44
|
|
73
45
|
files:
|
46
|
+
- .gem.config
|
74
47
|
- .gitignore
|
75
48
|
- .noexec.yml
|
76
49
|
- .travis.yml
|
@@ -78,7 +51,6 @@ files:
|
|
78
51
|
- Gemfile
|
79
52
|
- LICENSE
|
80
53
|
- README.md
|
81
|
-
- Rakefile
|
82
54
|
- bin/ruby_noexec_wrapper
|
83
55
|
- bin/rubygems-bundler-uninstaller
|
84
56
|
- lib/rubygems-bundler/fix_wrapper.rb
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|