Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 130 lines (107 sloc) 3.35 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'
9fbab6d Ariejan de Vroom Fixed name conflict with 'rubygems.rb'. Fixes #24
ariejan authored
4 require 'bundler/rubygems-ext'
ce350cc Get a simple bbl install working
Carlhuda authored
5
152a50a Rename gemfile back to bundler
Carl Lerche authored
6 module Bundler
d6e696d Bump the version
Carl Lerche authored
7 VERSION = "0.9.5"
67859e4 Moving in thor
Carlhuda authored
8
152a50a Rename gemfile back to bundler
Carl Lerche authored
9 autoload :Definition, 'bundler/definition'
10 autoload :Dependency, 'bundler/dependency'
11 autoload :Dsl, 'bundler/dsl'
12 autoload :Environment, 'bundler/environment'
13 autoload :Index, 'bundler/index'
14 autoload :Installer, 'bundler/installer'
15 autoload :RemoteSpecification, 'bundler/remote_specification'
16 autoload :Resolver, 'bundler/resolver'
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored
17 autoload :Runtime, 'bundler/runtime'
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored
18 autoload :Settings, 'bundler/settings'
f7bfdde Actually disable system gems in .bundle/environment.rb
Carlhuda authored
19 autoload :SharedHelpers, 'bundler/shared_helpers'
152a50a Rename gemfile back to bundler
Carl Lerche authored
20 autoload :Source, 'bundler/source'
21 autoload :Specification, 'bundler/specification'
434fb42 First pass at output
Carlhuda authored
22 autoload :UI, 'bundler/ui'
67859e4 Moving in thor
Carlhuda authored
23
de5054a Rescue all Bundler exceptions and exit with appropriate error code
Carlhuda authored
24 class BundlerError < StandardError
25 def self.status_code(code = nil)
26 return @code unless code
27 @code = code
28 end
29
30 def status_code
31 self.class.status_code
32 end
33 end
34
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored
35 class GemfileNotFound < BundlerError; status_code(10) ; end
36 class GemNotFound < BundlerError; status_code(7) ; end
37 class VersionConflict < BundlerError; status_code(6) ; end
38 class GemfileError < BundlerError; status_code(4) ; end
39 class GitError < BundlerError; status_code(11) ; end
40 class DeprecatedMethod < BundlerError; status_code(12) ; end
41 class DeprecatedOption < BundlerError; status_code(12) ; end
67859e4 Moving in thor
Carlhuda authored
42
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
43 class << self
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
44 attr_writer :ui, :bundle_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
45
46 def configure
47 @configured ||= begin
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
48 configure_gem_home_and_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
49 true
50 end
51 end
434fb42 First pass at output
Carlhuda authored
52
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
53 def ui
54 @ui ||= UI.new
55 end
434fb42 First pass at output
Carlhuda authored
56
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
57 def bundle_path
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
58 @bundle_path ||= begin
58b31d8 Namespace the default bundle path to support with the ruby engine and ve...
Carlhuda authored
59 path = settings[:path] || "#{Gem.user_home}/.bundle/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
60 Pathname.new(path).expand_path(root)
61 end
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
62 end
63
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
64 def setup(*groups)
65 gemfile = default_gemfile
66 load(gemfile).setup(*groups)
67 end
ce350cc Get a simple bbl install working
Carlhuda authored
68
a8cbf77 Jeremy Kemper Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
69 def require(*groups)
70 gemfile = default_gemfile
71 load(gemfile).require(*groups)
72 end
73
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
74 def load(gemfile = default_gemfile)
75 root = Pathname.new(gemfile).dirname
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored
76 Runtime.new root, definition(gemfile)
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
77 end
67859e4 Moving in thor
Carlhuda authored
78
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
79 def definition(gemfile = default_gemfile)
80 configure
81 root = Pathname.new(gemfile).dirname
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
82 lockfile = root.join("Gemfile.lock")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
83 if lockfile.exist?
84 Definition.from_lock(lockfile)
85 else
86 Definition.from_gemfile(gemfile)
87 end
88741e6 First pass at bbl lock
Carlhuda authored
88 end
f31835e More work towards awesomeness
Carlhuda authored
89
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
90 def home
91 Pathname.new(bundle_path).join("bundler")
92 end
f31835e More work towards awesomeness
Carlhuda authored
93
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
94 def install_path
95 home.join("gems")
96 end
0d2492d Add more stuff for git
Carl Lerche authored
97
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
98 def cache
310083d Move the bundle cache to BUNDLE_PATH/cache/bundler
Carlhuda authored
99 bundle_path.join('cache/bundler')
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
100 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
101
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
102 def root
103 default_gemfile.dirname
104 end
105
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored
106 def settings
107 @settings ||= Settings.new(root)
108 end
109
fb1e725 Make bundler/setup something you can add to your .profile. To do this, a...
Carlhuda authored
110 private
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
111
fb1e725 Make bundler/setup something you can add to your .profile. To do this, a...
Carlhuda authored
112 def default_gemfile
113 SharedHelpers.default_gemfile
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
114 end
115
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
116 def configure_gem_home_and_path
3d82929 Separate bundle install foo and bundle install --disable-shared-gems.
Carl Lerche authored
117 if settings[:disable_shared_gems]
118 ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
119 ENV['GEM_PATH'] = ''
120 else
93cda9a Tweak GEM_HOME and GEM_PATH
Carlhuda authored
121 gem_home, gem_path = Gem.dir, Gem.path
122 ENV["GEM_PATH"] = [gem_home, gem_path].flatten.compact.join(File::PATH_SEPARATOR)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
123 ENV["GEM_HOME"] = bundle_path.to_s
124 end
125
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
126 Gem.clear_paths
127 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
128 end
a8cbf77 Jeremy Kemper Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
129 end
Something went wrong with that request. Please try again.