bundler 0.9.13 → 0.9.14
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/CHANGELOG.md +22 -1
- data/README.md +6 -0
- data/lib/bundler.rb +16 -2
- data/lib/bundler/cli.rb +28 -6
- data/lib/bundler/environment.rb +4 -0
- data/lib/bundler/index.rb +11 -0
- data/lib/bundler/installer.rb +6 -9
- data/lib/bundler/resolver.rb +6 -1
- data/lib/bundler/rubygems_ext.rb +33 -0
- data/lib/bundler/runtime.rb +0 -4
- data/lib/bundler/source.rb +48 -14
- data/lib/bundler/specification.rb +1 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,29 @@
|
|
1
|
-
## 0.9.
|
1
|
+
## 0.9.13 (March 23, 2010)
|
2
|
+
|
3
|
+
Bugfixes:
|
4
|
+
|
5
|
+
- exec command now finds binaries from gems installed via :path
|
6
|
+
- gem dependencies are pulled in even if their type is nil
|
7
|
+
- paths with spaces have double-quotes to work on Windows
|
8
|
+
- set GEM_PATH in environment.rb so generators work with Rails 2
|
9
|
+
|
10
|
+
## 0.9.12 (March 17, 2010)
|
11
|
+
|
12
|
+
- refactoring, internal cleanup, more solid specs
|
13
|
+
|
14
|
+
Features:
|
15
|
+
|
16
|
+
- check command takes a --without option
|
17
|
+
- check command exits 1 if the check fails
|
2
18
|
|
3
19
|
Bugfixes:
|
4
20
|
|
5
21
|
- perform a topological sort on resolved gems (#191)
|
22
|
+
- gems from git work even when paths or repos have spaces (#196)
|
23
|
+
- Specification#loaded_from returns a String, like Gem::Specification (#197)
|
24
|
+
- specs eval from inside the gem directory, even when locked
|
25
|
+
- virtual gemspecs are now saved in environment.rb for use when loading
|
26
|
+
- unify the Installer's local index and the runtime index (#204)
|
6
27
|
|
7
28
|
## 0.9.11 (March 9, 2010)
|
8
29
|
|
data/README.md
CHANGED
@@ -274,6 +274,12 @@ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
|
|
274
274
|
|
275
275
|
## More information
|
276
276
|
|
277
|
+
### Development
|
278
|
+
|
279
|
+
For information about future plans and changes that will happen between now and bundler 1.0, see the [ROADMAP](http://github.com/carlhuda/bundler/blob/master/ROADMAP.md). To see what has changed in each version of bundler, starting with 0.9.5, see the [CHANGELOG](http://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
|
280
|
+
|
281
|
+
### Usage
|
282
|
+
|
277
283
|
Explanations of common Bundler use cases can be found in [Using Bundler in Real Life](http://yehudakatz.com/2010/02/09/using-bundler-in-real-life/). The general philosophy behind Bundler 0.9 is explained at some length in [Bundler 0.9: Heading Toward 1.0](http://yehudakatz.com/2010/02/01/bundler-0-9-heading-toward-1-0/). Using Bundler with a Rails 2.3.5 app is explained with more detail in [Bundler 0.9 and Rails 2.3.5](http://andre.arko.net/2010/02/13/using-bundler-09-with-rails-235/).
|
278
284
|
|
279
285
|
### Deploying to memory-constrained servers
|
data/lib/bundler.rb
CHANGED
@@ -3,8 +3,10 @@ require 'pathname'
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'bundler/rubygems_ext'
|
5
5
|
|
6
|
+
|
6
7
|
module Bundler
|
7
|
-
VERSION = "0.9.
|
8
|
+
VERSION = "0.9.14"
|
9
|
+
ORIGINAL_ENV = ENV.to_hash
|
8
10
|
|
9
11
|
autoload :Definition, 'bundler/definition'
|
10
12
|
autoload :Dependency, 'bundler/dependency'
|
@@ -97,8 +99,12 @@ module Bundler
|
|
97
99
|
home.join("gems")
|
98
100
|
end
|
99
101
|
|
102
|
+
def specs_path
|
103
|
+
bundle_path.join("specifications")
|
104
|
+
end
|
105
|
+
|
100
106
|
def cache
|
101
|
-
bundle_path.join(
|
107
|
+
bundle_path.join("cache/bundler")
|
102
108
|
end
|
103
109
|
|
104
110
|
def root
|
@@ -109,6 +115,14 @@ module Bundler
|
|
109
115
|
@settings ||= Settings.new(root)
|
110
116
|
end
|
111
117
|
|
118
|
+
def with_clean_env
|
119
|
+
bundled_env = ENV.to_hash
|
120
|
+
ENV.replace(ORIGINAL_ENV)
|
121
|
+
yield
|
122
|
+
ensure
|
123
|
+
ENV.replace(bundled_env.to_hash)
|
124
|
+
end
|
125
|
+
|
112
126
|
private
|
113
127
|
|
114
128
|
def default_gemfile
|
data/lib/bundler/cli.rb
CHANGED
@@ -10,9 +10,26 @@ module Bundler
|
|
10
10
|
check_unknown_options! unless ARGV.include?("exec")
|
11
11
|
|
12
12
|
desc "init", "Generates a Gemfile into the current working directory"
|
13
|
+
method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
|
13
14
|
def init
|
15
|
+
opts = options.dup
|
14
16
|
if File.exist?("Gemfile")
|
15
|
-
|
17
|
+
Bundler.ui.error "Gemfile already exists at #{Dir.pwd}/Gemfile"
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
|
21
|
+
if opts[:gemspec]
|
22
|
+
gemspec = File.expand_path(opts[:gemspec])
|
23
|
+
unless File.exist?(gemspec)
|
24
|
+
Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
spec = Gem::Specification.load(gemspec)
|
28
|
+
puts "Writing new Gemfile to #{Dir.pwd}/Gemfile"
|
29
|
+
File.open('Gemfile', 'w') do |file|
|
30
|
+
file << "# Generated from #{gemspec}\n"
|
31
|
+
file << spec.to_gemfile
|
32
|
+
end
|
16
33
|
else
|
17
34
|
puts "Writing new Gemfile to #{Dir.pwd}/Gemfile"
|
18
35
|
FileUtils.cp(File.expand_path('../templates/Gemfile', __FILE__), 'Gemfile')
|
@@ -111,10 +128,11 @@ module Bundler
|
|
111
128
|
environment = Bundler.load
|
112
129
|
Bundler.ui.info "Gems included by the bundle:"
|
113
130
|
environment.specs.sort_by { |s| s.name }.each do |s|
|
114
|
-
Bundler.ui.info " * #{s.name} (#{s.version})"
|
131
|
+
Bundler.ui.info " * #{s.name} (#{s.version}#{s.git_version})"
|
115
132
|
end
|
116
133
|
end
|
117
134
|
end
|
135
|
+
map %w(list) => "show"
|
118
136
|
|
119
137
|
desc "cache", "Cache all the gems to vendor/cache"
|
120
138
|
def cache
|
@@ -162,10 +180,14 @@ module Bundler
|
|
162
180
|
|
163
181
|
desc "open GEM", "Opens the source directory of the given bundled gem"
|
164
182
|
def open(name)
|
165
|
-
editor = ENV['EDITOR']
|
166
|
-
|
167
|
-
|
168
|
-
|
183
|
+
editor = [ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
|
184
|
+
if editor
|
185
|
+
command = "#{editor} #{locate_gem(name)}"
|
186
|
+
success = system(command)
|
187
|
+
Bundler.ui.info "Could not run '#{command}'" unless success
|
188
|
+
else
|
189
|
+
Bundler.ui.info("To open a bundled gem, set $EDITOR")
|
190
|
+
end
|
169
191
|
end
|
170
192
|
|
171
193
|
desc "version", "Prints the bundler's version information"
|
data/lib/bundler/environment.rb
CHANGED
data/lib/bundler/index.rb
CHANGED
@@ -7,6 +7,17 @@ module Bundler
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.installed_gems
|
10
|
+
build do |idx|
|
11
|
+
idx.use bundler_gems
|
12
|
+
idx.use system_gems
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.bundler_gems
|
17
|
+
Source::BundlerGems.new.specs
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.system_gems
|
10
21
|
Source::SystemGems.new.specs
|
11
22
|
end
|
12
23
|
|
data/lib/bundler/installer.rb
CHANGED
@@ -26,18 +26,19 @@ module Bundler
|
|
26
26
|
next
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
if [Source::Rubygems, Source::GemCache].include?(spec.source.class)
|
30
|
+
Bundler.ui.info "Installing #{spec.name} (#{spec.version}) from #{spec.source}"
|
31
|
+
else
|
32
|
+
Bundler.ui.info "Using #{spec.name} (#{spec.version}) from #{spec.source}"
|
33
|
+
end
|
31
34
|
spec.source.install(spec)
|
32
|
-
|
33
|
-
Bundler.ui.info ""
|
34
35
|
end
|
35
36
|
|
36
37
|
if locked?
|
37
38
|
write_rb_lock
|
38
39
|
end
|
39
40
|
|
40
|
-
Bundler.ui.confirm "Your bundle is complete!"
|
41
|
+
Bundler.ui.confirm "Your bundle is complete! Use `bundle show gemname` to see where a bundled gem is installed."
|
41
42
|
end
|
42
43
|
|
43
44
|
def dependencies
|
@@ -50,10 +51,6 @@ module Bundler
|
|
50
51
|
|
51
52
|
private
|
52
53
|
|
53
|
-
def sources
|
54
|
-
@definition.sources
|
55
|
-
end
|
56
|
-
|
57
54
|
def resolve_locally
|
58
55
|
# Return unless all the dependencies have = version requirements
|
59
56
|
return if actual_dependencies.any? { |d| ambiguous?(d) }
|
data/lib/bundler/resolver.rb
CHANGED
@@ -42,7 +42,12 @@ module Bundler
|
|
42
42
|
if origin
|
43
43
|
o << " Conflict on: #{conflict.inspect}:\n"
|
44
44
|
o << " * #{conflict} (#{origin.version}) activated by #{origin.required_by.first}\n"
|
45
|
-
o << " * #{requirement} required
|
45
|
+
o << " * #{requirement} required"
|
46
|
+
if requirement.required_by.first
|
47
|
+
o << " by #{requirement.required_by.first}\n"
|
48
|
+
else
|
49
|
+
o << " in Gemfile\n"
|
50
|
+
end
|
46
51
|
else
|
47
52
|
o << " #{requirement} not found in any of the sources\n"
|
48
53
|
o << " required by #{requirement.required_by.first}\n"
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -16,6 +16,39 @@ module Gem
|
|
16
16
|
def groups
|
17
17
|
@groups ||= []
|
18
18
|
end
|
19
|
+
|
20
|
+
def git_version
|
21
|
+
Dir.chdir(full_gem_path) do
|
22
|
+
rev = `git rev-parse HEAD`.strip[0...6]
|
23
|
+
branch = `git show-branch --no-color 2>/dev/null`.strip[/\[(.*?)\]/, 1]
|
24
|
+
branch.empty? ? " #{rev}" : " #{branch}-#{rev}"
|
25
|
+
end if File.exist?(File.join(full_gem_path, ".git"))
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_gemfile(path = nil)
|
29
|
+
gemfile = "source :gemcutter\n"
|
30
|
+
gemfile << dependencies_to_gemfile(dependencies)
|
31
|
+
gemfile << dependencies_to_gemfile(development_dependencies, :development)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def dependencies_to_gemfile(dependencies, group = nil)
|
37
|
+
gemfile = ''
|
38
|
+
if dependencies.any?
|
39
|
+
gemfile << "group #{group} do\n" if group
|
40
|
+
dependencies.each do |dependency|
|
41
|
+
gemfile << ' ' if group
|
42
|
+
gemfile << %|gem "#{dependency.name}"|
|
43
|
+
req = dependency.requirements_list.first
|
44
|
+
gemfile << %|, "#{req}"| if req
|
45
|
+
gemfile << "\n"
|
46
|
+
end
|
47
|
+
gemfile << "end\n" if group
|
48
|
+
end
|
49
|
+
gemfile
|
50
|
+
end
|
51
|
+
|
19
52
|
end
|
20
53
|
|
21
54
|
class Dependency
|
data/lib/bundler/runtime.rb
CHANGED
data/lib/bundler/source.rb
CHANGED
@@ -80,7 +80,11 @@ module Bundler
|
|
80
80
|
@specs ||= begin
|
81
81
|
index = Index.new
|
82
82
|
|
83
|
-
Gem::SourceIndex.
|
83
|
+
system_paths = Gem::SourceIndex.installed_spec_directories
|
84
|
+
system_paths.reject!{|d| d == Bundler.specs_path.to_s }
|
85
|
+
|
86
|
+
system_index = Gem::SourceIndex.from_gems_in(*system_paths)
|
87
|
+
system_index.to_a.reverse.each do |name, spec|
|
84
88
|
spec.source = self
|
85
89
|
index << spec
|
86
90
|
end
|
@@ -98,6 +102,26 @@ module Bundler
|
|
98
102
|
end
|
99
103
|
end
|
100
104
|
|
105
|
+
class BundlerGems < SystemGems
|
106
|
+
def specs
|
107
|
+
@specs ||= begin
|
108
|
+
index = Index.new
|
109
|
+
|
110
|
+
bundle_index = Gem::SourceIndex.from_gems_in(Bundler.specs_path)
|
111
|
+
bundle_index.to_a.reverse.each do |name, spec|
|
112
|
+
spec.source = self
|
113
|
+
index << spec
|
114
|
+
end
|
115
|
+
|
116
|
+
index
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def to_s
|
121
|
+
"bundler gems"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
101
125
|
class GemCache
|
102
126
|
def initialize(options)
|
103
127
|
@path = options["path"]
|
@@ -138,7 +162,7 @@ module Bundler
|
|
138
162
|
end
|
139
163
|
|
140
164
|
class Path
|
141
|
-
attr_reader :path, :options
|
165
|
+
attr_reader :path, :options
|
142
166
|
|
143
167
|
def initialize(options)
|
144
168
|
@options = options
|
@@ -148,15 +172,8 @@ module Bundler
|
|
148
172
|
@path = Pathname.new(options["path"]).expand_path(Bundler.root)
|
149
173
|
end
|
150
174
|
|
151
|
-
|
152
|
-
|
153
|
-
s.name = options["name"]
|
154
|
-
s.source = self
|
155
|
-
s.version = Gem::Version.new(options["version"])
|
156
|
-
s.summary = "Fake gemspec for #{options["name"]}"
|
157
|
-
s.relative_loaded_from = "#{options["name"]}.gemspec"
|
158
|
-
end
|
159
|
-
end
|
175
|
+
@name = options["name"]
|
176
|
+
@version = options["version"]
|
160
177
|
end
|
161
178
|
|
162
179
|
def to_s
|
@@ -178,7 +195,19 @@ module Bundler
|
|
178
195
|
end
|
179
196
|
end
|
180
197
|
|
181
|
-
index
|
198
|
+
if index.empty? && @name && @version
|
199
|
+
index << Specification.new do |s|
|
200
|
+
s.name = @name
|
201
|
+
s.source = self
|
202
|
+
s.version = Gem::Version.new(@version)
|
203
|
+
s.summary = "Fake gemspec for #{@name}"
|
204
|
+
s.relative_loaded_from = "#{@name}.gemspec"
|
205
|
+
if path.join("bin").exist?
|
206
|
+
binaries = path.join("bin").children.map{|c| c.basename.to_s }
|
207
|
+
s.executables = binaries
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
182
211
|
else
|
183
212
|
raise PathError, "The path `#{path}` does not exist."
|
184
213
|
end
|
@@ -201,7 +230,7 @@ module Bundler
|
|
201
230
|
|
202
231
|
def generate_bin(spec)
|
203
232
|
gem_dir = spec.full_gem_path
|
204
|
-
gem_file = nil # so we have access
|
233
|
+
gem_file = nil # so we have access after it's set in the block
|
205
234
|
|
206
235
|
Dir.chdir(gem_dir) do
|
207
236
|
gem_file = Gem::Builder.new(spec).build
|
@@ -313,7 +342,7 @@ module Bundler
|
|
313
342
|
end
|
314
343
|
|
315
344
|
def cache
|
316
|
-
if
|
345
|
+
if cached?
|
317
346
|
Bundler.ui.info "Updating #{uri}"
|
318
347
|
in_cache { git %|fetch --quiet "#{uri}" master:master| }
|
319
348
|
else
|
@@ -337,7 +366,12 @@ module Bundler
|
|
337
366
|
@revision ||= in_cache { git("rev-parse #{ref}").strip }
|
338
367
|
end
|
339
368
|
|
369
|
+
def cached?
|
370
|
+
cache_path.exist?
|
371
|
+
end
|
372
|
+
|
340
373
|
def in_cache(&blk)
|
374
|
+
cache unless cached?
|
341
375
|
Dir.chdir(cache_path, &blk)
|
342
376
|
end
|
343
377
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 14
|
9
|
+
version: 0.9.14
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Carl Lerche
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-03-
|
19
|
+
date: 2010-03-30 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|