bundler 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/lib/bundler.rb +6 -17
- data/lib/bundler/cli.rb +26 -6
- data/lib/bundler/definition.rb +2 -2
- data/lib/bundler/dependency.rb +1 -0
- data/lib/bundler/dsl.rb +2 -2
- data/lib/bundler/{rubygems.rb → rubygems-ext.rb} +2 -0
- data/lib/bundler/runtime.rb +13 -32
- data/lib/bundler/setup.rb +8 -2
- data/lib/bundler/shared_helpers.rb +45 -0
- data/lib/bundler/source.rb +10 -2
- data/lib/bundler/templates/environment.erb +7 -0
- metadata +4 -3
data/lib/bundler.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'pathname'
|
3
3
|
require 'yaml'
|
4
|
-
require 'bundler/rubygems'
|
4
|
+
require 'bundler/rubygems-ext'
|
5
5
|
|
6
6
|
module Bundler
|
7
|
-
VERSION = "0.9.
|
7
|
+
VERSION = "0.9.4"
|
8
8
|
|
9
9
|
autoload :Definition, 'bundler/definition'
|
10
10
|
autoload :Dependency, 'bundler/dependency'
|
@@ -16,6 +16,7 @@ module Bundler
|
|
16
16
|
autoload :Resolver, 'bundler/resolver'
|
17
17
|
autoload :Runtime, 'bundler/runtime'
|
18
18
|
autoload :Settings, 'bundler/settings'
|
19
|
+
autoload :SharedHelpers, 'bundler/shared_helpers'
|
19
20
|
autoload :Source, 'bundler/source'
|
20
21
|
autoload :Specification, 'bundler/specification'
|
21
22
|
autoload :UI, 'bundler/ui'
|
@@ -106,24 +107,12 @@ module Bundler
|
|
106
107
|
@settings ||= Settings.new(root)
|
107
108
|
end
|
108
109
|
|
109
|
-
|
110
|
-
if ENV['BUNDLE_GEMFILE']
|
111
|
-
return Pathname.new(ENV['BUNDLE_GEMFILE'])
|
112
|
-
end
|
113
|
-
|
114
|
-
current = Pathname.new(Dir.pwd)
|
115
|
-
|
116
|
-
until current.root?
|
117
|
-
filename = current.join("Gemfile")
|
118
|
-
return filename if filename.exist?
|
119
|
-
current = current.parent
|
120
|
-
end
|
110
|
+
private
|
121
111
|
|
122
|
-
|
112
|
+
def default_gemfile
|
113
|
+
SharedHelpers.default_gemfile
|
123
114
|
end
|
124
115
|
|
125
|
-
private
|
126
|
-
|
127
116
|
def configure_gem_home_and_path
|
128
117
|
if path = settings[:path]
|
129
118
|
ENV['GEM_HOME'] = File.expand_path(path, root)
|
data/lib/bundler/cli.rb
CHANGED
@@ -36,6 +36,7 @@ module Bundler
|
|
36
36
|
missing.each do |d|
|
37
37
|
puts " * #{d}"
|
38
38
|
end
|
39
|
+
exit 1
|
39
40
|
else
|
40
41
|
env.specs
|
41
42
|
puts "The Gemfile's dependencies are satisfied"
|
@@ -43,8 +44,11 @@ module Bundler
|
|
43
44
|
end
|
44
45
|
|
45
46
|
desc "install", "Install the current environment to the system"
|
46
|
-
method_option :without, :type => :array, :banner
|
47
|
+
method_option :without, :type => :array, :banner => "Exclude gems that are part of the specified named group"
|
48
|
+
method_option :relock, :type => :boolean, :banner => "Unlock, install the gems, and relock"
|
47
49
|
def install(path = nil)
|
50
|
+
remove_lockfiles if options[:relock]
|
51
|
+
|
48
52
|
opts = options.dup
|
49
53
|
opts[:without] ||= []
|
50
54
|
opts[:without].map! { |g| g.to_sym }
|
@@ -52,13 +56,15 @@ module Bundler
|
|
52
56
|
Bundler.settings[:path] = path if path
|
53
57
|
|
54
58
|
Installer.install(Bundler.root, Bundler.definition, opts)
|
59
|
+
|
60
|
+
lock if options[:relock]
|
55
61
|
end
|
56
62
|
|
57
63
|
desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
|
58
64
|
def lock
|
59
|
-
if
|
65
|
+
if locked?
|
60
66
|
Bundler.ui.info("The bundle is already locked, relocking.")
|
61
|
-
|
67
|
+
remove_lockfiles
|
62
68
|
end
|
63
69
|
|
64
70
|
environment = Bundler.load
|
@@ -71,8 +77,12 @@ module Bundler
|
|
71
77
|
|
72
78
|
desc "unlock", "Unlock the bundle. This allows gem versions to be changed"
|
73
79
|
def unlock
|
74
|
-
|
75
|
-
|
80
|
+
if locked?
|
81
|
+
remove_lockfiles
|
82
|
+
Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
|
83
|
+
else
|
84
|
+
Bundler.ui.info("The bundle is not currently locked.")
|
85
|
+
end
|
76
86
|
end
|
77
87
|
|
78
88
|
desc "show", "Shows all gems that are part of the bundle."
|
@@ -100,7 +110,7 @@ module Bundler
|
|
100
110
|
ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
|
101
111
|
|
102
112
|
# Set BUNDLE_GEMFILE
|
103
|
-
ENV['BUNDLE_GEMFILE'] = Bundler.default_gemfile
|
113
|
+
ENV['BUNDLE_GEMFILE'] = Bundler::SharedHelpers.default_gemfile.to_s
|
104
114
|
|
105
115
|
# Set RUBYOPT
|
106
116
|
rubyopt = [ENV["RUBYOPT"]].compact
|
@@ -112,5 +122,15 @@ module Bundler
|
|
112
122
|
Kernel.exec *ARGV
|
113
123
|
end
|
114
124
|
|
125
|
+
private
|
126
|
+
|
127
|
+
def locked?
|
128
|
+
File.exist?("#{Bundler.root}/Gemfile.lock") || File.exist?("#{Bundler.root}/.bundle/environment.rb")
|
129
|
+
end
|
130
|
+
|
131
|
+
def remove_lockfiles
|
132
|
+
FileUtils.rm_f "#{Bundler.root}/Gemfile.lock"
|
133
|
+
FileUtils.rm_f "#{Bundler.root}/.bundle/environment.rb"
|
134
|
+
end
|
115
135
|
end
|
116
136
|
end
|
data/lib/bundler/definition.rb
CHANGED
@@ -83,8 +83,8 @@ module Bundler
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def dependencies
|
86
|
-
@dependencies ||= @details["dependencies"].map do |
|
87
|
-
Bundler::Dependency.new(
|
86
|
+
@dependencies ||= @details["dependencies"].map do |dep, opts|
|
87
|
+
Bundler::Dependency.new(dep, opts.delete("version"), opts)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
data/lib/bundler/dependency.rb
CHANGED
data/lib/bundler/dsl.rb
CHANGED
@@ -9,7 +9,7 @@ module Bundler
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def initialize
|
12
|
-
@sources = []
|
12
|
+
@sources = []
|
13
13
|
@dependencies = []
|
14
14
|
@group = nil
|
15
15
|
end
|
@@ -113,4 +113,4 @@ module Bundler
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
116
|
-
end
|
116
|
+
end
|
data/lib/bundler/runtime.rb
CHANGED
@@ -2,6 +2,8 @@ require "digest/sha1"
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
class Runtime < Environment
|
5
|
+
include SharedHelpers
|
6
|
+
|
5
7
|
def setup(*groups)
|
6
8
|
# Has to happen first
|
7
9
|
clean_load_path
|
@@ -29,25 +31,11 @@ module Bundler
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def dependencies
|
32
|
-
@definition.
|
33
|
-
end
|
34
|
-
|
35
|
-
def lock
|
36
|
-
FileUtils.mkdir_p("#{root}/.bundle")
|
37
|
-
write_yml_lock
|
38
|
-
write_rb_lock
|
39
|
-
Bundler.ui.info("The bundle is now locked. Use `bundle show` to list the gems in the environment.")
|
34
|
+
@definition.dependencies
|
40
35
|
end
|
41
36
|
|
42
|
-
def
|
43
|
-
|
44
|
-
Bundler.ui.info("The bundle is not currently locked.")
|
45
|
-
return
|
46
|
-
end
|
47
|
-
|
48
|
-
FileUtils.rm_f("#{root}/.bundle/environment.rb")
|
49
|
-
FileUtils.rm_f("#{root}/Gemfile.lock")
|
50
|
-
Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
|
37
|
+
def actual_dependencies
|
38
|
+
@definition.actual_dependencies
|
51
39
|
end
|
52
40
|
|
53
41
|
def lock
|
@@ -60,7 +48,7 @@ module Bundler
|
|
60
48
|
end
|
61
49
|
|
62
50
|
def locked?
|
63
|
-
File.exist?("#{root}/Gemfile.lock")
|
51
|
+
File.exist?("#{root}/Gemfile.lock") || File.exist?("#{root}/.bundle/environment.rb")
|
64
52
|
end
|
65
53
|
|
66
54
|
def dependencies_for(*groups)
|
@@ -82,7 +70,7 @@ module Bundler
|
|
82
70
|
def specs
|
83
71
|
@specs ||= begin
|
84
72
|
source_requirements = {}
|
85
|
-
|
73
|
+
actual_dependencies.each do |dep|
|
86
74
|
next unless dep.source && dep.source.respond_to?(:local_specs)
|
87
75
|
source_requirements[dep.name] = dep.source.local_specs
|
88
76
|
end
|
@@ -123,6 +111,7 @@ module Bundler
|
|
123
111
|
end
|
124
112
|
|
125
113
|
def write_rb_lock
|
114
|
+
shared_helpers = File.read(File.expand_path("../shared_helpers.rb", __FILE__))
|
126
115
|
template = File.read(File.expand_path("../templates/environment.erb", __FILE__))
|
127
116
|
erb = ERB.new(template, nil, '-')
|
128
117
|
File.open("#{root}/.bundle/environment.rb", 'w') do |f|
|
@@ -148,7 +137,11 @@ module Bundler
|
|
148
137
|
{ s.name => options }
|
149
138
|
end
|
150
139
|
|
151
|
-
details["dependencies"] = @definition.dependencies.
|
140
|
+
details["dependencies"] = @definition.dependencies.inject({}) do |h,d|
|
141
|
+
h.merge!({d.name => {"version" => d.version_requirements.to_s,
|
142
|
+
"group" => d.groups,
|
143
|
+
"require" => d.autorequire}})
|
144
|
+
end
|
152
145
|
details
|
153
146
|
end
|
154
147
|
|
@@ -184,18 +177,6 @@ module Bundler
|
|
184
177
|
end
|
185
178
|
end
|
186
179
|
|
187
|
-
def reverse_rubygems_kernel_mixin
|
188
|
-
# Disable rubygems' gem activation system
|
189
|
-
::Kernel.class_eval do
|
190
|
-
if private_method_defined?(:gem_original_require)
|
191
|
-
alias rubygems_require require
|
192
|
-
alias require gem_original_require
|
193
|
-
end
|
194
|
-
|
195
|
-
undef gem
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
180
|
def cripple_rubygems(specs)
|
200
181
|
reverse_rubygems_kernel_mixin
|
201
182
|
|
data/lib/bundler/setup.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Bundler
|
2
|
+
module SharedHelpers
|
3
|
+
|
4
|
+
def reverse_rubygems_kernel_mixin
|
5
|
+
require "rubygems"
|
6
|
+
|
7
|
+
# Disable rubygems' gem activation system
|
8
|
+
::Kernel.class_eval do
|
9
|
+
if private_method_defined?(:gem_original_require)
|
10
|
+
alias rubygems_require require
|
11
|
+
alias require gem_original_require
|
12
|
+
end
|
13
|
+
|
14
|
+
undef gem
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def default_gemfile
|
19
|
+
gemfile = find_gemfile
|
20
|
+
gemfile or raise GemfileNotFound, "The default Gemfile was not found"
|
21
|
+
Pathname.new(gemfile)
|
22
|
+
end
|
23
|
+
|
24
|
+
def in_bundle?
|
25
|
+
find_gemfile
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def find_gemfile
|
31
|
+
return ENV['BUNDLE_GEMFILE'] if ENV['BUNDLE_GEMFILE']
|
32
|
+
|
33
|
+
previous = nil
|
34
|
+
current = File.expand_path(Dir.pwd)
|
35
|
+
|
36
|
+
until !File.directory?(current) || current == previous
|
37
|
+
filename = File.join(current, 'Gemfile')
|
38
|
+
return filename if File.file?(filename)
|
39
|
+
current, previous = File.expand_path("#{current}/.."), current
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
extend self
|
44
|
+
end
|
45
|
+
end
|
data/lib/bundler/source.rb
CHANGED
@@ -62,7 +62,7 @@ module Bundler
|
|
62
62
|
def prerelease_specs
|
63
63
|
Marshal.load(Gem::RemoteFetcher.fetcher.fetch_path("#{uri}/prerelease_specs.4.8.gz"))
|
64
64
|
rescue Gem::RemoteFetcher::FetchError
|
65
|
-
Bundler.
|
65
|
+
Bundler.ui.warn "Source '#{uri}' does not support prerelease gems"
|
66
66
|
[]
|
67
67
|
end
|
68
68
|
end
|
@@ -286,7 +286,15 @@ module Bundler
|
|
286
286
|
end
|
287
287
|
|
288
288
|
def uri_hash
|
289
|
-
|
289
|
+
if uri =~ %r{^\w+://(\w+@)?}
|
290
|
+
# Downcase the domain component of the URI
|
291
|
+
# and strip off a trailing slash, if one is present
|
292
|
+
input = URI.parse(uri).normalize.to_s.sub(%r{/$},'')
|
293
|
+
else
|
294
|
+
# If there is no URI scheme, assume it is an ssh/git URI
|
295
|
+
input = uri
|
296
|
+
end
|
297
|
+
Digest::SHA1.hexdigest(input)
|
290
298
|
end
|
291
299
|
|
292
300
|
def cache_path
|
@@ -1,7 +1,14 @@
|
|
1
1
|
require 'digest/sha1'
|
2
2
|
|
3
3
|
# DO NOT MODIFY THIS FILE
|
4
|
+
|
5
|
+
<%= shared_helpers %>
|
6
|
+
|
4
7
|
module Bundler
|
8
|
+
extend SharedHelpers
|
9
|
+
|
10
|
+
reverse_rubygems_kernel_mixin
|
11
|
+
|
5
12
|
FINGERPRINT = <%= gemfile_fingerprint.inspect %>
|
6
13
|
LOAD_PATHS = <%= load_paths.inspect %>
|
7
14
|
AUTOREQUIRES = <%= autorequires_for_groups.inspect %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Lerche
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-10 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -34,10 +34,11 @@ files:
|
|
34
34
|
- lib/bundler/installer.rb
|
35
35
|
- lib/bundler/remote_specification.rb
|
36
36
|
- lib/bundler/resolver.rb
|
37
|
-
- lib/bundler/rubygems.rb
|
37
|
+
- lib/bundler/rubygems-ext.rb
|
38
38
|
- lib/bundler/runtime.rb
|
39
39
|
- lib/bundler/settings.rb
|
40
40
|
- lib/bundler/setup.rb
|
41
|
+
- lib/bundler/shared_helpers.rb
|
41
42
|
- lib/bundler/source.rb
|
42
43
|
- lib/bundler/specification.rb
|
43
44
|
- lib/bundler/templates/environment.erb
|