Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 99 lines (81 sloc) 2.398 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
de65328 Bump up the version
Carl Lerche authored
7 VERSION = "0.9.0.pre3"
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'
17 autoload :Source, 'bundler/source'
18 autoload :Specification, 'bundler/specification'
434fb42 First pass at output
Carlhuda authored
19 autoload :UI, 'bundler/ui'
67859e4 Moving in thor
Carlhuda authored
20
21 class GemfileNotFound < StandardError; end
22 class GemNotFound < StandardError; end
23 class VersionConflict < StandardError; end
88741e6 First pass at bbl lock
Carlhuda authored
24 class GemfileError < StandardError; end
67859e4 Moving in thor
Carlhuda authored
25
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
26 class << self
27 attr_accessor :ui, :bundle_path
28
29 def configure
30 @configured ||= begin
31 self.bundle_path = Pathname.new(ENV['BUNDLE_PATH'] || Gem.dir)
32 point_gem_home(ENV['BUNDLE_PATH'])
33 true
34 end
35 end
434fb42 First pass at output
Carlhuda authored
36
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
37 def ui
38 @ui ||= UI.new
39 end
434fb42 First pass at output
Carlhuda authored
40
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
41 def setup(*groups)
42 gemfile = default_gemfile
43 load(gemfile).setup(*groups)
44 end
ce350cc Get a simple bbl install working
Carlhuda authored
45
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
46 def load(gemfile = default_gemfile)
47 root = Pathname.new(gemfile).dirname
48 Environment.new root, definition(gemfile)
49 end
67859e4 Moving in thor
Carlhuda authored
50
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
51 def definition(gemfile = default_gemfile)
52 configure
53 root = Pathname.new(gemfile).dirname
54 lockfile = root.join("vendor/lock.yml")
55 if lockfile.exist?
56 Definition.from_lock(lockfile)
57 else
58 Definition.from_gemfile(gemfile)
59 end
88741e6 First pass at bbl lock
Carlhuda authored
60 end
f31835e More work towards awesomeness
Carlhuda authored
61
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
62 def home
63 Pathname.new(bundle_path).join("bundler")
64 end
f31835e More work towards awesomeness
Carlhuda authored
65
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
66 def install_path
67 home.join("gems")
68 end
0d2492d Add more stuff for git
Carl Lerche authored
69
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
70 def cache
71 home.join("cache")
72 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
73
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
74 def root
75 default_gemfile.dirname
76 end
77
78 private
63b636b First pass at gemfile pack
Carlhuda authored
79
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
80 def default_gemfile
81 current = Pathname.new(Dir.pwd)
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
82
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
83 until current.root?
84 filename = current.join("Gemfile")
85 return filename if filename.exist?
86 current = current.parent
87 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
88
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
89 raise GemfileNotFound, "The default Gemfile was not found"
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
90 end
91
bc310f7 First pass at being able to set the bundle install path.
Carl Lerche authored
92 def point_gem_home(path)
93 return unless path
94 ENV['GEM_HOME'] = File.expand_path(path, root)
95 ENV['GEM_PATH'] = ''
96 Gem.clear_paths
97 end
ee0e2c1 Start working on the environment.rb lock file
Carl Lerche authored
98 end
67859e4 Moving in thor
Carlhuda authored
99 end
Something went wrong with that request. Please try again.