bundler 0.7.0 → 0.7.1

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.

@@ -175,6 +175,7 @@ will be compiled for the target platform without requiring that the
175
175
  Assuming a Rails app with Bundler's standard setup, add something like
176
176
  this to your top-level `.gitignore` to only keep the cache:
177
177
 
178
+ bin/*
178
179
  vendor/gems/*
179
180
  !vendor/gems/cache/
180
181
 
@@ -19,7 +19,7 @@ require "bundler/dependency"
19
19
  require "bundler/remote_specification"
20
20
 
21
21
  module Bundler
22
- VERSION = "0.7.0"
22
+ VERSION = "0.7.1"
23
23
 
24
24
  class << self
25
25
  attr_writer :logger
@@ -2,7 +2,8 @@ module Bundler
2
2
  class InvalidEnvironmentName < StandardError; end
3
3
 
4
4
  class Dependency
5
- attr_reader :name, :version, :require_as, :only, :except, :bundle
5
+ attr_reader :name, :version, :require_as, :only, :except
6
+ attr_accessor :source
6
7
 
7
8
  def initialize(name, options = {}, &block)
8
9
  options.each do |k, v|
@@ -14,7 +15,7 @@ module Bundler
14
15
  @require_as = options["require_as"]
15
16
  @only = options["only"]
16
17
  @except = options["except"]
17
- @bundle = options.key?("bundle") ? options["bundle"] : true
18
+ @source = options["source"]
18
19
  @block = block
19
20
 
20
21
  if (@only && @only.include?("rubygems")) || (@except && @except.include?("rubygems"))
@@ -58,8 +58,9 @@ module Bundler
58
58
  @directory = DirectorySource.new(options.merge(:location => path))
59
59
  @directory_sources << @directory
60
60
  @environment.add_priority_source(@directory)
61
- yield if block_given?
61
+ retval = yield if block_given?
62
62
  @directory = nil
63
+ retval
63
64
  end
64
65
 
65
66
  def git(uri, options = {})
@@ -67,8 +68,9 @@ module Bundler
67
68
  @git = GitSource.new(options.merge(:uri => uri))
68
69
  @git_sources[uri] = @git
69
70
  @environment.add_priority_source(@git)
70
- yield if block_given?
71
+ retval = yield if block_given?
71
72
  @git = nil
73
+ retval
72
74
  end
73
75
 
74
76
  def clear_sources
@@ -90,11 +92,11 @@ module Bundler
90
92
  dep = Dependency.new(name, options.merge(:version => version))
91
93
 
92
94
  if options.key?(:bundle) && !options[:bundle]
93
- # We're using system gems for this one
95
+ dep.source = SystemGemSource.instance
94
96
  elsif @git || options[:git]
95
- _handle_git_option(name, version, options)
97
+ dep.source = _handle_git_option(name, version, options)
96
98
  elsif @directory || options[:path]
97
- _handle_vendored_option(name, version, options)
99
+ dep.source = _handle_vendored_option(name, version, options)
98
100
  end
99
101
 
100
102
  @environment.dependencies << dep
@@ -108,6 +110,7 @@ module Bundler
108
110
  if dir
109
111
  dir.required_specs << name
110
112
  dir.add_spec(path, name, version) if version
113
+ dir
111
114
  else
112
115
  directory options[:path] do
113
116
  _handle_vendored_option(name, version, {})
@@ -145,6 +148,7 @@ module Bundler
145
148
 
146
149
  source.required_specs << name
147
150
  source.add_spec(Pathname.new(options[:path] || '.'), name, version) if version
151
+ source
148
152
  else
149
153
  git(git, :ref => ref, :branch => branch) do
150
154
  _handle_git_option(name, version, options)
@@ -50,12 +50,14 @@ module Bundler
50
50
  dependencies.reject! { |d| !only_envs.any? {|env| d.in?(env) } }
51
51
  end
52
52
 
53
- no_bundle = dependencies.map { |dep| !dep.bundle && dep.name }.compact
53
+ no_bundle = dependencies.map do |dep|
54
+ dep.source == SystemGemSource.instance && dep.name
55
+ end.compact
54
56
 
55
57
  update = options[:update]
56
58
  cached = options[:cached]
57
59
 
58
- repository.install(gem_dependencies, sources,
60
+ repository.install(dependencies, sources,
59
61
  :rubygems => rubygems,
60
62
  :system_gems => system_gems,
61
63
  :manifest => filename,
@@ -21,13 +21,15 @@ module Bundler
21
21
  end
22
22
 
23
23
  source_requirements = {}
24
- options[:no_bundle].each do |name|
25
- source_requirements[name] = SystemGemSource.instance
24
+ dependencies = dependencies.map do |dep|
25
+ source_requirements[dep.name] = dep.source if dep.source
26
+ dep.to_gem_dependency
26
27
  end
27
28
 
28
29
  # Check to see whether the existing cache meets all the requirements
29
30
  begin
30
- valid = Resolver.resolve(dependencies, [source_index], source_requirements)
31
+ valid = nil
32
+ # valid = Resolver.resolve(dependencies, [source_index], source_requirements)
31
33
  rescue Bundler::GemNotFound
32
34
  end
33
35
 
@@ -85,11 +85,17 @@ module Bundler
85
85
  end
86
86
  end
87
87
 
88
+ def debug
89
+ puts yield if defined?($debug) && $debug
90
+ end
91
+
88
92
  def resolve(reqs, activated)
89
93
  # If the requirements are empty, then we are in a success state. Aka, all
90
94
  # gem dependencies have been resolved.
91
95
  throw :success, activated if reqs.empty?
92
96
 
97
+ debug { STDIN.gets ; print "\e[2J\e[f" ; "==== Iterating ====\n\n" }
98
+
93
99
  # Sort dependencies so that the ones that are easiest to resolve are first.
94
100
  # Easiest to resolve is defined by:
95
101
  # 1) Is this gem already activated?
@@ -98,23 +104,33 @@ module Bundler
98
104
  reqs = reqs.sort_by do |a|
99
105
  [ activated[a.name] ? 0 : 1,
100
106
  a.version_requirements.prerelease? ? 0 : 1,
107
+ @errors[a.name] ? 0 : 1,
101
108
  activated[a.name] ? 0 : search(a).size ]
102
109
  end
103
110
 
111
+ debug { "Activated:\n" + activated.values.map { |a| " #{a.name} (#{a.version})" }.join("\n") }
112
+ debug { "Requirements:\n" + reqs.map { |r| " #{r.name} (#{r.version_requirements})"}.join("\n") }
113
+
104
114
  activated = activated.dup
105
115
  # Pull off the first requirement so that we can resolve it
106
116
  current = reqs.shift
107
117
 
118
+ debug { "Attempting:\n #{current.name} (#{current.version_requirements})"}
119
+
108
120
  # Check if the gem has already been activated, if it has, we will make sure
109
121
  # that the currently activated gem satisfies the requirement.
110
122
  if existing = activated[current.name]
111
123
  if current.version_requirements.satisfied_by?(existing.version)
124
+ debug { " * [SUCCESS] Already activated" }
112
125
  @errors.delete(existing.name)
113
126
  # Since the current requirement is satisfied, we can continue resolving
114
127
  # the remaining requirements.
115
128
  resolve(reqs, activated)
116
129
  else
130
+ debug { " * [FAIL] Already activated" }
117
131
  @errors[existing.name] = [existing, current]
132
+ debug { current.required_by.map {|d| " * #{d.name} (#{d.version_requirements})" }.join("\n") }
133
+ # debug { " * All current conflicts:\n" + @errors.keys.map { |c| " - #{c}" }.join("\n") }
118
134
  # Since the current requirement conflicts with an activated gem, we need
119
135
  # to backtrack to the current requirement's parent and try another version
120
136
  # of it (maybe the current requirement won't be present anymore). If the
@@ -123,6 +139,7 @@ module Bundler
123
139
  parent = current.required_by.last || existing.required_by.last
124
140
  # We track the spot where the current gem was activated because we need
125
141
  # to keep a list of every spot a failure happened.
142
+ debug { " -> Jumping to: #{parent.name}" }
126
143
  throw parent.name, existing.required_by.last.name
127
144
  end
128
145
  else
@@ -158,6 +175,7 @@ module Bundler
158
175
  # the conflicting gem, hopefully finding a combination that activates correctly.
159
176
  @stack.reverse_each do |savepoint|
160
177
  if conflicts.include?(savepoint)
178
+ debug { " -> Jumping to: #{savepoint}" }
161
179
  throw savepoint
162
180
  end
163
181
  end
@@ -172,11 +190,16 @@ module Bundler
172
190
  spec.required_by << requirement
173
191
 
174
192
  activated[spec.name] = spec
193
+ debug { " Activating: #{spec.name} (#{spec.version})" }
194
+ debug { spec.required_by.map { |d| " * #{d.name} (#{d.version_requirements})" }.join("\n") }
175
195
 
176
196
  # Now, we have to loop through all child dependencies and add them to our
177
197
  # array of requirements.
198
+ debug { " Dependencies"}
178
199
  spec.dependencies.each do |dep|
179
200
  next if dep.type == :development
201
+ debug { " * #{dep.name} (#{dep.version_requirements})" }
202
+ dep.required_by.replace(requirement.required_by)
180
203
  dep.required_by << requirement
181
204
  reqs << dep
182
205
  end
@@ -208,4 +231,4 @@ module Bundler
208
231
  end
209
232
  end
210
233
  end
211
- end
234
+ end
@@ -214,7 +214,7 @@ module Bundler
214
214
  def locate_gemspecs
215
215
  Dir["#{location}/#{@glob}"].inject({}) do |specs, file|
216
216
  file = Pathname.new(file)
217
- if spec = eval(File.read(file)) and validate_gemspec(file.dirname, spec)
217
+ if spec = eval(File.read(file)) # and validate_gemspec(file.dirname, spec)
218
218
  spec.location = file.dirname.expand_path
219
219
  specs[spec.full_name] = spec
220
220
  end
@@ -237,8 +237,8 @@ module Bundler
237
237
  # raise DirectorySourceError, "The location you specified for #{spec.name}" \
238
238
  # " is '#{spec.location}'. The gemspec was found at '#{existing.location}'."
239
239
  end
240
- elsif !validate_gemspec(spec.location, spec)
241
- raise "Your gem definition is not valid: #{spec}"
240
+ # elsif !validate_gemspec(spec.location, spec)
241
+ # raise "Your gem definition is not valid: #{spec}"
242
242
  else
243
243
  specs[spec.full_name] = spec
244
244
  end
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.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-05 00:00:00 -08:00
13
+ date: 2009-12-07 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16