Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 137 lines (112 sloc) 3.435 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'
152a50a Rename gemfile back to bundler
Carl Lerche authored
4 require 'bundler/rubygems'
ce350cc Get a simple bbl install working
Carlhuda authored
5
152a50a Rename gemfile back to bundler
Carl Lerche authored
6 module Bundler
b137485 Downbump version
Yehuda Katz authored
7 VERSION = "0.9.1.pre1"
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'
152a50a Rename gemfile back to bundler
Carl Lerche authored
19 autoload :Source, 'bundler/source'
20 autoload :Specification, 'bundler/specification'
434fb42 First pass at output
Carlhuda authored
21 autoload :UI, 'bundler/ui'
67859e4 Moving in thor
Carlhuda authored
22
de5054a Rescue all Bundler exceptions and exit with appropriate error code
Carlhuda authored
23 class BundlerError < StandardError
24 def self.status_code(code = nil)
25 return @code unless code
26 @code = code
27 end
28
29 def status_code
30 self.class.status_code
31 end
32 end
33
5894862 Print useful warnings when deprecated options are used
Yehuda Katz authored
34 class GemfileNotFound < BundlerError; status_code(10) ; end
35 class GemNotFound < BundlerError; status_code(7) ; end
36 class VersionConflict < BundlerError; status_code(6) ; end
37 class GemfileError < BundlerError; status_code(4) ; end
38 class GitError < BundlerError; status_code(11) ; end
39 class DeprecatedMethod < BundlerError; status_code(12) ; end
40 class DeprecatedOption < BundlerError; status_code(12) ; end
67859e4 Moving in thor
Carlhuda authored
41
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
42 class << self
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
43 attr_writer :ui, :bundle_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
44
45 def configure
46 @configured ||= begin
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
47 configure_gem_home_and_path
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
48 true
49 end
50 end
434fb42 First pass at output
Carlhuda authored
51
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
52 def ui
53 @ui ||= UI.new
54 end
434fb42 First pass at output
Carlhuda authored
55
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
56 def bundle_path
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
57 @bundle_path ||= begin
58 path = settings[:path] || "#{Gem.user_home}/.bundle"
59 Pathname.new(path).expand_path(root)
60 end
5ad1279 Add the ability to set bundle env settings in a .bundleconfig file
Carl Lerche authored
61 end
62
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
63 def setup(*groups)
64 gemfile = default_gemfile
65 load(gemfile).setup(*groups)
66 end
ce350cc Get a simple bbl install working
Carlhuda authored
67
a8cbf77 Jeremy Kemper Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
68 def require(*groups)
69 gemfile = default_gemfile
70 load(gemfile).require(*groups)
71 end
72
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
73 def load(gemfile = default_gemfile)
74 root = Pathname.new(gemfile).dirname
c0f8641 Persist spec groups to the lockfile
Carl Lerche authored
75 Runtime.new root, definition(gemfile)
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
76 end
67859e4 Moving in thor
Carlhuda authored
77
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
78 def definition(gemfile = default_gemfile)
79 configure
80 root = Pathname.new(gemfile).dirname
78a6b48 Rename vendor/lock.yml to Gemfile.lock
Carl Lerche authored
81 lockfile = root.join("Gemfile.lock")
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
82 if lockfile.exist?
83 Definition.from_lock(lockfile)
84 else
85 Definition.from_gemfile(gemfile)
86 end
88741e6 First pass at bbl lock
Carlhuda authored
87 end
f31835e More work towards awesomeness
Carlhuda authored
88
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
89 def home
90 Pathname.new(bundle_path).join("bundler")
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 install_path
94 home.join("gems")
95 end
0d2492d Add more stuff for git
Carl Lerche authored
96
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
97 def cache
98 home.join("cache")
99 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
100
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
101 def root
102 default_gemfile.dirname
103 end
104
ea08895 Add the ability to specify a location with bundle install
Carl Lerche authored
105 def settings
106 @settings ||= Settings.new(root)
107 end
108
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
109 private
63b636b First pass at gemfile pack
Carlhuda authored
110
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
111 def default_gemfile
112 current = Pathname.new(Dir.pwd)
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
113
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
114 until current.root?
115 filename = current.join("Gemfile")
116 return filename if filename.exist?
117 current = current.parent
118 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
119
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
120 raise GemfileNotFound, "The default Gemfile was not found"
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
121 end
122
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
123 def configure_gem_home_and_path
124 if path = settings[:path]
125 ENV['GEM_HOME'] = File.expand_path(path, root)
126 ENV['GEM_PATH'] = ''
127 else
93cda9a Tweak GEM_HOME and GEM_PATH
Carlhuda authored
128 gem_home, gem_path = Gem.dir, Gem.path
129 ENV["GEM_PATH"] = [gem_home, gem_path].flatten.compact.join(File::PATH_SEPARATOR)
739c0f3 Install bundles to ~/.bundle by default
Carlhuda authored
130 ENV["GEM_HOME"] = bundle_path.to_s
131 end
132
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
133 Gem.clear_paths
134 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
135 end
a8cbf77 Jeremy Kemper Group autorequire: pass :require => 'autorequire' option to gem dependen...
jeremy authored
136 end
Something went wrong with that request. Please try again.