rubygems-bundler 1.2.2 → 1.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubygems-bundler/version.rb +1 -1
- data/lib/rubygems_executable_plugin.rb +8 -0
- data/rubygems-bundler.gemspec +1 -1
- metadata +37 -23
- data/bin/ruby_noexec_wrapper +0 -14
- data/bin/rubygems-bundler-uninstaller +0 -5
- data/lib/rubygems-bundler/fix_wrapper.rb +0 -14
- data/lib/rubygems-bundler/regenerate_binstubs_command.rb +0 -70
- data/lib/rubygems-bundler/rubygems_bundler_installer.rb +0 -95
- data/lib/rubygems-bundler/uninstaller.rb +0 -10
- data/lib/rubygems-bundler/wrapper.rb +0 -38
- data/lib/rubygems_plugin.rb +0 -52
data/rubygems-bundler.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
s.executables = %w( rubygems-bundler-uninstaller )
|
18
17
|
|
19
18
|
s.add_dependency "bundler-unload", ">=1.0.1"
|
19
|
+
s.add_dependency "executable-hooks", ">=1.1.0"
|
20
20
|
s.add_development_dependency "tf"
|
21
21
|
#s.add_development_dependency "smf-gem"
|
22
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -1228271734
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
- rc1
|
11
|
+
version: 1.3.0.rc1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Josh Hull
|
@@ -16,7 +17,8 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2013-07-
|
20
|
+
date: 2013-07-11 00:00:00 +02:00
|
21
|
+
default_executable:
|
20
22
|
dependencies:
|
21
23
|
- !ruby/object:Gem::Dependency
|
22
24
|
name: bundler-unload
|
@@ -35,9 +37,25 @@ dependencies:
|
|
35
37
|
type: :runtime
|
36
38
|
version_requirements: *id001
|
37
39
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
40
|
+
name: executable-hooks
|
39
41
|
prerelease: false
|
40
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 19
|
48
|
+
segments:
|
49
|
+
- 1
|
50
|
+
- 1
|
51
|
+
- 0
|
52
|
+
version: 1.1.0
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tf
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
59
|
none: false
|
42
60
|
requirements:
|
43
61
|
- - ">="
|
@@ -47,13 +65,13 @@ dependencies:
|
|
47
65
|
- 0
|
48
66
|
version: "0"
|
49
67
|
type: :development
|
50
|
-
version_requirements: *
|
68
|
+
version_requirements: *id003
|
51
69
|
description: Stop using bundle exec. Integrate Rubygems and Bundler. Make rubygems generate bundler aware executable wrappers.
|
52
70
|
email:
|
53
71
|
- joshbuddy@gmail.com
|
54
72
|
- mpapis@gmail.com
|
55
|
-
executables:
|
56
|
-
|
73
|
+
executables: []
|
74
|
+
|
57
75
|
extensions: []
|
58
76
|
|
59
77
|
extra_rdoc_files: []
|
@@ -67,20 +85,14 @@ files:
|
|
67
85
|
- Gemfile
|
68
86
|
- LICENSE
|
69
87
|
- README.md
|
70
|
-
- bin/ruby_noexec_wrapper
|
71
|
-
- bin/rubygems-bundler-uninstaller
|
72
|
-
- lib/rubygems-bundler/fix_wrapper.rb
|
73
88
|
- lib/rubygems-bundler/noexec.rb
|
74
|
-
- lib/rubygems-bundler/regenerate_binstubs_command.rb
|
75
|
-
- lib/rubygems-bundler/rubygems_bundler_installer.rb
|
76
|
-
- lib/rubygems-bundler/uninstaller.rb
|
77
89
|
- lib/rubygems-bundler/version.rb
|
78
|
-
- lib/
|
79
|
-
- lib/rubygems_plugin.rb
|
90
|
+
- lib/rubygems_executable_plugin.rb
|
80
91
|
- rubygems-bundler.gemspec
|
81
92
|
- test/dtf/bundler_comment_test.sh
|
82
93
|
- test/dtf/rails_and_gemfile_comment_test.sh
|
83
94
|
- test/dtf/rubygems_comment_test.sh
|
95
|
+
has_rdoc: true
|
84
96
|
homepage: http://mpapis.github.com/rubygems-bundler
|
85
97
|
licenses: []
|
86
98
|
|
@@ -101,16 +113,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
114
|
none: false
|
103
115
|
requirements:
|
104
|
-
- - "
|
116
|
+
- - ">"
|
105
117
|
- !ruby/object:Gem::Version
|
106
|
-
hash:
|
118
|
+
hash: 25
|
107
119
|
segments:
|
108
|
-
-
|
109
|
-
|
120
|
+
- 1
|
121
|
+
- 3
|
122
|
+
- 1
|
123
|
+
version: 1.3.1
|
110
124
|
requirements: []
|
111
125
|
|
112
126
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.3.7
|
114
128
|
signing_key:
|
115
129
|
specification_version: 3
|
116
130
|
summary: Stop using bundle exec
|
data/bin/ruby_noexec_wrapper
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
original_file=ARGV[0]
|
4
|
-
ARGV.shift
|
5
|
-
$PROGRAM_NAME=original_file
|
6
|
-
|
7
|
-
require 'rubygems'
|
8
|
-
begin
|
9
|
-
require 'rubygems-bundler/noexec'
|
10
|
-
rescue LoadError
|
11
|
-
warn "unable to load rubygems-bundler/noexec" if ENV.key?('NOEXEC_DEBUG')
|
12
|
-
end
|
13
|
-
|
14
|
-
eval File.read(original_file), binding, original_file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
msg = "\n\nOlder rubygems-bundler found, please uninstall it with:\n\n "
|
2
|
-
|
3
|
-
here = Regexp.new(__FILE__)
|
4
|
-
error_source = caller.to_a.reject{|s| s=~ here }.find{|s| s=~/\/rubygems-bundler-/ }.first
|
5
|
-
gem_source = File.expand_path("../../../..", error_source)
|
6
|
-
gem_version = error_source.sub(/^.*\/rubygems-bundler-([^\/]+)\/.*$/,'\1')
|
7
|
-
|
8
|
-
if ENV['GEM_HOME'] or ENV['GEM_PATH']
|
9
|
-
msg << "GEM_HOME=\"#{gem_source}\" " unless ENV['GEM_HOME'] == gem_source
|
10
|
-
end
|
11
|
-
|
12
|
-
msg << "gem uninstall -ax rubygems-bundler -v #{gem_version}\n\n"
|
13
|
-
|
14
|
-
raise msg
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'rubygems/command_manager'
|
2
|
-
require 'rubygems/installer'
|
3
|
-
require 'rubygems/version'
|
4
|
-
require 'rubygems-bundler/wrapper'
|
5
|
-
|
6
|
-
class RegenerateBinstubsCommand < Gem::Command
|
7
|
-
def initialize
|
8
|
-
super 'regenerate_binstubs', 'Re run generation of executable wrappers for gems.'
|
9
|
-
end
|
10
|
-
|
11
|
-
def arguments # :nodoc:
|
12
|
-
"STRING start of gem name to regenerate binstubs"
|
13
|
-
end
|
14
|
-
|
15
|
-
def usage # :nodoc:
|
16
|
-
"#{program_name} [STRING]"
|
17
|
-
end
|
18
|
-
|
19
|
-
def defaults_str # :nodoc:
|
20
|
-
""
|
21
|
-
end
|
22
|
-
|
23
|
-
def description # :nodoc:
|
24
|
-
'Re run generation of executable wrappers for all gems. '+
|
25
|
-
'Wrappers will be compatible with both rubygems and bundler. '+
|
26
|
-
'The switcher is BUNDLE_GEMFILE environment variable, '+
|
27
|
-
'when set it switches to bundler mode, when not set, '+
|
28
|
-
'then the command will work as it was with pure rubygems.'
|
29
|
-
end
|
30
|
-
|
31
|
-
def execute
|
32
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('2.0.0') then
|
33
|
-
# https://github.com/rubygems/rubygems/issues/326
|
34
|
-
puts "try also: gem pristine --binstubs"
|
35
|
-
end
|
36
|
-
Gem.configuration[:custom_shebang] ||= '$env ruby_noexec_wrapper'
|
37
|
-
RubygemsBundler::Wrapper.install
|
38
|
-
execute_no_wrapper
|
39
|
-
end
|
40
|
-
|
41
|
-
def execute_no_wrapper
|
42
|
-
require 'rubygems-bundler/rubygems_bundler_installer'
|
43
|
-
name = get_one_optional_argument || ''
|
44
|
-
specs = installed_gems.select{|spec| spec.name =~ /^#{name}/i }
|
45
|
-
specs.each do |spec|
|
46
|
-
unless spec.executables.empty?
|
47
|
-
org_gem_path = Gem.path.find{|path|
|
48
|
-
File.exists? File.join path, 'gems', spec.full_name
|
49
|
-
} || Gem.dir
|
50
|
-
cache_gem = File.join(org_gem_path, 'cache', spec.file_name)
|
51
|
-
if File.exist? cache_gem
|
52
|
-
puts "#{spec.name} #{spec.version}"
|
53
|
-
inst = Gem::Installer.new Dir[cache_gem].first, :wrappers => true, :force => true, :install_dir => org_gem_path
|
54
|
-
RubyGemsBundlerInstaller.bundler_generate_bin(inst)
|
55
|
-
else
|
56
|
-
puts "##{spec.name} #{spec.version} not found in GEM_PATH"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
def installed_gems
|
64
|
-
if Gem::VERSION > '1.8' then
|
65
|
-
Gem::Specification.to_a
|
66
|
-
else
|
67
|
-
Gem.source_index.map{|name,spec| spec}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module RubyGemsBundlerInstaller
|
2
|
-
# Iterate through executables and generate wrapper for each one,
|
3
|
-
# extract of rubygems code
|
4
|
-
def self.bundler_generate_bin(inst)
|
5
|
-
return if inst.spec.executables.nil? or inst.spec.executables.empty?
|
6
|
-
bindir = inst.bin_dir ? inst.bin_dir : Gem.bindir(inst.gem_home)
|
7
|
-
inst.spec.executables.each do |filename|
|
8
|
-
filename.untaint
|
9
|
-
original = File.join bindir, filename
|
10
|
-
if File.exists?( original )
|
11
|
-
bin_script_path = File.join bindir, inst.formatted_program_filename(filename)
|
12
|
-
FileUtils.rm_f bin_script_path
|
13
|
-
File.open bin_script_path, 'wb', 0755 do |file|
|
14
|
-
file.print bundler_app_script_text(inst, filename)
|
15
|
-
end
|
16
|
-
inst.say bin_script_path if Gem.configuration.really_verbose
|
17
|
-
else
|
18
|
-
inst.say "Can not find #{inst.spec.name} in GEM_PATH"
|
19
|
-
break
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
def self.shebang(inst, bin_file_name)
|
26
|
-
# options were defined first in 1.5, we want to support back to 1.3.7
|
27
|
-
ruby_name = Gem::ConfigMap[:ruby_install_name] if inst.instance_variable_get(:@env_shebang)
|
28
|
-
bindir = inst.bin_dir ? inst.bin_dir : Gem.bindir(inst.gem_home)
|
29
|
-
path = File.join bindir, inst.formatted_program_filename(bin_file_name)
|
30
|
-
first_line = File.open(path, "rb") {|file| file.gets}
|
31
|
-
|
32
|
-
if /\A#!/ =~ first_line then
|
33
|
-
# Preserve extra words on shebang line, like "-w". Thanks RPA.
|
34
|
-
shebang = first_line.sub(/\A\#!.*?ruby\S*((\s+\S+)+)/, "#!#{Gem.ruby}")
|
35
|
-
opts = $1
|
36
|
-
shebang.strip! # Avoid nasty ^M issues.
|
37
|
-
end
|
38
|
-
|
39
|
-
if which = Gem.configuration[:custom_shebang]
|
40
|
-
which = which.gsub(/\$(\w+)/) do
|
41
|
-
case $1
|
42
|
-
when "env"
|
43
|
-
@env_path ||= Gem::Installer::ENV_PATHS.find {|env_path| File.executable? env_path }
|
44
|
-
when "ruby"
|
45
|
-
"#{Gem.ruby}#{opts}"
|
46
|
-
when "exec"
|
47
|
-
bin_file_name
|
48
|
-
when "name"
|
49
|
-
inst.spec.name
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
return "#!#{which}"
|
54
|
-
end
|
55
|
-
|
56
|
-
if not ruby_name then
|
57
|
-
"#!#{Gem.ruby}#{opts}"
|
58
|
-
elsif opts then
|
59
|
-
"#!/bin/sh\n'exec' #{ruby_name.dump} '-x' \"$0\" \"$@\"\n#{shebang}"
|
60
|
-
else
|
61
|
-
@env_path ||= Gem::Installer::ENV_PATHS.find {|env_path| File.executable? env_path }
|
62
|
-
"#!#{@env_path} #{ruby_name}"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Return the text for an application file.
|
67
|
-
def self.bundler_app_script_text(inst, bin_file_name)
|
68
|
-
<<-TEXT
|
69
|
-
#{shebang inst, bin_file_name}
|
70
|
-
#
|
71
|
-
# This file was generated by RubyGems.
|
72
|
-
#
|
73
|
-
# The application '#{inst.spec.name}' is installed as part of a gem, and
|
74
|
-
# this file is here to facilitate running it.
|
75
|
-
#
|
76
|
-
|
77
|
-
require 'rubygems'
|
78
|
-
|
79
|
-
version = "#{Gem::Requirement.default}"
|
80
|
-
|
81
|
-
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
82
|
-
version = $1
|
83
|
-
ARGV.shift
|
84
|
-
end
|
85
|
-
|
86
|
-
gem '#{inst.spec.name}', version
|
87
|
-
load Gem.bin_path('#{inst.spec.name}', '#{bin_file_name}', version)
|
88
|
-
TEXT
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
Gem.post_install do |inst|
|
94
|
-
RubyGemsBundlerInstaller.bundler_generate_bin(inst)
|
95
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'rubygems-bundler/wrapper'
|
2
|
-
require 'rubygems-bundler/regenerate_binstubs_command'
|
3
|
-
|
4
|
-
module RubygemsBundler
|
5
|
-
def self.uninstall
|
6
|
-
Gem.configuration[:custom_shebang] = '$env ruby'
|
7
|
-
RegenerateBinstubsCommand.new.execute_no_wrapper
|
8
|
-
Wrapper.uninstall
|
9
|
-
end
|
10
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# install / uninstall wrapper
|
2
|
-
require 'fileutils'
|
3
|
-
require 'rubygems'
|
4
|
-
|
5
|
-
module RubygemsBundler
|
6
|
-
module Wrapper
|
7
|
-
def self.wrapper_name
|
8
|
-
'ruby_noexec_wrapper'
|
9
|
-
end
|
10
|
-
def self.bindir
|
11
|
-
Gem.respond_to?(:bindir,true) ? Gem.send(:bindir) : File.join(Gem.dir, 'bin')
|
12
|
-
end
|
13
|
-
def self.destination
|
14
|
-
File.expand_path( wrapper_name, bindir )
|
15
|
-
end
|
16
|
-
def self.install
|
17
|
-
rubygems_bundler_spec =
|
18
|
-
if Gem::Specification.respond_to?(:find_by_name)
|
19
|
-
Gem::Specification.find_by_name("rubygems-bundler")
|
20
|
-
else
|
21
|
-
Gem.source_index.find_name("rubygems-bundler").last
|
22
|
-
end
|
23
|
-
|
24
|
-
if rubygems_bundler_spec
|
25
|
-
wrapper_path = File.expand_path( "bin/#{wrapper_name}", rubygems_bundler_spec.full_gem_path )
|
26
|
-
end
|
27
|
-
|
28
|
-
if rubygems_bundler_spec && File.exist?(wrapper_path) && !File.exist?(destination)
|
29
|
-
FileUtils.mkdir_p(bindir)
|
30
|
-
FileUtils.cp(wrapper_path, destination)
|
31
|
-
File.chmod(0775, destination)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
def self.uninstall
|
35
|
-
FileUtils.rm_f(destination) if File.exist?(destination)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/rubygems_plugin.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module RubygemsBundler
|
2
|
-
def self.spec_version
|
3
|
-
@rubygems_bundler_spec ||=
|
4
|
-
if Gem::Specification.respond_to?(:find_by_name)
|
5
|
-
Gem::Specification.find_by_name("rubygems-bundler")
|
6
|
-
else
|
7
|
-
Gem.source_index.find_name("rubygems-bundler").last
|
8
|
-
end
|
9
|
-
@rubygems_bundler_spec ? @rubygems_bundler_spec.version.to_s : nil
|
10
|
-
rescue Gem::LoadError
|
11
|
-
nil
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
called_path, called_version = __FILE__.match(/^(.*\/rubygems-bundler-([^\/]+)\/lib).*$/)[1..2]
|
16
|
-
|
17
|
-
# continue only if loaded ($: or gem) and called versions is the same and not shared gems disabled in bundler
|
18
|
-
if
|
19
|
-
( $:.include?(called_path) || RubygemsBundler.spec_version == called_version ) and
|
20
|
-
( !defined?(Bundler) || ( defined?(Bundler) && Bundler::SharedHelpers.in_bundle? && !Bundler.settings[:disable_shared_gems]) )
|
21
|
-
|
22
|
-
require 'rubygems/version'
|
23
|
-
require 'rubygems-bundler/wrapper'
|
24
|
-
|
25
|
-
# Set the custom_shebang if user did not set one
|
26
|
-
Gem.pre_install do |inst|
|
27
|
-
Gem.configuration[:custom_shebang] ||= '$env ruby_noexec_wrapper'
|
28
|
-
RubygemsBundler::Wrapper.install
|
29
|
-
end
|
30
|
-
|
31
|
-
if Gem::Version.new(Gem::VERSION) < Gem::Version.new('2.0') then
|
32
|
-
# Add custom_shebang support to rubygems
|
33
|
-
require 'rubygems-bundler/rubygems_bundler_installer'
|
34
|
-
end
|
35
|
-
|
36
|
-
require 'rubygems-bundler/regenerate_binstubs_command'
|
37
|
-
Gem::CommandManager.instance.register_command :regenerate_binstubs
|
38
|
-
elsif ENV.key?('NOEXEC_DEBUG')
|
39
|
-
msg = "Older rubygems-bundler found, loaded: #{RubygemsBundler.spec_version}, called: #{called_version}, you can uninstall it with:\n\n "
|
40
|
-
|
41
|
-
error_source = __FILE__
|
42
|
-
gem_source = File.expand_path("../../../..", error_source)
|
43
|
-
gem_version = error_source.sub(/^.*\/rubygems-bundler-([^\/]+)\/.*$/,'\1')
|
44
|
-
|
45
|
-
if ENV['GEM_HOME'] or ENV['GEM_PATH']
|
46
|
-
msg << "GEM_HOME=\"#{gem_source}\" " unless ENV['GEM_HOME'] == gem_source
|
47
|
-
end
|
48
|
-
|
49
|
-
msg << "gem uninstall -ax rubygems-bundler -v #{gem_version}\n\n"
|
50
|
-
|
51
|
-
puts msg
|
52
|
-
end
|