blob: eadfe00b6b873dd8e0f881b4b08d6139da13cea7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
module Bundler
class ManifestFileNotFound < StandardError; end
class ManifestBuilder
def self.build(manifest_file, string)
builder = new(manifest_file)
builder.instance_eval(string)
builder
end
def self.load(manifest_file, filename)
unless File.exist?(filename)
raise ManifestFileNotFound, "#{filename.inspect} does not exist"
end
string = File.read(filename)
build(manifest_file, string)
end
def initialize(manifest_file)
@manifest_file = manifest_file
end
def bundle_path(path)
path = Pathname.new(path)
@manifest_file.gem_path = (path.relative? ?
@manifest_file.root.join(path) : path).expand_path
end
def bin_path(path)
path = Pathname.new(path)
@manifest_file.bindir = (path.relative? ?
@manifest_file.root.join(path) : path).expand_path
end
def disable_rubygems
@manifest_file.rubygems = false
end
def disable_system_gems
@manifest_file.system_gems = false
end
def source(source)
@manifest_file.sources << source
@manifest_file.sources.uniq!
end
def sources
@manifest_file.sources
end
def gem(name, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
version = args.last
@manifest_file.dependencies << Dependency.new(name, options.merge(:version => version))
end
end
end
|