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.
@@ -0,0 +1 @@
1
+ gem_tag_prefix=v
@@ -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
- ### NOEXEC=skip
48
+ ### Disabling
49
49
 
50
- In case you need explicitly skip loading Bundler.setup, prefix your command with `NOEXEC=0`:
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 work, choose the one that sounds better for you.
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
- DEBUG = ENV.key?('NOEXEC_DEBUG')
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
- begin
4
- require "rubygems"
5
- require "bundler"
16
+ else
17
+ begin
18
+ puts "Noexec - starting check" if RubygemsBundler::DEBUG
19
+ require "rubygems"
20
+ require "bundler"
6
21
 
7
- module Bundler
8
- class << self
9
- def reset!
10
- @load = nil
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
- module Noexec
16
- CURRENT = Dir.pwd
30
+ module Noexec
31
+ RubygemsBundler::CURRENT = Dir.pwd
17
32
 
18
- extend self
33
+ extend self
19
34
 
20
- def log(msg)
21
- puts msg if DEBUG
22
- end
35
+ def log(msg)
36
+ puts msg if RubygemsBundler::DEBUG
37
+ end
23
38
 
24
- def candidate?(gemfile, bin)
25
- config_file = File.expand_path('../.noexec.yaml', gemfile)
26
- log "Considering #{config_file.inspect}"
27
- if File.exist?(config_file)
28
- log "Using config file at #{config_file}"
29
- config = YAML::load_file(config_file)
30
- raise "You cannot have both an include and exclude section in your #{config_file.inspect}" unless config['include'].nil? ^ config['exclude'].nil?
31
- if config['include'] && config['include'].include?(bin)
32
- log "Binary included by config"
33
- return true
34
- elsif config['exclude'] && config['exclude'].include?(bin)
35
- log "Binary excluded by config"
36
- return false
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
- log "Config based matching didn't find it, resorting to Gemfile lookup"
39
- end
40
- ENV['BUNDLE_GEMFILE'] = gemfile
41
- Bundler.load.specs.each do |spec|
42
- next if spec.name == 'bundler'
43
- return true if %w(ruby irb).include?(bin) || spec.executables.include?(bin)
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
- def setup
55
- log "Noexec"
56
- return if %w(bundle rubygems-bundler-uninstaller).include?(File.basename($0))
57
- return if ENV['BUNDLE_GEMFILE'] && ENV['BUNDLE_BIN_PATH'] && ENV['RUBYOPT']
58
- return if %w(0 skip).include?( ENV['NOEXEC'] )
59
- gemfile = ENV['BUNDLE_GEMFILE'] || File.join(CURRENT, "Gemfile")
60
- while true
61
- if File.file?(gemfile)
62
- log "Examining #{gemfile}"
63
- if Noexec.candidate?(gemfile, File.basename($0))
64
- log "Using #{gemfile}"
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
- new_gemfile = File.expand_path("../../Gemfile", gemfile)
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
- Noexec.setup
79
- rescue LoadError
80
- warn "bundler not being used, unable to load" if DEBUG
89
+ Noexec.setup
90
+ rescue LoadError
91
+ warn "bundler not being used, unable to load" if RubygemsBundler::DEBUG
92
+ end
81
93
  end
@@ -1,3 +1,3 @@
1
1
  module RubygemsBundler
2
- VERSION = "1.0.7"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- encoding: utf-8 -*-
3
- $:.push File.expand_path("../lib", __FILE__)
4
- require "rubygems-bundler/version"
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
- # Do we have to depend on those two ? Can we have two simple tasks doing the same ?
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: 25
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 7
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-08-21 00:00:00 Z
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"