Skip to content

HTTPS clone URL

Subversion checkout URL

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