bundler 0.9.12 → 0.9.13

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.

@@ -4,7 +4,7 @@ require 'yaml'
4
4
  require 'bundler/rubygems_ext'
5
5
 
6
6
  module Bundler
7
- VERSION = "0.9.12"
7
+ VERSION = "0.9.13"
8
8
 
9
9
  autoload :Definition, 'bundler/definition'
10
10
  autoload :Dependency, 'bundler/dependency'
@@ -24,6 +24,10 @@ module Bundler
24
24
  end
25
25
  end
26
26
 
27
+ def specs
28
+ @specs ||= resolve_locally || resolve_remotely
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def runtime_gems
@@ -36,6 +40,25 @@ module Bundler
36
40
  end
37
41
  end
38
42
 
43
+ def resolve(type, index)
44
+ source_requirements = {}
45
+ actual_dependencies.each do |dep|
46
+ next unless dep.source && dep.source.respond_to?(type)
47
+ source_requirements[dep.name] = dep.source.send(type)
48
+ end
49
+
50
+ # Run a resolve against the locally available gems
51
+ Resolver.resolve(actual_dependencies, index, source_requirements)
52
+ end
53
+
54
+ def resolve_locally
55
+ resolve(:local_specs, index)
56
+ end
57
+
58
+ def resolve_remotely
59
+ raise NotImplementedError
60
+ end
61
+
39
62
  def specs_for(groups)
40
63
  deps = dependencies.select { |d| (d.groups & groups).any? }
41
64
  # deps.any? ? specs.for(deps) : specs
@@ -72,11 +95,10 @@ module Bundler
72
95
  :name => s.name,
73
96
  :load_paths => s.load_paths
74
97
  }
75
- if s.respond_to?(:virtual) && s.virtual
98
+ if s.respond_to?(:relative_loaded_from) && s.relative_loaded_from
76
99
  hash[:virtual_spec] = s.to_ruby
77
- else
78
- hash[:loaded_from] = s.loaded_from.to_s
79
100
  end
101
+ hash[:loaded_from] = s.loaded_from.to_s
80
102
  hash
81
103
  end
82
104
  end
@@ -48,10 +48,6 @@ module Bundler
48
48
  @definition.actual_dependencies
49
49
  end
50
50
 
51
- def specs
52
- @specs ||= resolve_locally || resolve_remotely
53
- end
54
-
55
51
  private
56
52
 
57
53
  def sources
@@ -62,14 +58,7 @@ module Bundler
62
58
  # Return unless all the dependencies have = version requirements
63
59
  return if actual_dependencies.any? { |d| ambiguous?(d) }
64
60
 
65
- source_requirements = {}
66
- actual_dependencies.each do |dep|
67
- next unless dep.source && dep.source.respond_to?(:local_specs)
68
- source_requirements[dep.name] = dep.source.local_specs
69
- end
70
-
71
- # Run a resolve against the locally available gems
72
- specs = Resolver.resolve(actual_dependencies, index, source_requirements)
61
+ specs = super
73
62
 
74
63
  # Simple logic for now. Can improve later.
75
64
  specs.length == actual_dependencies.length && specs
@@ -78,16 +67,7 @@ module Bundler
78
67
  end
79
68
 
80
69
  def resolve_remotely
81
- remote_index # trigger building the index
82
- Bundler.ui.info "Resolving dependencies"
83
- source_requirements = {}
84
- actual_dependencies.each do |dep|
85
- next unless dep.source
86
- source_requirements[dep.name] = dep.source.specs
87
- end
88
-
89
- specs = Resolver.resolve(actual_dependencies, remote_index, source_requirements)
90
- specs
70
+ resolve(:specs, remote_index)
91
71
  end
92
72
 
93
73
  def ambiguous?(dep)
@@ -63,7 +63,11 @@ module Bundler
63
63
  end
64
64
 
65
65
  def debug
66
- puts yield if defined?($debug) && $debug
66
+ if ENV['DEBUG_RESOLVER']
67
+ debug_info = yield
68
+ debug_info = debug_info.inpsect unless debug_info.is_a?(String)
69
+ $stderr.puts debug_info
70
+ end
67
71
  end
68
72
 
69
73
  def resolve(reqs, activated)
@@ -71,7 +75,7 @@ module Bundler
71
75
  # gem dependencies have been resolved.
72
76
  throw :success, activated if reqs.empty?
73
77
 
74
- debug { STDIN.gets ; print "\e[2J\e[f" ; "==== Iterating ====\n\n" }
78
+ debug { print "\e[2J\e[f" ; "==== Iterating ====\n\n" }
75
79
 
76
80
  # Sort dependencies so that the ones that are easiest to resolve are first.
77
81
  # Easiest to resolve is defined by:
@@ -75,18 +75,6 @@ module Bundler
75
75
  end
76
76
  end
77
77
 
78
- def specs
79
- @specs ||= begin
80
- source_requirements = {}
81
- actual_dependencies.each do |dep|
82
- next unless dep.source && dep.source.respond_to?(:local_specs)
83
- source_requirements[dep.name] = dep.source.local_specs
84
- end
85
-
86
- Resolver.resolve(@definition.actual_dependencies, index, source_requirements)
87
- end
88
- end
89
-
90
78
  alias gems specs
91
79
 
92
80
  def cache
@@ -126,7 +126,9 @@ module Bundler
126
126
  exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
127
127
  end
128
128
 
129
- File.join(spec.full_gem_path, spec.bindir, exec_name)
129
+ gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
130
+ gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
131
+ File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
130
132
  end
131
133
  end
132
134
 
@@ -155,7 +155,6 @@ module Bundler
155
155
  s.version = Gem::Version.new(options["version"])
156
156
  s.summary = "Fake gemspec for #{options["name"]}"
157
157
  s.relative_loaded_from = "#{options["name"]}.gemspec"
158
- s.virtual = true
159
158
  end
160
159
  end
161
160
  end
@@ -316,17 +315,17 @@ module Bundler
316
315
  def cache
317
316
  if cache_path.exist?
318
317
  Bundler.ui.info "Updating #{uri}"
319
- in_cache { git "fetch --quiet '#{uri}' master:master" }
318
+ in_cache { git %|fetch --quiet "#{uri}" master:master| }
320
319
  else
321
320
  Bundler.ui.info "Fetching #{uri}"
322
321
  FileUtils.mkdir_p(cache_path.dirname)
323
- git "clone '#{uri}' '#{cache_path}' --bare --no-hardlinks"
322
+ git %|clone "#{uri}" "#{cache_path}" --bare --no-hardlinks|
324
323
  end
325
324
  end
326
325
 
327
326
  def checkout
328
327
  unless File.exist?(path.join(".git"))
329
- git "clone --no-checkout '#{cache_path}' '#{path}'"
328
+ git %|clone --no-checkout "#{cache_path}" "#{path}"|
330
329
  end
331
330
  Dir.chdir(path) do
332
331
  git "fetch --quiet"
@@ -36,7 +36,7 @@ module Bundler
36
36
  return if specs[current.name]
37
37
  specs[current.name] = true
38
38
  current.dependencies.each do |dep|
39
- next unless dep.type == :runtime
39
+ next if dep.type == :development
40
40
  append_subgraph(specs, lookup[dep.name])
41
41
  end
42
42
  end
@@ -1,6 +1,6 @@
1
1
  module Bundler
2
2
  class Specification < Gem::Specification
3
- attr_accessor :relative_loaded_from, :virtual
3
+ attr_accessor :relative_loaded_from
4
4
 
5
5
  def self.from_gemspec(gemspec)
6
6
  spec = allocate
@@ -1,7 +1,7 @@
1
1
  # DO NOT MODIFY THIS FILE
2
2
 
3
3
  require 'digest/sha1'
4
- require "rubygems"
4
+ require 'rubygems'
5
5
 
6
6
  <%= shared_helpers %>
7
7
 
@@ -14,11 +14,11 @@ module Bundler
14
14
  <%= spec.inspect %>,
15
15
  <% end -%>
16
16
  ].map do |hash|
17
- if hash[:loaded_from]
17
+ if hash[:virtual_spec]
18
+ spec = eval(hash[:virtual_spec], binding, "<virtual spec for '#{hash[:name]}'>")
19
+ else
18
20
  dir = File.dirname(hash[:loaded_from])
19
21
  spec = Dir.chdir(dir){ eval(File.read(hash[:loaded_from]), binding, hash[:loaded_from]) }
20
- else
21
- spec = eval(hash[:virtual_spec], binding, "<virtual spec for '#{hash[:name]}'>")
22
22
  end
23
23
  spec.loaded_from = hash[:loaded_from]
24
24
  spec.require_paths = hash[:load_paths]
@@ -27,6 +27,15 @@ module Bundler
27
27
 
28
28
  extend SharedHelpers
29
29
 
30
+ def self.configure_gem_path_and_home(specs)
31
+ # Fix paths, so that Gem.source_index and such will work
32
+ paths = specs.map{|s| s.installation_path }
33
+ paths.flatten!; paths.compact!; paths.uniq!; paths.reject!{|p| p.empty? }
34
+ ENV['GEM_PATH'] = paths.join(File::PATH_SEPARATOR)
35
+ ENV['GEM_HOME'] = paths.first
36
+ Gem.clear_paths
37
+ end
38
+
30
39
  def self.match_fingerprint
31
40
  print = Digest::SHA1.hexdigest(File.read(File.expand_path('../../Gemfile', __FILE__)))
32
41
  unless print == FINGERPRINT
@@ -38,6 +47,7 @@ module Bundler
38
47
  match_fingerprint
39
48
  clean_load_path
40
49
  cripple_rubygems(SPECS)
50
+ configure_gem_path_and_home(SPECS)
41
51
  SPECS.each do |spec|
42
52
  Gem.loaded_specs[spec.name] = spec
43
53
  $LOAD_PATH.unshift(*spec.require_paths)
@@ -17,8 +17,8 @@ module Bundler
17
17
  @shell = shell
18
18
  end
19
19
 
20
- # TODO: Add debug mode
21
20
  def debug(msg)
21
+ @shell.say(msg) if ENV['DEBUG']
22
22
  end
23
23
 
24
24
  def info(msg)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 12
9
- version: 0.9.12
8
+ - 13
9
+ version: 0.9.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - Carl Lerche
@@ -16,10 +16,21 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-03-17 00:00:00 -07:00
19
+ date: 2010-03-23 00:00:00 -07:00
20
20
  default_executable:
21
- dependencies: []
22
-
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: rspec
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
23
34
  description:
24
35
  email:
25
36
  - carlhuda@engineyard.com