bundler 0.9.0.pre4 → 0.9.0.pre5
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/README.markdown +1 -1
- data/bin/bundle +1 -1
- data/lib/bundler.rb +20 -17
- data/lib/bundler/cli.rb +9 -1
- data/lib/bundler/definition.rb +4 -2
- data/lib/bundler/dsl.rb +17 -9
- data/lib/bundler/environment.rb +24 -6
- data/lib/bundler/installer.rb +39 -19
- data/lib/bundler/settings.rb +29 -0
- data/lib/bundler/source.rb +53 -33
- data/lib/bundler/ui.rb +7 -3
- metadata +3 -2
data/README.markdown
CHANGED
@@ -85,7 +85,7 @@ To do this, include the following at the beginning of your code.
|
|
85
85
|
|
86
86
|
begin
|
87
87
|
# Require the preresolved locked set of gems.
|
88
|
-
require File.expand_path('
|
88
|
+
require File.expand_path('../.bundle/environment', __FILE__)
|
89
89
|
rescue LoadError
|
90
90
|
# Fallback on doing the resolve at runtime.
|
91
91
|
require "rubygems"
|
data/bin/bundle
CHANGED
data/lib/bundler.rb
CHANGED
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
require 'bundler/rubygems'
|
5
5
|
|
6
6
|
module Bundler
|
7
|
-
VERSION = "0.9.0.
|
7
|
+
VERSION = "0.9.0.pre5"
|
8
8
|
|
9
9
|
autoload :Definition, 'bundler/definition'
|
10
10
|
autoload :Dependency, 'bundler/dependency'
|
@@ -14,6 +14,7 @@ module Bundler
|
|
14
14
|
autoload :Installer, 'bundler/installer'
|
15
15
|
autoload :RemoteSpecification, 'bundler/remote_specification'
|
16
16
|
autoload :Resolver, 'bundler/resolver'
|
17
|
+
autoload :Settings, 'bundler/settings'
|
17
18
|
autoload :Source, 'bundler/source'
|
18
19
|
autoload :Specification, 'bundler/specification'
|
19
20
|
autoload :UI, 'bundler/ui'
|
@@ -33,13 +34,14 @@ module Bundler
|
|
33
34
|
class GemNotFound < BundlerError; status_code(7) ; end
|
34
35
|
class VersionConflict < BundlerError; status_code(6) ; end
|
35
36
|
class GemfileError < BundlerError; status_code(4) ; end
|
37
|
+
class GitError < BundlerError; status_code(11) ; end
|
36
38
|
|
37
39
|
class << self
|
38
40
|
attr_writer :ui, :bundle_path
|
39
41
|
|
40
42
|
def configure
|
41
43
|
@configured ||= begin
|
42
|
-
|
44
|
+
configure_gem_home_and_path
|
43
45
|
true
|
44
46
|
end
|
45
47
|
end
|
@@ -49,7 +51,10 @@ module Bundler
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def bundle_path
|
52
|
-
@bundle_path ||=
|
54
|
+
@bundle_path ||= begin
|
55
|
+
path = settings[:path] || "#{Gem.user_home}/.bundle"
|
56
|
+
Pathname.new(path).expand_path(root)
|
57
|
+
end
|
53
58
|
end
|
54
59
|
|
55
60
|
def setup(*groups)
|
@@ -89,6 +94,10 @@ module Bundler
|
|
89
94
|
default_gemfile.dirname
|
90
95
|
end
|
91
96
|
|
97
|
+
def settings
|
98
|
+
@settings ||= Settings.new(root)
|
99
|
+
end
|
100
|
+
|
92
101
|
private
|
93
102
|
|
94
103
|
def default_gemfile
|
@@ -103,22 +112,16 @@ module Bundler
|
|
103
112
|
raise GemfileNotFound, "The default Gemfile was not found"
|
104
113
|
end
|
105
114
|
|
106
|
-
def
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
env
|
115
|
+
def configure_gem_home_and_path
|
116
|
+
if path = settings[:path]
|
117
|
+
ENV['GEM_HOME'] = File.expand_path(path, root)
|
118
|
+
ENV['GEM_PATH'] = ''
|
119
|
+
else
|
120
|
+
gem_home, gem_path = Gem.dir, Gem.path
|
121
|
+
ENV["GEM_PATH"] = [gem_home, gem_path].flatten.compact.join(File::PATH_SEPARATOR)
|
122
|
+
ENV["GEM_HOME"] = bundle_path.to_s
|
115
123
|
end
|
116
|
-
end
|
117
124
|
|
118
|
-
def point_gem_home(path)
|
119
|
-
return unless path
|
120
|
-
ENV['GEM_HOME'] = File.expand_path(path, root)
|
121
|
-
ENV['GEM_PATH'] = ''
|
122
125
|
Gem.clear_paths
|
123
126
|
end
|
124
127
|
end
|
data/lib/bundler/cli.rb
CHANGED
@@ -48,11 +48,13 @@ module Bundler
|
|
48
48
|
|
49
49
|
desc "install", "Install the current environment to the system"
|
50
50
|
method_option :without, :type => :array, :banner => "Exclude gems thar are part of the specified named group"
|
51
|
-
def install
|
51
|
+
def install(path = nil)
|
52
52
|
opts = options.dup
|
53
53
|
opts[:without] ||= []
|
54
54
|
opts[:without].map! { |g| g.to_sym }
|
55
55
|
|
56
|
+
Bundler.settings[:path] = path if path
|
57
|
+
|
56
58
|
Installer.install(Bundler.root, Bundler.definition, opts)
|
57
59
|
end
|
58
60
|
|
@@ -62,6 +64,12 @@ module Bundler
|
|
62
64
|
environment.lock
|
63
65
|
end
|
64
66
|
|
67
|
+
desc "unlock", "Unlock the bundle. This allows gem versions to be changed"
|
68
|
+
def unlock
|
69
|
+
environment = Bundler.load
|
70
|
+
environment.unlock
|
71
|
+
end
|
72
|
+
|
65
73
|
desc "show", "Shows all gems that are part of the bundle."
|
66
74
|
def show
|
67
75
|
environment = Bundler.load
|
data/lib/bundler/definition.rb
CHANGED
@@ -64,13 +64,15 @@ module Bundler
|
|
64
64
|
|
65
65
|
def actual_dependencies
|
66
66
|
@actual_dependencies ||= @details["specs"].map do |args|
|
67
|
-
|
67
|
+
name, details = args.to_a.flatten
|
68
|
+
details["source"] = sources[details["source"]] if details.include?("source")
|
69
|
+
Bundler::Dependency.new(name, details.delete("version"), details)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
71
73
|
def dependencies
|
72
74
|
@dependencies ||= @details["dependencies"].map do |args|
|
73
|
-
|
75
|
+
Bundler::Dependency.new(*args.to_a.flatten)
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
data/lib/bundler/dsl.rb
CHANGED
@@ -25,8 +25,8 @@ module Bundler
|
|
25
25
|
|
26
26
|
def source(source, options = {})
|
27
27
|
source = case source
|
28
|
-
when :gemcutter, :rubygems, :rubyforge then Source::Rubygems.new(
|
29
|
-
when String then Source::Rubygems.new(
|
28
|
+
when :gemcutter, :rubygems, :rubyforge then Source::Rubygems.new("uri" => "http://gemcutter.org")
|
29
|
+
when String then Source::Rubygems.new("uri" => source)
|
30
30
|
else source
|
31
31
|
end
|
32
32
|
|
@@ -34,12 +34,12 @@ module Bundler
|
|
34
34
|
source
|
35
35
|
end
|
36
36
|
|
37
|
-
def path(path, options = {})
|
38
|
-
source Source::Path.new(options.merge(
|
37
|
+
def path(path, options = {}, source_options = {})
|
38
|
+
source Source::Path.new(_normalize_hash(options).merge("path" => path)), source_options
|
39
39
|
end
|
40
40
|
|
41
|
-
def git(uri, options = {})
|
42
|
-
source Source::Git.new(options.merge(
|
41
|
+
def git(uri, options = {}, source_options = {})
|
42
|
+
source Source::Git.new(_normalize_hash(options).merge("uri" => uri)), source_options
|
43
43
|
end
|
44
44
|
|
45
45
|
def to_definition
|
@@ -59,21 +59,29 @@ module Bundler
|
|
59
59
|
version && Gem::Version.new(version) rescue false
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def _normalize_hash(opts)
|
63
63
|
opts.each do |k, v|
|
64
|
+
next if String === k
|
65
|
+
opts.delete(k)
|
64
66
|
opts[k.to_s] = v
|
65
67
|
end
|
68
|
+
end
|
66
69
|
|
67
|
-
|
70
|
+
def _normalize_options(name, version, opts)
|
71
|
+
_normalize_hash(opts)
|
72
|
+
|
73
|
+
group = opts.delete("group") || @group
|
68
74
|
|
69
75
|
# Normalize git and path options
|
70
76
|
["git", "path"].each do |type|
|
71
77
|
if param = opts[type]
|
72
|
-
source = send(type, param, opts.
|
78
|
+
source = send(type, param, opts.dup, :prepend => true)
|
73
79
|
source.default_spec name, version if _version?(version)
|
74
80
|
opts["source"] = source
|
75
81
|
end
|
76
82
|
end
|
83
|
+
|
84
|
+
opts["group"] = group
|
77
85
|
end
|
78
86
|
end
|
79
87
|
end
|
data/lib/bundler/environment.rb
CHANGED
@@ -20,15 +20,26 @@ module Bundler
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def dependencies
|
23
|
-
@definition.
|
23
|
+
@definition.actual_dependencies
|
24
24
|
end
|
25
25
|
|
26
26
|
def lock
|
27
|
-
Bundler.ui.info("The bundle is already locked, relocking.")
|
28
|
-
FileUtils.mkdir_p("#{root}
|
27
|
+
Bundler.ui.info("The bundle is already locked, relocking.") if locked?
|
28
|
+
FileUtils.mkdir_p("#{root}/.bundle")
|
29
29
|
write_yml_lock
|
30
30
|
write_rb_lock
|
31
|
-
Bundler.ui.info("The bundle is locked. Use `bundle show` to list the gems in the environment.")
|
31
|
+
Bundler.ui.info("The bundle is now locked. Use `bundle show` to list the gems in the environment.")
|
32
|
+
end
|
33
|
+
|
34
|
+
def unlock
|
35
|
+
unless locked?
|
36
|
+
Bundler.ui.info("The bundle is not currently locked.")
|
37
|
+
return
|
38
|
+
end
|
39
|
+
|
40
|
+
FileUtils.rm_f("#{root}/.bundle/environment.rb")
|
41
|
+
FileUtils.rm_f("#{root}/Gemfile.lock")
|
42
|
+
Bundler.ui.info("The bundle is now unlocked. The dependencies may be changed.")
|
32
43
|
end
|
33
44
|
|
34
45
|
def locked?
|
@@ -70,6 +81,7 @@ module Bundler
|
|
70
81
|
possibilities = Gem.path.map { |p| "#{p}/cache/#{spec.full_name}.gem" }
|
71
82
|
cached_path = possibilities.find { |p| File.exist? p }
|
72
83
|
Bundler.ui.info " * #{File.basename(cached_path)}"
|
84
|
+
next if File.expand_path(File.dirname(cached_path)) == File.expand_path(pack_path)
|
73
85
|
FileUtils.cp(cached_path, pack_path)
|
74
86
|
end
|
75
87
|
end
|
@@ -113,7 +125,7 @@ module Bundler
|
|
113
125
|
def write_rb_lock
|
114
126
|
template = File.read(File.expand_path("../templates/environment.erb", __FILE__))
|
115
127
|
erb = ERB.new(template, nil, '-')
|
116
|
-
File.open("#{root}/
|
128
|
+
File.open("#{root}/.bundle/environment.rb", 'w') do |f|
|
117
129
|
f.puts erb.result(binding)
|
118
130
|
end
|
119
131
|
end
|
@@ -128,7 +140,13 @@ module Bundler
|
|
128
140
|
def details
|
129
141
|
details = {}
|
130
142
|
details["sources"] = sources.map { |s| { s.class.name.split("::").last => s.options} }
|
131
|
-
|
143
|
+
|
144
|
+
details["specs"] = specs.map do |s|
|
145
|
+
options = {"version" => s.version.to_s}
|
146
|
+
options["source"] = sources.index(s.source) if sources.include?(s.source)
|
147
|
+
{ s.name => options }
|
148
|
+
end
|
149
|
+
|
132
150
|
details["dependencies"] = dependencies.map { |d| {d.name => d.version_requirements.to_s} }
|
133
151
|
details
|
134
152
|
end
|
data/lib/bundler/installer.rb
CHANGED
@@ -20,15 +20,19 @@ module Bundler
|
|
20
20
|
end
|
21
21
|
|
22
22
|
specs.sort_by { |s| s.name }.each do |spec|
|
23
|
-
|
23
|
+
# unless spec.source.is_a?(Source::SystemGems)
|
24
|
+
Bundler.ui.info "Installing #{spec.name} (#{spec.version}) from #{spec.source} "
|
25
|
+
# end
|
26
|
+
|
24
27
|
if (spec.groups & options[:without]).any?
|
25
|
-
Bundler.ui.
|
28
|
+
Bundler.ui.debug " * Not in requested group... skipping."
|
26
29
|
next
|
27
30
|
end
|
28
31
|
spec.source.install(spec)
|
32
|
+
Bundler.ui.info ""
|
29
33
|
end
|
30
34
|
|
31
|
-
Bundler.ui.confirm "
|
35
|
+
Bundler.ui.confirm "Your bundle is complete!"
|
32
36
|
end
|
33
37
|
|
34
38
|
def dependencies
|
@@ -47,13 +51,7 @@ module Bundler
|
|
47
51
|
|
48
52
|
def resolve_locally
|
49
53
|
# Return unless all the dependencies have = version requirements
|
50
|
-
return
|
51
|
-
|
52
|
-
index = local_index
|
53
|
-
sources.each do |source|
|
54
|
-
next unless source.respond_to?(:local_specs)
|
55
|
-
index = source.local_specs.merge(index)
|
56
|
-
end
|
54
|
+
return if dependencies.any? { |d| ambiguous?(d) }
|
57
55
|
|
58
56
|
source_requirements = {}
|
59
57
|
dependencies.each do |dep|
|
@@ -68,6 +66,7 @@ module Bundler
|
|
68
66
|
specs.length == dependencies.length && specs
|
69
67
|
rescue Bundler::GemNotFound
|
70
68
|
nil
|
69
|
+
raise if ENV["OMG"]
|
71
70
|
end
|
72
71
|
|
73
72
|
def resolve_remotely
|
@@ -101,19 +100,35 @@ module Bundler
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
104
|
-
def
|
105
|
-
dep.version_requirements.requirements.
|
103
|
+
def ambiguous?(dep)
|
104
|
+
dep.version_requirements.requirements.any? { |op,_| op != '=' }
|
106
105
|
end
|
107
106
|
|
108
107
|
def index
|
109
108
|
@index ||= begin
|
110
|
-
index =
|
109
|
+
index = Index.new
|
111
110
|
|
112
|
-
|
111
|
+
if File.directory?("#{root}/vendor/cache")
|
112
|
+
index = cache_source.specs.merge(index).freeze
|
113
|
+
end
|
114
|
+
|
115
|
+
rg_sources = sources.select { |s| s.is_a?(Source::Rubygems) }
|
116
|
+
other_sources = sources.select { |s| !s.is_a?(Source::Rubygems) }
|
117
|
+
|
118
|
+
other_sources.each do |source|
|
113
119
|
i = source.specs
|
114
|
-
Bundler.ui.
|
120
|
+
Bundler.ui.debug "Source: Processing index... "
|
115
121
|
index = i.merge(index).freeze
|
116
|
-
Bundler.ui.
|
122
|
+
Bundler.ui.debug "Done."
|
123
|
+
end
|
124
|
+
|
125
|
+
index = Index.from_installed_gems.merge(index)
|
126
|
+
|
127
|
+
rg_sources.each do |source|
|
128
|
+
i = source.specs
|
129
|
+
Bundler.ui.debug "Source: Processing index... "
|
130
|
+
index = i.merge(index).freeze
|
131
|
+
Bundler.ui.debug "Done."
|
117
132
|
end
|
118
133
|
|
119
134
|
index
|
@@ -122,18 +137,23 @@ module Bundler
|
|
122
137
|
|
123
138
|
def local_index
|
124
139
|
@local_index ||= begin
|
125
|
-
index = Index.
|
140
|
+
index = Index.new
|
141
|
+
|
142
|
+
sources.each do |source|
|
143
|
+
next unless source.respond_to?(:local_specs)
|
144
|
+
index = source.local_specs.merge(index)
|
145
|
+
end
|
126
146
|
|
127
147
|
if File.directory?("#{root}/vendor/cache")
|
128
148
|
index = cache_source.specs.merge(index).freeze
|
129
149
|
end
|
130
150
|
|
131
|
-
index
|
151
|
+
Index.from_installed_gems.merge(index)
|
132
152
|
end
|
133
153
|
end
|
134
154
|
|
135
155
|
def cache_source
|
136
|
-
Source::GemCache.new(
|
156
|
+
Source::GemCache.new("path" => "#{root}/vendor/cache")
|
137
157
|
end
|
138
158
|
|
139
159
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bundler
|
2
|
+
class Settings
|
3
|
+
def initialize(root)
|
4
|
+
@root = root
|
5
|
+
@config = File.exist?(config_file) ? YAML.load_file(config_file) : {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def [](key)
|
9
|
+
key = "BUNDLE_#{key.to_s.upcase}"
|
10
|
+
@config[key] || ENV[key]
|
11
|
+
end
|
12
|
+
|
13
|
+
def []=(key, value)
|
14
|
+
key = "BUNDLE_#{key.to_s.upcase}"
|
15
|
+
@config[key] = value
|
16
|
+
FileUtils.mkdir_p(config_file.dirname)
|
17
|
+
File.open(config_file, 'w') do |f|
|
18
|
+
f.puts @config.to_yaml
|
19
|
+
end
|
20
|
+
value
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def config_file
|
26
|
+
Pathname.new("#{@root}/.bundle/config")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bundler/source.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "rubygems/remote_fetcher"
|
2
2
|
require "rubygems/format"
|
3
3
|
require "digest/sha1"
|
4
|
+
require "open3"
|
4
5
|
|
5
6
|
module Bundler
|
6
7
|
module Source
|
@@ -9,11 +10,15 @@ module Bundler
|
|
9
10
|
|
10
11
|
def initialize(options = {})
|
11
12
|
@options = options
|
12
|
-
@uri = options[
|
13
|
+
@uri = options["uri"]
|
13
14
|
@uri = URI.parse(@uri) unless @uri.is_a?(URI)
|
14
15
|
raise ArgumentError, "The source must be an absolute URI" unless @uri.absolute?
|
15
16
|
end
|
16
17
|
|
18
|
+
def to_s
|
19
|
+
"rubygems repository at `#{uri}`"
|
20
|
+
end
|
21
|
+
|
17
22
|
def specs
|
18
23
|
@specs ||= fetch_specs
|
19
24
|
end
|
@@ -21,9 +26,9 @@ module Bundler
|
|
21
26
|
def install(spec)
|
22
27
|
destination = Gem.dir
|
23
28
|
|
24
|
-
Bundler.ui.
|
29
|
+
Bundler.ui.debug " * Downloading..."
|
25
30
|
gem_path = Gem::RemoteFetcher.fetcher.download(spec, uri, destination)
|
26
|
-
Bundler.ui.
|
31
|
+
Bundler.ui.debug " * Installing..."
|
27
32
|
installer = Gem::Installer.new gem_path,
|
28
33
|
:install_dir => Gem.dir,
|
29
34
|
:ignore_dependencies => true
|
@@ -35,14 +40,14 @@ module Bundler
|
|
35
40
|
|
36
41
|
def fetch_specs
|
37
42
|
index = Index.new
|
38
|
-
Bundler.ui.info "
|
43
|
+
Bundler.ui.info "Fetching source index from `#{uri}`... "
|
39
44
|
(main_specs + prerelease_specs).each do |name, version, platform|
|
40
45
|
next unless Gem::Platform.match(platform)
|
41
46
|
spec = RemoteSpecification.new(name, version, platform, @uri)
|
42
47
|
spec.source = self
|
43
48
|
index << spec
|
44
49
|
end
|
45
|
-
Bundler.ui.info "
|
50
|
+
Bundler.ui.info "Done."
|
46
51
|
index.freeze
|
47
52
|
end
|
48
53
|
|
@@ -75,17 +80,21 @@ module Bundler
|
|
75
80
|
end
|
76
81
|
|
77
82
|
def to_s
|
78
|
-
"
|
83
|
+
"system gems"
|
79
84
|
end
|
80
85
|
|
81
86
|
def install(spec)
|
82
|
-
Bundler.ui.
|
87
|
+
Bundler.ui.debug " * already installed... skipping"
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
86
91
|
class GemCache
|
87
92
|
def initialize(options)
|
88
|
-
@path = options[
|
93
|
+
@path = options["path"]
|
94
|
+
end
|
95
|
+
|
96
|
+
def to_s
|
97
|
+
".gem files at #{@path}"
|
89
98
|
end
|
90
99
|
|
91
100
|
def specs
|
@@ -105,7 +114,7 @@ module Bundler
|
|
105
114
|
def install(spec)
|
106
115
|
destination = Gem.dir
|
107
116
|
|
108
|
-
Bundler.ui.
|
117
|
+
Bundler.ui.debug " * Installing from pack..."
|
109
118
|
installer = Gem::Installer.new "#{@path}/#{spec.full_name}.gem",
|
110
119
|
:install_dir => Gem.dir,
|
111
120
|
:ignore_dependencies => true
|
@@ -119,11 +128,15 @@ module Bundler
|
|
119
128
|
|
120
129
|
def initialize(options)
|
121
130
|
@options = options
|
122
|
-
@glob = options[
|
123
|
-
@path = options[
|
131
|
+
@glob = options["glob"] || "{,*/}*.gemspec"
|
132
|
+
@path = options["path"]
|
124
133
|
@default_spec = nil
|
125
134
|
end
|
126
135
|
|
136
|
+
def to_s
|
137
|
+
"source code at #{@path}"
|
138
|
+
end
|
139
|
+
|
127
140
|
def default_spec(*args)
|
128
141
|
return @default_spec if args.empty?
|
129
142
|
name, version = *args
|
@@ -160,7 +173,7 @@ module Bundler
|
|
160
173
|
end
|
161
174
|
|
162
175
|
def install(spec)
|
163
|
-
Bundler.ui.
|
176
|
+
Bundler.ui.debug " * Using path `#{path}`..."
|
164
177
|
end
|
165
178
|
|
166
179
|
alias specs local_specs
|
@@ -172,23 +185,24 @@ module Bundler
|
|
172
185
|
|
173
186
|
def initialize(options)
|
174
187
|
@options = options
|
175
|
-
@glob = options[
|
176
|
-
@uri = options[
|
177
|
-
@ref = options[
|
188
|
+
@glob = options["glob"] || "{,*/}*.gemspec"
|
189
|
+
@uri = options["uri"]
|
190
|
+
@ref = options["ref"] || options["branch"] || 'master'
|
191
|
+
end
|
192
|
+
|
193
|
+
def to_s
|
194
|
+
ref = @options["ref"] ? @options["ref"][0..6] : @ref
|
195
|
+
"#{@uri} (at #{ref})"
|
178
196
|
end
|
179
197
|
|
180
198
|
def options
|
181
|
-
@options.merge(
|
199
|
+
@options.merge("ref" => revision)
|
182
200
|
end
|
183
201
|
|
184
202
|
def path
|
185
203
|
Bundler.install_path.join("#{base_name}-#{uri_hash}-#{ref}")
|
186
204
|
end
|
187
205
|
|
188
|
-
def to_s
|
189
|
-
@uri
|
190
|
-
end
|
191
|
-
|
192
206
|
def specs
|
193
207
|
@specs ||= begin
|
194
208
|
index = Index.new
|
@@ -220,21 +234,19 @@ module Bundler
|
|
220
234
|
end
|
221
235
|
|
222
236
|
def install(spec)
|
223
|
-
Bundler.ui.
|
237
|
+
Bundler.ui.debug " * Using git `#{uri}`..."
|
224
238
|
|
225
239
|
if @installed
|
226
|
-
Bundler.ui.
|
240
|
+
Bundler.ui.debug " * Already checked out revision: #{ref}..."
|
227
241
|
else
|
228
|
-
Bundler.ui.
|
242
|
+
Bundler.ui.debug " * Checking out revision: #{ref}..."
|
229
243
|
FileUtils.mkdir_p(path)
|
230
244
|
Dir.chdir(path) do
|
231
245
|
unless File.exist?(".git")
|
232
|
-
%x(git clone --
|
246
|
+
%x(git clone --no-checkout #{cache_path} #{path})
|
233
247
|
end
|
234
|
-
|
235
|
-
|
236
|
-
%x(git submodule init)
|
237
|
-
%x(git submodule update)
|
248
|
+
git "fetch --quiet"
|
249
|
+
git "reset --hard #{revision}"
|
238
250
|
end
|
239
251
|
@installed = true
|
240
252
|
end
|
@@ -242,6 +254,14 @@ module Bundler
|
|
242
254
|
|
243
255
|
private
|
244
256
|
|
257
|
+
def git(command)
|
258
|
+
out = %x{git #{command}}
|
259
|
+
if $? != 0
|
260
|
+
raise GitError, "An error has occurred in git. Cannot complete bundling."
|
261
|
+
end
|
262
|
+
out
|
263
|
+
end
|
264
|
+
|
245
265
|
def base_name
|
246
266
|
File.basename(uri, ".git")
|
247
267
|
end
|
@@ -256,18 +276,18 @@ module Bundler
|
|
256
276
|
|
257
277
|
def cache
|
258
278
|
if cache_path.exist?
|
259
|
-
Bundler.ui.info "
|
260
|
-
in_cache {
|
279
|
+
Bundler.ui.info "Updating `#{uri}`... "
|
280
|
+
in_cache { git "fetch --quiet #{uri} master:master" }
|
261
281
|
else
|
262
|
-
Bundler.ui.info "
|
282
|
+
Bundler.ui.info "Fetching `#{uri}`... "
|
263
283
|
FileUtils.mkdir_p(cache_path.dirname)
|
264
|
-
|
284
|
+
git "clone #{uri} #{cache_path} --bare --no-hardlinks"
|
265
285
|
end
|
266
286
|
Bundler.ui.info "Done."
|
267
287
|
end
|
268
288
|
|
269
289
|
def revision
|
270
|
-
@revision ||= in_cache {
|
290
|
+
@revision ||= in_cache { git("rev-parse #{ref}").strip }
|
271
291
|
end
|
272
292
|
|
273
293
|
def in_cache(&blk)
|
data/lib/bundler/ui.rb
CHANGED
@@ -17,6 +17,10 @@ module Bundler
|
|
17
17
|
@shell = shell
|
18
18
|
end
|
19
19
|
|
20
|
+
# TODO: Add debug mode
|
21
|
+
def debug(msg)
|
22
|
+
end
|
23
|
+
|
20
24
|
def info(msg)
|
21
25
|
@shell.say(msg)
|
22
26
|
end
|
@@ -30,7 +34,7 @@ module Bundler
|
|
30
34
|
end
|
31
35
|
|
32
36
|
def error(msg)
|
33
|
-
@shell.say(msg, :
|
37
|
+
@shell.say(msg, :red)
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
@@ -41,9 +45,9 @@ module Bundler
|
|
41
45
|
|
42
46
|
def say(message)
|
43
47
|
if message =~ /native extensions/
|
44
|
-
@ui.info "
|
48
|
+
@ui.info "with native extensions "
|
45
49
|
else
|
46
|
-
@ui.
|
50
|
+
@ui.debug(message)
|
47
51
|
end
|
48
52
|
end
|
49
53
|
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.9.0.
|
4
|
+
version: 0.9.0.pre5
|
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-03 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/bundler/remote_specification.rb
|
36
36
|
- lib/bundler/resolver.rb
|
37
37
|
- lib/bundler/rubygems.rb
|
38
|
+
- lib/bundler/settings.rb
|
38
39
|
- lib/bundler/setup.rb
|
39
40
|
- lib/bundler/source.rb
|
40
41
|
- lib/bundler/specification.rb
|