Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 147 lines (121 sloc) 3.784 kb
63b636b First pass at gemfile pack
Carlhuda authored
1 require 'fileutils'
ce350cc Get a simple bbl install working
Carlhuda authored
2 require 'pathname'
88741e6 First pass at bbl lock
Carlhuda authored
3 require 'yaml'
820bb93 Rename rubygems-ext to rubygems_ext
Carl Lerche authored
4 require 'bundler/rubygems_ext'
ce350cc Get a simple bbl install working
Carlhuda authored
5
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored
6
152a50a Rename gemfile back to bundler
Carl Lerche authored
7 module Bundler
39b9aa3 @indirect Version 0.10.pre
indirect authored
8 VERSION = "0.10.pre"
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored
9 ORIGINAL_ENV = ENV.to_hash
67859e4 Moving in thor
Carlhuda authored
10
152a50a Rename gemfile back to bundler
Carl Lerche authored
11 autoload :Definition, 'bundler/definition'
12 autoload :Dependency, 'bundler/dependency'
13 autoload :Dsl, 'bundler/dsl'
14 autoload :Environment, 'bundler/environment'
15 autoload :Index, 'bundler/index'
16 autoload :Installer, 'bundler/installer'
17 autoload :RemoteSpecification, 'bundler/remote_specification'
18 autoload :Resolver, 'bundler/resolver'
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored
19 autoload :Runtime, 'bundler/runtime'
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored
20 autoload :Settings, 'bundler/settings'
f7bfdde Actually disable system gems in .bundle/environment.rb
Carlhuda authored
21 autoload :SharedHelpers, 'bundler/shared_helpers'
529d792 Use tsort to order specifications. It makes teh crazy work.
Carl Lerche authored
22 autoload :SpecSet, 'bundler/spec_set'
152a50a Rename gemfile back to bundler
Carl Lerche authored
23 autoload :Source, 'bundler/source'
24 autoload :Specification, 'bundler/specification'
434fb42 First pass at output
Carlhuda authored
25 autoload :UI, 'bundler/ui'
67859e4 Moving in thor
Carlhuda authored
26
de5054a Rescue all Bundler exceptions and exit with appropriate error code
Carlhuda authored
27 class BundlerError < StandardError
28 def self.status_code(code = nil)
29 return @code unless code
30 @code = code
31 end
32
33 def status_code
34 self.class.status_code
35 end
36 end
37
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored
38 class GemfileNotFound < BundlerError; status_code(10) ; end
39 class GemNotFound < BundlerError; status_code(7) ; end
40 class VersionConflict < BundlerError; status_code(6) ; end
41 class GemfileError < BundlerError; status_code(4) ; end
248ca34 Raise a better error in the case that a git repo is not cloned yet.
Carl Lerche authored
42 class PathError < BundlerError; status_code(13) ; end
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored
43 class GitError < BundlerError; status_code(11) ; end
44 class DeprecatedMethod < BundlerError; status_code(12) ; end
45 class DeprecatedOption < BundlerError; status_code(12) ; end
2a24019 @indirect Print a useful error if a gemspec require fails
indirect authored
46 class GemspecError < BundlerError; status_code(14) ; end
67859e4 Moving in thor
Carlhuda authored
47
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
48 class << self
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
49 attr_writer :ui, :bundle_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
50
51 def configure
52 @configured ||= begin
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
53 configure_gem_home_and_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
54 true
55 end
56 end
434fb42 First pass at output
Carlhuda authored
57
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
58 def ui
59 @ui ||= UI.new
60 end
434fb42 First pass at output
Carlhuda authored
61
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
62 def bundle_path
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
63 @bundle_path ||= begin
58b31d8 Namespace the default bundle path to support with the ruby engine and ve...
Carlhuda authored
64 path = settings[:path] || "#{Gem.user_home}/.bundle/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
65 Pathname.new(path).expand_path(root)
66 end
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
67 end
68
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
69 def setup(*groups)
70 gemfile = default_gemfile
71 load(gemfile).setup(*groups)
72 end
ce350cc Get a simple bbl install working
Carlhuda authored
73
a8cbf77 @jeremy Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
74 def require(*groups)
75 gemfile = default_gemfile
76 load(gemfile).require(*groups)
77 end
78
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
79 def load(gemfile = default_gemfile)
80 root = Pathname.new(gemfile).dirname
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored
81 Runtime.new root, definition(gemfile)
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
82 end
67859e4 Moving in thor
Carlhuda authored
83
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
84 def definition(gemfile = default_gemfile)
85 configure
86 root = Pathname.new(gemfile).dirname
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
87 lockfile = root.join("Gemfile.lock")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
88 if lockfile.exist?
89 Definition.from_lock(lockfile)
90 else
91 Definition.from_gemfile(gemfile)
92 end
88741e6 First pass at bbl lock
Carlhuda authored
93 end
f31835e More work towards awesomeness
Carlhuda authored
94
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
95 def home
96 Pathname.new(bundle_path).join("bundler")
97 end
f31835e More work towards awesomeness
Carlhuda authored
98
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
99 def install_path
100 home.join("gems")
101 end
0d2492d Add more stuff for git
Carl Lerche authored
102
0d92de7 @indirect Add Bundler::Source::BundlerGems, to distingush from SystemGems.
indirect authored
103 def specs_path
104 bundle_path.join("specifications")
105 end
106
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
107 def cache
0d92de7 @indirect Add Bundler::Source::BundlerGems, to distingush from SystemGems.
indirect authored
108 bundle_path.join("cache/bundler")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
109 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
110
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
111 def root
112 default_gemfile.dirname
113 end
114
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored
115 def settings
116 @settings ||= Settings.new(root)
117 end
118
33154fd @joshbuddy Add Bundler.with_clean_env for blocks of ruby without a bundled env
joshbuddy authored
119 def with_clean_env
120 bundled_env = ENV.to_hash
121 ENV.replace(ORIGINAL_ENV)
122 yield
123 ensure
124 ENV.replace(bundled_env.to_hash)
125 end
126
fb1e725 Make bundler/setup something you can add to your .profile. To do this, a...
Carlhuda authored
127 private
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
128
fb1e725 Make bundler/setup something you can add to your .profile. To do this, a...
Carlhuda authored
129 def default_gemfile
130 SharedHelpers.default_gemfile
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
131 end
132
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
133 def configure_gem_home_and_path
3d82929 Separate bundle install foo and bundle install --disable-shared-gems.
Carl Lerche authored
134 if settings[:disable_shared_gems]
135 ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
136 ENV['GEM_PATH'] = ''
137 else
55509f2 @indirect Ignore paths like GEM_HOME that are empty strings
indirect authored
138 paths = [Gem.dir, Gem.path].flatten.compact.reject{|p| p.empty? }
139 ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
140 ENV["GEM_HOME"] = bundle_path.to_s
141 end
142
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
143 Gem.clear_paths
144 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
145 end
a8cbf77 @jeremy Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
146 end
Something went wrong with that request. Please try again.