Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 142 lines (116 sloc) 3.585 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 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
27e509d Bump the version
Carl Lerche authored
7 VERSION = "0.9.3"
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
59 path = settings[:path] || "#{Gem.user_home}/.bundle"
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 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
99 home.join("cache")
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
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
110 def default_gemfile
54026a1 Look for ENV['BUNDLE_GEMFILE'] first before searching Dir.pwd for a Gemf...
Carl Lerche authored
111 if ENV['BUNDLE_GEMFILE']
112 return Pathname.new(ENV['BUNDLE_GEMFILE'])
113 end
114
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
115 current = Pathname.new(Dir.pwd)
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
116
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
117 until current.root?
118 filename = current.join("Gemfile")
119 return filename if filename.exist?
120 current = current.parent
121 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
122
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
123 raise GemfileNotFound, "The default Gemfile was not found"
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
124 end
125
e400f1d Improve bundle exec
Carl Lerche authored
126 private
127
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
128 def configure_gem_home_and_path
129 if path = settings[:path]
130 ENV['GEM_HOME'] = File.expand_path(path, root)
131 ENV['GEM_PATH'] = ''
132 else
93cda9a Tweak GEM_HOME and GEM_PATH
Carlhuda authored
133 gem_home, gem_path = Gem.dir, Gem.path
134 ENV["GEM_PATH"] = [gem_home, gem_path].flatten.compact.join(File::PATH_SEPARATOR)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
135 ENV["GEM_HOME"] = bundle_path.to_s
136 end
137
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
138 Gem.clear_paths
139 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
140 end
a8cbf77 @jeremy Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
141 end
Something went wrong with that request. Please try again.