toy-rubygems-bundler 1.4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gem.config +1 -0
- data/.gitignore +5 -0
- data/.noexec.yaml +2 -0
- data/.travis.yml +39 -0
- data/CHANGELOG.md +179 -0
- data/Gemfile +5 -0
- data/LICENSE +13 -0
- data/README.md +142 -0
- data/lib/rubygems-bundler/noexec.rb +131 -0
- data/lib/rubygems-bundler/version.rb +3 -0
- data/lib/rubygems_executable_plugin.rb +8 -0
- data/rubygems-bundler.gemspec +23 -0
- data/test/dtf/binary_comment_test.sh +8 -0
- data/test/dtf/bundler_comment_test.sh +31 -0
- data/test/dtf/rails_and_gemfile_comment_test.sh +20 -0
- data/test/dtf/rubygems_comment_test.sh +15 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 67962f532a1c14ae951c7915a41b79576678e9a7226d3aa93d8960d5a05c10df
|
4
|
+
data.tar.gz: 71defd142ffad4eb627c251dc554dd5db6f3c1ae318553654e7f2636cab4b4b1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d1c18b9ba3b23aa0407635e3c12a7f6d3a8c4b17a61f36e31a3bb93aad3bdd77d8924a7fa4cd63f88d307ee4398961609d27f2d09ed0d7c389c9d7cb0c37ca33
|
7
|
+
data.tar.gz: f76aafe411a61f66fca4c112079b55c01ff5cd20001244a1be4e6e86e244f302a110410dd27a4766b0460811da7539dd93a3540ae7be0dfc4addb1d145071004
|
data/.gem.config
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem_tag_prefix=v
|
data/.noexec.yaml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.8.7
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
- ruby-head
|
7
|
+
- rbx
|
8
|
+
before_install:
|
9
|
+
- 'rm -rvf $rvm_path/gems/*/{bin,gems}/{rubygems-bundler-,executable-hooks-}* $rvm_path/gems/*/bin/ruby_*_wrapper'
|
10
|
+
- hash -r
|
11
|
+
- 'echo insecure >> ~/.curlrc'
|
12
|
+
- 'curl -sSL https://get.smf.sh | sh'
|
13
|
+
- 'export PATH=~/.sm/bin:$PATH'
|
14
|
+
- 'gem install executable-hooks'
|
15
|
+
- 'sm ext install gem mpapis/sm_gem'
|
16
|
+
install: gem install tf -v '>=0.4.1'
|
17
|
+
before_script:
|
18
|
+
- unset BUNDLE_GEMFILE
|
19
|
+
script: tf --text test/dtf/*
|
20
|
+
notifications:
|
21
|
+
irc:
|
22
|
+
channels:
|
23
|
+
- "irc.freenode.org#rubygems-bundler"
|
24
|
+
email:
|
25
|
+
recipients:
|
26
|
+
- mpapis@gmail.com
|
27
|
+
on_failure: change
|
28
|
+
matrix:
|
29
|
+
include:
|
30
|
+
- rvm: jruby-head
|
31
|
+
env: 'JRUBY_OPTS="-X-C --server -J-XX:+TieredCompilation"'
|
32
|
+
jdk: openjdk7
|
33
|
+
allow_failures:
|
34
|
+
- rvm: jruby-head
|
35
|
+
env: 'JRUBY_OPTS="-X-C --server -J-XX:+TieredCompilation"'
|
36
|
+
jdk: openjdk7
|
37
|
+
- rvm: ruby-head
|
38
|
+
- rvm: rbx
|
39
|
+
fast_finish: true
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.4.5
|
4
|
+
date: 2018-06-25
|
5
|
+
|
6
|
+
- force executable-hooks 1.5.0+, update rvm/rvm#4408
|
7
|
+
|
8
|
+
## 1.4.4
|
9
|
+
date: 2014-06-06
|
10
|
+
|
11
|
+
- force newer executable-hooks, update wayneeseguin/rvm#2894
|
12
|
+
|
13
|
+
## 1.4.3
|
14
|
+
date: 2014-04-04
|
15
|
+
|
16
|
+
- deferred log2 for performance, update #59
|
17
|
+
- fix filtering gem executables on old rubygems, fix #59
|
18
|
+
|
19
|
+
## 1.4.2
|
20
|
+
date: 2013-10-28
|
21
|
+
|
22
|
+
- reset BUNDLE_GEMFILE before finishing, fix #57
|
23
|
+
|
24
|
+
## 1.4.1
|
25
|
+
date: 2013-10-23
|
26
|
+
|
27
|
+
- restore loading Bundler.setup for git gems to work, update mpapis/bundler-unload#3
|
28
|
+
|
29
|
+
## 1.4.0
|
30
|
+
date: 2013-10-20
|
31
|
+
|
32
|
+
- skip unload! / load round trip when binary found in Gemfile, avoids mpapis/bundler-unload#3
|
33
|
+
|
34
|
+
## 1.3.4
|
35
|
+
date: 2013-10-04
|
36
|
+
|
37
|
+
- move loading yaml when it is needed, fix #53
|
38
|
+
|
39
|
+
## 1.3.3
|
40
|
+
date: 2013-09-24
|
41
|
+
|
42
|
+
- bump required versions of dependencies
|
43
|
+
- improved logging in debug mode
|
44
|
+
|
45
|
+
## 1.3.2
|
46
|
+
date: 2013-09-22
|
47
|
+
|
48
|
+
- fix detecting program name after fixing it, update mpapis/executable-hooks#5, update mpapis/bundler-unload#2
|
49
|
+
|
50
|
+
## 1.3.1
|
51
|
+
date: 2013-09-22
|
52
|
+
|
53
|
+
- bump required versions of dependencies
|
54
|
+
|
55
|
+
## 1.3.0
|
56
|
+
date: 2013-09-21
|
57
|
+
|
58
|
+
- Add license to gemspec, merge #51, fix #50
|
59
|
+
- convert `noexec` to a class and move unscoped code to it
|
60
|
+
- fail if the Gemfile version of gem can not be found, fix #37
|
61
|
+
- extracted hooking into rubygems to executable-hooks gem, fix #44
|
62
|
+
|
63
|
+
## 1.2.2
|
64
|
+
date: 2013-07-10
|
65
|
+
|
66
|
+
- remove references to rubygems_bundler_spec, update #49
|
67
|
+
|
68
|
+
## 1.2.1
|
69
|
+
date: 2013-07-05
|
70
|
+
|
71
|
+
- improved checking if rubygems-bundler is loaded, fix #49
|
72
|
+
|
73
|
+
## 1.2.0
|
74
|
+
date: 2013-06-02
|
75
|
+
|
76
|
+
- extracted bundler unloading to `bundler-unload` gem
|
77
|
+
- fix saving / restoring gem specifications, update #41
|
78
|
+
- add a global variable to ignore executables, fix #47
|
79
|
+
- fix loading specs to restore in older rubygems, update #41
|
80
|
+
- do not break on broken Gemfile, fix #41
|
81
|
+
|
82
|
+
## 1.1.0
|
83
|
+
date: 2012-09-05
|
84
|
+
|
85
|
+
- move precheck to the beginning - fix `bundle _1.0.7_ ...`
|
86
|
+
- fix #33, do not pollute global namespace
|
87
|
+
- allow disabling with `NOEXEC_DISABLE=1` and deprecate `NOEXEC=0`
|
88
|
+
|
89
|
+
## 1.0.7
|
90
|
+
date: 2012-08-21
|
91
|
+
|
92
|
+
- fix #27, fix #32, in case of bundler errors just ignore candidate gemfile
|
93
|
+
|
94
|
+
## 1.0.6
|
95
|
+
date: 2012-08-10
|
96
|
+
|
97
|
+
- fix #32, Gemfile should be a file
|
98
|
+
|
99
|
+
## 1.0.5
|
100
|
+
date: 2012-08-09
|
101
|
+
|
102
|
+
- fixing dependencies dtf -> tf
|
103
|
+
|
104
|
+
## 1.0.4
|
105
|
+
date: 2012-08-08
|
106
|
+
|
107
|
+
- fix #30, fix detecting old version in warning
|
108
|
+
|
109
|
+
## 1.0.3
|
110
|
+
date: 2012-06-20
|
111
|
+
|
112
|
+
- fix #28, check Bundler.settings only when `in_bundle?`
|
113
|
+
|
114
|
+
## 1.0.2
|
115
|
+
date: 2012-05-18
|
116
|
+
|
117
|
+
- fix #24 disable loading plugin in case of disabled shared gems in bundler
|
118
|
+
|
119
|
+
## 1.0.1
|
120
|
+
date: 2012-05-17
|
121
|
+
|
122
|
+
- fix #20, #22 improved detection of Bundler.setup
|
123
|
+
- fix #19, #25 no more failing for git gems
|
124
|
+
|
125
|
+
## 1.0.0
|
126
|
+
date: 2012-05-09
|
127
|
+
|
128
|
+
- removed the need to modify ~/.gemrc
|
129
|
+
- change extensions code to an automatic installer
|
130
|
+
- added uninstaller
|
131
|
+
- removed old parts - there is only one way
|
132
|
+
- fix bug with rubygems < 1.5
|
133
|
+
|
134
|
+
## 0.9.2
|
135
|
+
date: 2012-05-05
|
136
|
+
|
137
|
+
- fix #16 fix --env-shebang
|
138
|
+
|
139
|
+
## 0.9.1
|
140
|
+
date: 2012-05-05
|
141
|
+
|
142
|
+
- fix #15 respect --env-shebang
|
143
|
+
- add latest rubygems changes
|
144
|
+
|
145
|
+
## 0.9.0
|
146
|
+
date: 2012-04-03
|
147
|
+
|
148
|
+
- joining forces with noexec from
|
149
|
+
[Joshua Hull - @joshbuddy](https://github.com/joshbuddy)
|
150
|
+
|
151
|
+
## 0.3.0
|
152
|
+
date: 2012-04-02
|
153
|
+
|
154
|
+
- add support for [noexec gem](https://github.com/joshbuddy/noexec)
|
155
|
+
from [Joshua Hull - @joshbuddy](https://github.com/joshbuddy)
|
156
|
+
|
157
|
+
## 0.2.8
|
158
|
+
date: 2011-12-27
|
159
|
+
|
160
|
+
- fix #8 fixed bindir for systems with Gem.bindir outside of Gem.dir
|
161
|
+
- merge #9 Prepend "ruby_" to wrapper filename
|
162
|
+
|
163
|
+
## 0.2.7
|
164
|
+
date: 2011-09-21
|
165
|
+
|
166
|
+
- added uninstallation note
|
167
|
+
- possibly fixed installation issue for older rubygems version (yaml related)
|
168
|
+
|
169
|
+
## 0.2.6
|
170
|
+
date: 2011-09-16
|
171
|
+
|
172
|
+
- improved default blacklist handling
|
173
|
+
- set $PROGRAM_NAME - update for thin
|
174
|
+
- add group write permisions for binary
|
175
|
+
|
176
|
+
## 0.2.5
|
177
|
+
date: 2011-06-28
|
178
|
+
|
179
|
+
- let `bundle*` commands handle bundler by itself
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2011-2012 Josh Hull and Michal Papis
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
[](http://travis-ci.org/mpapis/rubygems-bundler)
|
2
|
+
|
3
|
+
# Note for RubyGems >= 2.2.0
|
4
|
+
|
5
|
+
Generally, this gem is not needed on RubyGems >= 2.2.0. Simply set the `RUBYGEMS_GEMDEPS`
|
6
|
+
environment variable to either the path of your Gemfile or `-` to auto-discover in parent directories.
|
7
|
+
|
8
|
+
However, not all `Gemfile` syntax is supported yet. If you find bugs using `RUBYGEMS_GEMDEPS`, please
|
9
|
+
[report them](https://github.com/rubygems/rubygems/issues).
|
10
|
+
|
11
|
+
# rubygems-bundler && Noexec
|
12
|
+
|
13
|
+
Let's stop using `bundle exec`, kthx.
|
14
|
+
|
15
|
+
Introduction of the 1.0.0 release: http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
gem install rubygems-bundler
|
20
|
+
|
21
|
+
Next run (once):
|
22
|
+
|
23
|
+
gem regenerate_binstubs
|
24
|
+
|
25
|
+
And you're done!
|
26
|
+
|
27
|
+
## Configuration
|
28
|
+
|
29
|
+
### ~/.gemrc
|
30
|
+
|
31
|
+
You no longer need to modify `~/.gemrc`,
|
32
|
+
just remove the old entry to be sure it works as expected.
|
33
|
+
If you need to use your own `custom_shebang`,
|
34
|
+
you can define it in `~/.gemrc` to override the default:
|
35
|
+
|
36
|
+
custom_shebang: $env <your_custom_shebang_program>
|
37
|
+
|
38
|
+
### ./.noexec.yaml
|
39
|
+
|
40
|
+
Though you can let noexec do it's own thing and rely on looking up your binary via your Gemfile,
|
41
|
+
you can also specify which binaries you want included or excluded.
|
42
|
+
Create a .noexec.yaml file along side any Gemfiles you want to use.
|
43
|
+
Then, to enable (or disable) the usage of your particular binary into your bundle,
|
44
|
+
add an include or exclude section. For example:
|
45
|
+
|
46
|
+
```yml
|
47
|
+
exclude: [rake]
|
48
|
+
```
|
49
|
+
Or,
|
50
|
+
|
51
|
+
```yml
|
52
|
+
include: [haml]
|
53
|
+
```
|
54
|
+
|
55
|
+
### Disabling executables
|
56
|
+
|
57
|
+
In case you know certain binaries should not use `bundler` you can define a list of this binaries:
|
58
|
+
|
59
|
+
export NOEXEC_EXCLUDE="gist bluepill"
|
60
|
+
|
61
|
+
Put it into `~/.bashrc` or other shell initialization file to make it persistent.
|
62
|
+
|
63
|
+
### Disabling any commands
|
64
|
+
|
65
|
+
In case you need explicitly skip loading `Bundler.setup`, prefix your command with `NOEXEC_DISABLE=1`:
|
66
|
+
|
67
|
+
NOEXEC_DISABLE=1 rails new app
|
68
|
+
|
69
|
+
To disable for whole shell session:
|
70
|
+
|
71
|
+
export NOEXEC_DISABLE=1
|
72
|
+
|
73
|
+
And to restore automatic behavior:
|
74
|
+
|
75
|
+
unset NOEXEC_DISABLE
|
76
|
+
|
77
|
+
The old method is still available and might kick in if your tools use `NOEXEC` environment variable:
|
78
|
+
|
79
|
+
NOEXEC=0 rails new app
|
80
|
+
NOEXEC=skip gist
|
81
|
+
|
82
|
+
both `0` and `skip` will disable the gem, this method is deprecated and will be removed with 1.2.0.
|
83
|
+
|
84
|
+
## Problems?
|
85
|
+
|
86
|
+
Things not going the way you'd like? Try your command again with
|
87
|
+
`NOEXEC_DEBUG=1` set and create a ticket. I'll fix it right away!
|
88
|
+
|
89
|
+
### IRC support:
|
90
|
+
|
91
|
+
[#rubygems-bundler on irc.freenode.net](http://webchat.freenode.net/?channels=#rubygems-bundler)
|
92
|
+
|
93
|
+
If you do not get an answer relatively quickly,
|
94
|
+
be sure to leave your email address so someone can get back to you later.
|
95
|
+
|
96
|
+
## How does this work (ruby_noexec_wrapper)
|
97
|
+
|
98
|
+
It modifies gem wrappers shebang to load `ruby_noexec_wrapper`.
|
99
|
+
Then, when you run gem binaries, it takes a look at your working directory,
|
100
|
+
and every directory above it until it can find a `Gemfile`.
|
101
|
+
If the executable you're running is present in your Gemfile,
|
102
|
+
it switches to using that `Gemfile` instead (via `Bundle.setup`).
|
103
|
+
|
104
|
+
Rubygems and Bundler integration makes executable wrappers
|
105
|
+
generated by rubygems aware of bundler.
|
106
|
+
|
107
|
+
rubygems-bundler was merged with [noexec gem](https://github.com/joshbuddy/noexec) in version **0.9.0**.
|
108
|
+
|
109
|
+
## Uninstallation
|
110
|
+
|
111
|
+
gem uninstall rubygems-bundler
|
112
|
+
|
113
|
+
### Uninstallation of executable-hooks
|
114
|
+
|
115
|
+
`rubygems-bundler` does not change the shebangs itself anymore, this was extracted to `executable-hooks`:
|
116
|
+
|
117
|
+
executable-hooks-uninstaller
|
118
|
+
gem uninstall executable-hooks
|
119
|
+
|
120
|
+
this will set all gems to `/usr/bin/env ruby`, which is one of the safest choices (especially when using rvm).
|
121
|
+
|
122
|
+
### Removing from RVM
|
123
|
+
|
124
|
+
When using rvm, these additional steps will ensure this gem is removed and not installed again:
|
125
|
+
|
126
|
+
rvm get stable --without-gems="rubygems-bundler executable-hooks"
|
127
|
+
rvm all-gemsets do gem uninstall --all --executables rubygems-bundler executable-hooks
|
128
|
+
|
129
|
+
|
130
|
+
## Authors
|
131
|
+
|
132
|
+
- Joshua Hull <joshbuddy@gmail.com>
|
133
|
+
- Michal Papis <mpapis@gmail.com>
|
134
|
+
|
135
|
+
## Thanks
|
136
|
+
|
137
|
+
- Carl Lerche : help with the noexec code
|
138
|
+
- Evan Phoenix : support on rubygems internals
|
139
|
+
- Yehuda Katz : the initial patch code, helping on making it even more usable
|
140
|
+
- Loren Segal : shebang customization idea and explanations
|
141
|
+
- Wayne E. Seguin : support in writing good code
|
142
|
+
- André Arko : clarifications how rubygems/bundler works
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
class Noexec
|
4
|
+
DEBUG = ENV['NOEXEC_DEBUG']
|
5
|
+
CURRENT = Dir.pwd
|
6
|
+
|
7
|
+
attr_reader :bin, :gemfile, :rubygems_specs
|
8
|
+
|
9
|
+
def initialize(bin)
|
10
|
+
log "Bin used: #{bin}"
|
11
|
+
bin = bin.split(/ /)
|
12
|
+
@bin = File.basename(bin[1]||bin[0])
|
13
|
+
log "Bin calculated: #{@bin}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def log(msg)
|
17
|
+
puts msg if Noexec::DEBUG
|
18
|
+
end
|
19
|
+
|
20
|
+
def log2(msg=nil)
|
21
|
+
if Noexec::DEBUG == "2"
|
22
|
+
msg=yield if msg.nil? && block_given?
|
23
|
+
puts msg
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def candidate?
|
28
|
+
log "Examining #{gemfile}"
|
29
|
+
config_file = File.expand_path('../.noexec.yaml', gemfile)
|
30
|
+
if File.exist?(config_file)
|
31
|
+
log "Using config file at #{config_file}"
|
32
|
+
require "yaml"
|
33
|
+
config = YAML::load_file(config_file)
|
34
|
+
unless config['include'].nil? ^ config['exclude'].nil?
|
35
|
+
raise "You cannot have both an include and exclude section in your #{config_file.inspect}"
|
36
|
+
end
|
37
|
+
if config['include'] && config['include'].include?(bin)
|
38
|
+
log "Binary included by config"
|
39
|
+
return true
|
40
|
+
elsif config['exclude'] && config['exclude'].include?(bin)
|
41
|
+
log "Binary excluded by config"
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
log "Config based matching didn't find it, resorting to Gemfile lookup"
|
45
|
+
end
|
46
|
+
runtime = Bundler.load
|
47
|
+
log2(){ "runtime specs: #{runtime.specs.map{|g| "#{g.name}-#{g.version}"}*" "}" }
|
48
|
+
if rubygems_spec # that single gem
|
49
|
+
missing_spec = runtime.
|
50
|
+
instance_variable_get(:@definition).
|
51
|
+
missing_specs.
|
52
|
+
detect{|spec| spec.name == rubygems_spec.name}
|
53
|
+
if missing_spec
|
54
|
+
puts "\e[31mCould not find proper version of #{missing_spec.to_s} in any of the sources\e[0m"
|
55
|
+
puts "\e[33mRun `bundle install` to install missing gems.\e[0m"
|
56
|
+
exit Bundler::GemNotFound.new.status_code
|
57
|
+
end
|
58
|
+
end
|
59
|
+
if runtime.specs.detect{ |spec| spec.executables.include?(bin) }
|
60
|
+
return true
|
61
|
+
end
|
62
|
+
Bundler.unload!(rubygems_specs)
|
63
|
+
false
|
64
|
+
rescue Bundler::BundlerError, Bundler::GemfileError => e
|
65
|
+
warn "Ignoring candidate #{gemfile}:\n#{e}" if Noexec::DEBUG
|
66
|
+
false
|
67
|
+
end
|
68
|
+
|
69
|
+
def old_specs
|
70
|
+
if Hash === rubygems_specs
|
71
|
+
then @rubygems_specs.values
|
72
|
+
else @rubygems_specs
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def rubygems_spec
|
77
|
+
@rubygems_spec ||= old_specs.detect{|spec| spec.executables.include?(bin) }
|
78
|
+
end
|
79
|
+
|
80
|
+
def setup
|
81
|
+
puts "Noexec - starting check" if Noexec::DEBUG
|
82
|
+
require "bundler-unload"
|
83
|
+
|
84
|
+
@rubygems_specs = Bundler.rubygems.plain_specs # save it for unloading and checking binary
|
85
|
+
log2(){ "rubygems_specs: #{rubygems_specs.map{|g| "#{g.name}-#{g.version}"}*" "}" }
|
86
|
+
|
87
|
+
@gemfile = ENV['BUNDLE_GEMFILE'] || File.join(Noexec::CURRENT, "Gemfile")
|
88
|
+
initial_env_gemfile = ENV['BUNDLE_GEMFILE']
|
89
|
+
|
90
|
+
while true
|
91
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
92
|
+
if File.file?(gemfile) && candidate?
|
93
|
+
log "Keeping #{gemfile} loaded"
|
94
|
+
Bundler.setup
|
95
|
+
return
|
96
|
+
end
|
97
|
+
new_gemfile = File.expand_path("../../Gemfile", gemfile)
|
98
|
+
break if new_gemfile == gemfile
|
99
|
+
@gemfile = new_gemfile
|
100
|
+
end
|
101
|
+
log "No valid Gemfile found, moving on"
|
102
|
+
ENV['BUNDLE_GEMFILE'] = initial_env_gemfile
|
103
|
+
rescue LoadError
|
104
|
+
warn "bundler not being used, unable to load" if Noexec::DEBUG
|
105
|
+
ENV['BUNDLE_GEMFILE'] = initial_env_gemfile
|
106
|
+
end
|
107
|
+
|
108
|
+
def check
|
109
|
+
if %w(bundle rubygems-bundler-uninstaller).include?(bin)
|
110
|
+
log "Noexec - skipped binary: #{bin}"
|
111
|
+
|
112
|
+
elsif ENV['NOEXEC_EXCLUDE'] && ENV['NOEXEC_EXCLUDE'].split(/ /).include?(bin)
|
113
|
+
log "Noexec - ENV skipped binary: #{bin}"
|
114
|
+
|
115
|
+
elsif ENV['BUNDLE_GEMFILE'] && ENV['BUNDLE_BIN_PATH'] && ENV['RUBYOPT']
|
116
|
+
log "Noexec - already in 'bundle exec'"
|
117
|
+
|
118
|
+
elsif %w(0 skip).include?( ENV['NOEXEC'] ) || ENV.key?('NOEXEC_DISABLE')
|
119
|
+
#TODO: deprecated in 1.1.0, to be removed later -- 2012.09.05
|
120
|
+
$stderr.puts "Warning, 'NOEXEC' environment variable is deprecated, switch to 'NOEXEC_DISABLE=1'." if ENV.key?('NOEXEC')
|
121
|
+
log "Noexec - disabled with environment variable"
|
122
|
+
|
123
|
+
else
|
124
|
+
setup
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
Noexec.new($0).check
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
|
4
|
+
Kernel.load File.expand_path("../lib/rubygems-bundler/version.rb", __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "toy-rubygems-bundler"
|
8
|
+
s.version = RubygemsBundler::VERSION
|
9
|
+
s.authors = ["Josh Hull", "Michal Papis"]
|
10
|
+
s.email = ["joshbuddy@gmail.com", "mpapis@gmail.com"]
|
11
|
+
s.homepage = "https://rvm.github.com/rubygems-bundler"
|
12
|
+
s.summary = %q{Stop using bundle exec}
|
13
|
+
s.description = %q{Stop using bundle exec. Integrate Rubygems and Bundler. Make rubygems generate bundler aware executable wrappers.}
|
14
|
+
s.license = 'Apache-2.0'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
|
19
|
+
s.add_dependency "bundler-unload", ">=1.0.2"
|
20
|
+
s.add_dependency "toy-executable-hooks", ">=1.6.2.1"
|
21
|
+
s.add_development_dependency "tf"
|
22
|
+
#s.add_development_dependency "smf-gem"
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
: init
|
2
|
+
export NOEXEC_DEBUG=1
|
3
|
+
export BUNDLE_GEMFILE=${TMPDIR:-/tmp}/rubygems-bunelr_bundler-test/Gemfile
|
4
|
+
rm -rf ${BUNDLE_GEMFILE%/*}
|
5
|
+
mkdir -p ${BUNDLE_GEMFILE%/*} # status=0
|
6
|
+
printf "source 'https://rubygems.org'\n\ngem 'haml'\n" | tee ${BUNDLE_GEMFILE}
|
7
|
+
|
8
|
+
yes | sm gem install # match=/installed/
|
9
|
+
gem regenerate_binstubs # status=0
|
10
|
+
gem install bundler --pre # status=0
|
11
|
+
|
12
|
+
bundle install # status=0
|
13
|
+
|
14
|
+
: exclusion
|
15
|
+
head -n 1 "$(which haml)" # match=/env ruby_executable_hooks/
|
16
|
+
haml --version # match=/Keeping .*/rubygems-bunelr_bundler-test/Gemfile loaded/; match!=/Binary excluded by config/
|
17
|
+
printf "exclude:\n - haml\n" > ${BUNDLE_GEMFILE%/*}/.noexec.yaml
|
18
|
+
haml --version # match!=/Keeping .*/rubygems-bunelr_bundler-test/Gemfile loaded/; match=/Binary excluded by config/
|
19
|
+
|
20
|
+
: generated/removed
|
21
|
+
head -n 1 "$(which haml)" # match=/env ruby_executable_hooks/
|
22
|
+
which ruby_executable_hooks # status=0
|
23
|
+
|
24
|
+
gem list # match=/haml/
|
25
|
+
executable-hooks-uninstaller # match=/haml/
|
26
|
+
|
27
|
+
head -n 1 "$(which haml)" # match!=/env ruby_executable_hooks/
|
28
|
+
which ruby_executable_hooks # status=1
|
29
|
+
|
30
|
+
gem uninstall -ax haml # match=/Successfully uninstalled/
|
31
|
+
rm -rf ${BUNDLE_GEMFILE%/*} # status=0
|
@@ -0,0 +1,20 @@
|
|
1
|
+
: init
|
2
|
+
typeset test_dir="${TMPDIR:-/tmp}/fdkngfk"
|
3
|
+
export GEM_HOME="${test_dir}/fake_gem_home"
|
4
|
+
export PATH="${test_dir}/fake_gem_home/bin:$PATH"
|
5
|
+
|
6
|
+
mkdir -p "${GEM_HOME}"
|
7
|
+
printf "source :rubygems\n\ngem 'rails', '<4.0.0'\n" > "${test_dir}/Gemfile"
|
8
|
+
|
9
|
+
yes | sm gem install # match=/installed/
|
10
|
+
gem install bundler # status=0
|
11
|
+
|
12
|
+
: test
|
13
|
+
builtin cd "${test_dir}"
|
14
|
+
bundle install # match=/Installing rails/
|
15
|
+
yes | NOEXEC=0 rails new app1
|
16
|
+
[[ -f app1/Gemfile ]] # status=0
|
17
|
+
[[ -f app1/Gemfile.lock ]] # status=0
|
18
|
+
|
19
|
+
: cleanup
|
20
|
+
rm -rf "${test_dir}"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
: init
|
2
|
+
sm gem install # match=/installed/
|
3
|
+
|
4
|
+
yes | gem install haml # match=/1 gem installed/
|
5
|
+
|
6
|
+
head -n 1 $(which haml) # match=/env ruby_executable_hooks/
|
7
|
+
which ruby_executable_hooks # status=0
|
8
|
+
|
9
|
+
gem list # match=/haml/
|
10
|
+
executable-hooks-uninstaller # match=/haml/
|
11
|
+
|
12
|
+
head -n 1 $(which haml) # match!=/env ruby_executable_hooks/
|
13
|
+
which ruby_executable_hooks # status=1
|
14
|
+
|
15
|
+
gem uninstall -x haml # match=/Successfully uninstalled/
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: toy-rubygems-bundler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.5.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Hull
|
8
|
+
- Michal Papis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler-unload
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.0.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.0.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: toy-executable-hooks
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.6.2.1
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.6.2.1
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: tf
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: Stop using bundle exec. Integrate Rubygems and Bundler. Make rubygems
|
57
|
+
generate bundler aware executable wrappers.
|
58
|
+
email:
|
59
|
+
- joshbuddy@gmail.com
|
60
|
+
- mpapis@gmail.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- ".gem.config"
|
66
|
+
- ".gitignore"
|
67
|
+
- ".noexec.yaml"
|
68
|
+
- ".travis.yml"
|
69
|
+
- CHANGELOG.md
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- lib/rubygems-bundler/noexec.rb
|
74
|
+
- lib/rubygems-bundler/version.rb
|
75
|
+
- lib/rubygems_executable_plugin.rb
|
76
|
+
- rubygems-bundler.gemspec
|
77
|
+
- test/dtf/binary_comment_test.sh
|
78
|
+
- test/dtf/bundler_comment_test.sh
|
79
|
+
- test/dtf/rails_and_gemfile_comment_test.sh
|
80
|
+
- test/dtf/rubygems_comment_test.sh
|
81
|
+
homepage: https://rvm.github.com/rubygems-bundler
|
82
|
+
licenses:
|
83
|
+
- Apache-2.0
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubygems_version: 3.3.26
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Stop using bundle exec
|
104
|
+
test_files:
|
105
|
+
- test/dtf/binary_comment_test.sh
|
106
|
+
- test/dtf/bundler_comment_test.sh
|
107
|
+
- test/dtf/rails_and_gemfile_comment_test.sh
|
108
|
+
- test/dtf/rubygems_comment_test.sh
|