summaryrefslogtreecommitdiff
path: root/lib/bundler/environment.rb
blob: eac2485904796259f9574236ec4c9cfef3379407 (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
module Bundler
  class Environment
    attr_reader :root

    def initialize(root, definition)
      @root = root
      @definition = definition

      env_file = root.join('.bundle/environment.rb')
      env_file.rmtree if env_file.exist?
    end

    def inspect
      @definition.to_lock.inspect
    end

    # TODO: Remove this method. It's used in cli.rb still
    def index
      @definition.index
    end

    def requested_specs
      @definition.requested_specs
    end

    def specs
      @definition.specs
    end

    def dependencies
      @definition.dependencies
    end

    def current_dependencies
      @definition.current_dependencies
    end

    def lock
      contents = @definition.to_lock

      File.open(root.join('Gemfile.lock'), 'w') do |f|
        f.puts contents
      end
    end

    def update(*gems)
      # Nothing
    end

  end
end