Skip to content
Newer
Older
100644 233 lines (190 sloc) 5.93 KB
63b636b First pass at gemfile pack
Carlhuda authored Jan 25, 2010
1 require 'fileutils'
ce350cc Get a simple bbl install working
Carlhuda authored Jan 11, 2010
2 require 'pathname'
88741e6 First pass at bbl lock
Carlhuda authored Jan 18, 2010
3 require 'yaml'
820bb93 Rename rubygems-ext to rubygems_ext
Carl Lerche authored Feb 18, 2010
4 require 'bundler/rubygems_ext'
1da7eb3 Don't generate bundler.gemspec anymore
Carlhuda authored Apr 1, 2010
5 require 'bundler/version'
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored Mar 26, 2010
6
152a50a Rename gemfile back to bundler
Carl Lerche authored Jan 26, 2010
7 module Bundler
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored Mar 26, 2010
8 ORIGINAL_ENV = ENV.to_hash
67859e4 Moving in thor
Carlhuda authored Jan 11, 2010
9
152a50a Rename gemfile back to bundler
Carl Lerche authored Jan 26, 2010
10 autoload :Definition, 'bundler/definition'
11 autoload :Dependency, 'bundler/dependency'
12 autoload :Dsl, 'bundler/dsl'
13 autoload :Environment, 'bundler/environment'
f414889 @kevmoo 'bundle viz'
kevmoo authored May 13, 2010
14 autoload :Graph, 'bundler/graph'
152a50a Rename gemfile back to bundler
Carl Lerche authored Jan 26, 2010
15 autoload :Index, 'bundler/index'
16 autoload :Installer, 'bundler/installer'
f779dee First pass at lockfile parser
Carlhuda authored Apr 20, 2010
17 autoload :LazySpecification, 'bundler/lazy_specification'
ba579f4 Remove temporary flex stuff
Carlhuda authored Apr 20, 2010
18 autoload :LockfileParser, 'bundler/lockfile_parser'
152a50a Rename gemfile back to bundler
Carl Lerche authored Jan 26, 2010
19 autoload :RemoteSpecification, 'bundler/remote_specification'
20 autoload :Resolver, 'bundler/resolver'
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored Feb 3, 2010
21 autoload :Runtime, 'bundler/runtime'
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored Feb 2, 2010
22 autoload :Settings, 'bundler/settings'
f7bfdde Actually disable system gems in .bundle/environment.rb
Carlhuda authored Feb 10, 2010
23 autoload :SharedHelpers, 'bundler/shared_helpers'
529d792 Use tsort to order specifications. It makes teh crazy work.
Carl Lerche authored Mar 9, 2010
24 autoload :SpecSet, 'bundler/spec_set'
152a50a Rename gemfile back to bundler
Carl Lerche authored Jan 26, 2010
25 autoload :Source, 'bundler/source'
0f97e4f @indirect Gems from git need their full_gem_path fixed, even when locked
indirect authored Apr 9, 2010
26 autoload :Specification, 'bundler/shared_helpers'
434fb42 First pass at output
Carlhuda authored Jan 26, 2010
27 autoload :UI, 'bundler/ui'
67859e4 Moving in thor
Carlhuda authored Jan 11, 2010
28
de5054a Rescue all Bundler exceptions and exit with appropriate error code
Carlhuda authored Feb 1, 2010
29 class BundlerError < StandardError
30 def self.status_code(code = nil)
31 return @code unless code
32 @code = code
33 end
34
35 def status_code
36 self.class.status_code
37 end
38 end
39
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored Feb 4, 2010
40 class GemfileNotFound < BundlerError; status_code(10) ; end
41 class GemNotFound < BundlerError; status_code(7) ; end
42 class GemfileError < BundlerError; status_code(4) ; end
ef6a00f @indirect Print better error during install when you need to relock
indirect authored Apr 11, 2010
43 class GemfileChanged < GemfileError; status_code(4) ; end
248ca34 Raise a better error in the case that a git repo is not cloned yet.
Carl Lerche authored Mar 9, 2010
44 class PathError < BundlerError; status_code(13) ; end
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored Feb 4, 2010
45 class GitError < BundlerError; status_code(11) ; end
6a82ed0 @indirect Add GemspecError so it can be raised
indirect authored Apr 19, 2010
46 class GemspecError < BundlerError; status_code(14) ; end
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored Feb 4, 2010
47 class DeprecatedMethod < BundlerError; status_code(12) ; end
48 class DeprecatedOption < BundlerError; status_code(12) ; end
2a24019 @indirect Print a useful error if a gemspec require fails
indirect authored Mar 30, 2010
49 class GemspecError < BundlerError; status_code(14) ; end
7514b20 @wycats If an option is invalid, don't fail silently
wycats authored Apr 1, 2010
50 class InvalidOption < BundlerError; status_code(15) ; end
67859e4 Moving in thor
Carlhuda authored Jan 11, 2010
51
3edfddb Hacked together some crap that doesn't really work
Carl Lerche authored Jun 3, 2010
52 class VersionConflict < BundlerError
53 attr_reader :conflicts
54
55 def initialize(conflicts, msg = nil)
56 super(msg)
57 @conflicts = conflicts
58 end
59
60 status_code(6)
61 end
62
cf736cf Use the Lockfile's specs as LazySpecifications instead of converting …
Carl Lerche authored Jun 2, 2010
63 # Internal errors, should be rescued
64 class InvalidSpecSet < StandardError; end
65
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
66 class << self
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored Feb 1, 2010
67 attr_writer :ui, :bundle_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
68
69 def configure
70 @configured ||= begin
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
71 configure_gem_home_and_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
72 true
73 end
74 end
434fb42 First pass at output
Carlhuda authored Jan 27, 2010
75
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
76 def ui
77 @ui ||= UI.new
78 end
434fb42 First pass at output
Carlhuda authored Jan 27, 2010
79
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored Feb 1, 2010
80 def bundle_path
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
81 @bundle_path ||= begin
8f2099b Have bundler install to $GEM_HOME by default instead of ~/.bundle. Th…
Carlhuda authored Apr 22, 2010
82 path = settings[:path] || Gem.dir
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
83 Pathname.new(path).expand_path(root)
84 end
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored Feb 1, 2010
85 end
86
5f26a03 Have bundler generate executable stubs into ~/.bundler/bin that will …
Carl Lerche authored May 9, 2010
87 def bin_path
88 @bin_path ||= begin
e9e7990 @indirect Use ~/.bundle/bin, since 0.9 uses ~/.bundle
indirect authored Jun 7, 2010
89 path = settings[:bin] || "#{Gem.user_home}/.bundle/bin"
5f26a03 Have bundler generate executable stubs into ~/.bundler/bin that will …
Carl Lerche authored May 8, 2010
90 FileUtils.mkdir_p(path)
91 Pathname.new(path).expand_path
92 end
93 end
94
1674aef No need to alias setup and require in Bundler
Carl Lerche authored Apr 23, 2010
95 def setup(*groups)
2c8d6ae @indirect Don't call #setup after loading env.rb in Bundler.load
indirect authored Apr 9, 2010
96 return @setup if @setup
97
5dfc54c @indirect Don't call exit! if Bundler.setup has an exception
indirect authored Apr 21, 2010
98 if groups.empty?
99 # Load all groups, but only once
100 @setup = load.setup
101 else
102 # Figure out which groups haven't been loaded yet
103 unloaded = groups - (@completed_groups || [])
104 # Record groups that are now loaded
105 @completed_groups = groups | (@completed_groups || [])
106 # Load any groups that are not yet loaded
107 unloaded.any? ? load.setup(*unloaded) : load
4980111 @indirect Fix Bundler.setup so it can be called more than once safely
indirect authored Apr 8, 2010
108 end
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
109 end
ce350cc Get a simple bbl install working
Carlhuda authored Jan 12, 2010
110
1674aef No need to alias setup and require in Bundler
Carl Lerche authored Apr 23, 2010
111 def require(*groups)
69acfd8 @indirect Call Bundler.setup from Bundler.require, only set up each group once
indirect authored Apr 5, 2010
112 setup(*groups).require(*groups)
a8cbf77 @jeremy Group autorequire: pass :require => 'autorequire' option to gem depen…
jeremy authored Feb 3, 2010
113 end
114
625818a @indirect Clean up bundler.rb a bit
indirect authored Mar 31, 2010
115 def load
91c74f4 Bundle.load and Bundle.runtime are the same thing again.
Carl Lerche authored Apr 24, 2010
116 @load ||= Runtime.new(root, definition)
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
117 end
67859e4 Moving in thor
Carlhuda authored Jan 11, 2010
118
3687843 @kevmoo check only needs Environment (not Runtime)
kevmoo authored May 22, 2010
119 def environment
120 Bundler::Environment.new(root, definition)
121 end
122
8a4dc7a Remove a little bit of crazy from Definition
Carl Lerche authored Jun 2, 2010
123 def definition(unlock = nil)
124 @definition = nil if unlock
2b9094e Scope specs in the lock file by source
Carl Lerche authored May 10, 2010
125 @definition ||= begin
126 configure
e0e79df @indirect Upgrade 0.9 lockfiles to 1.0 lockfiles in-place
indirect authored Jun 7, 2010
127 upgrade_lockfile
2b9094e Scope specs in the lock file by source
Carl Lerche authored May 10, 2010
128 lockfile = root.join("Gemfile.lock")
8a4dc7a Remove a little bit of crazy from Definition
Carl Lerche authored Jun 2, 2010
129 Definition.build(default_gemfile, lockfile, unlock)
2b9094e Scope specs in the lock file by source
Carl Lerche authored May 10, 2010
130 end
ab5b1fc Add Bundler.flexdef, move locking into Environment, and lock from fle…
Carlhuda authored Apr 7, 2010
131 end
132
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
133 def home
625818a @indirect Clean up bundler.rb a bit
indirect authored Mar 31, 2010
134 bundle_path.join("bundler")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
135 end
f31835e More work towards awesomeness
Carlhuda authored Jan 12, 2010
136
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
137 def install_path
138 home.join("gems")
139 end
0d2492d Add more stuff for git
Carl Lerche authored Jan 13, 2010
140
0d92de7 @indirect Add Bundler::Source::BundlerGems, to distingush from SystemGems.
indirect authored Mar 26, 2010
141 def specs_path
142 bundle_path.join("specifications")
143 end
144
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
145 def cache
0d92de7 @indirect Add Bundler::Source::BundlerGems, to distingush from SystemGems.
indirect authored Mar 27, 2010
146 bundle_path.join("cache/bundler")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
147 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored Jan 22, 2010
148
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
149 def root
2d87c36 Move <root>/vendor/cache to a Bundler class method
Carl Lerche authored May 5, 2010
150 default_gemfile.dirname.expand_path
151 end
152
153 def app_cache
154 root.join("vendor/cache")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
155 end
156
32a2eb2 First pass at getting bundler to play well when $GEM_HOME is owned by…
Carl Lerche authored May 18, 2010
157 def tmp
158 "#{Gem.user_home}/.bundler/tmp"
159 end
160
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored Feb 2, 2010
161 def settings
162 @settings ||= Settings.new(root)
163 end
164
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored Mar 26, 2010
165 def with_clean_env
166 bundled_env = ENV.to_hash
167 ENV.replace(ORIGINAL_ENV)
168 yield
169 ensure
170 ENV.replace(bundled_env.to_hash)
171 end
172
fb1e725 Make bundler/setup something you can add to your .profile. To do this…
Carlhuda authored Feb 10, 2010
173 def default_gemfile
174 SharedHelpers.default_gemfile
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored Jan 22, 2010
175 end
176
16259ea @wycats Improve sudo support
wycats authored Jun 8, 2010
177 WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
178 NULL = WINDOWS ? "NUL" : "/dev/null"
179
32a2eb2 First pass at getting bundler to play well when $GEM_HOME is owned by…
Carl Lerche authored May 18, 2010
180 def requires_sudo?
181 case
182 when File.writable?(bundle_path) ||
16259ea @wycats Improve sudo support
wycats authored Jun 8, 2010
183 `which sudo 2>#{NULL}`.empty? ||
32a2eb2 First pass at getting bundler to play well when $GEM_HOME is owned by…
Carl Lerche authored May 18, 2010
184 File.owned?(bundle_path)
185 false
186 else
187 true
188 end
189 rescue Errno::ENOENT
190 false
191 end
192
9ef6aa6 @indirect Disable rubygems more fully when unlocked
indirect authored Apr 8, 2010
193 private
194
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
195 def configure_gem_home_and_path
3d82929 Separate bundle install foo and bundle install --disable-shared-gems.
Carl Lerche authored Feb 10, 2010
196 if settings[:disable_shared_gems]
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
197 ENV['GEM_PATH'] = ''
9ef6aa6 @indirect Disable rubygems more fully when unlocked
indirect authored Apr 9, 2010
198 ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
199 else
7a7628c @indirect Don't duplicate gem paths
indirect authored Apr 5, 2010
200 paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
55509f2 @indirect Ignore paths like GEM_HOME that are empty strings
indirect authored Feb 25, 2010
201 ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored Feb 3, 2010
202 ENV["GEM_HOME"] = bundle_path.to_s
203 end
204
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored Feb 1, 2010
205 Gem.clear_paths
206 end
e0e79df @indirect Upgrade 0.9 lockfiles to 1.0 lockfiles in-place
indirect authored Jun 8, 2010
207
208 def upgrade_lockfile
209 lockfile = root.join("Gemfile.lock")
210 if lockfile.exist? && lockfile.read(3) == "---"
211 Bundler.ui.warn "Updating Gemfile.lock from 0.9 format to 1.0 format..."
212
213 lock = YAML.load_file(lockfile)
214
215 source_uris = lock["sources"].map{|s| s["Rubygems"]["uri"] }
216 sources = [Bundler::Source::Rubygems.new({"remotes" => source_uris})]
217
218 deps = lock["dependencies"].map do |name, opts|
219 version = opts.delete("version")
220 Bundler::Dependency.new(name, version, opts)
221 end
222
223 definition = Bundler::Definition.new(nil, deps, sources, {})
224
225 File.open(lockfile, 'w') do |f|
226 f.write definition.to_lock
227 end
228 end
229 end
230
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored Jan 22, 2010
231 end
a8cbf77 @jeremy Group autorequire: pass :require => 'autorequire' option to gem depen…
jeremy authored Feb 4, 2010
232 end
Something went wrong with that request. Please try again.