blob: 9bf31b9b4fe82d9f231e9dea971e53f47c117ab2 (
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
|
require 'erb'
module Bundler
class Environment
attr_reader :root
def initialize(root, definition)
@root = root
@definition = definition
end
# TODO: Remove this method. It's used in cli.rb still
def index
@definition.index
end
def requested_specs
@requested_specs ||= begin
groups = @definition.groups - Bundler.settings.without
groups.map! { |g| g.to_sym }
specs_for(groups)
end
end
def specs
@definition.specs
end
def dependencies
@definition.dependencies
end
def lock
write_yml_lock
end
def update(*gems)
# Nothing
end
private
def specs_for(groups)
deps = dependencies.select { |d| (d.groups & groups).any? }
specs.for(deps)
end
# ==== Locking
def write_yml_lock
File.open(root.join('Gemfile.lock'), 'w') do |f|
f.puts @definition.to_lock
end
end
end
end
|