Sha256: b6a8af020dbc8ab1bc78792570e06ca9f5003898479ecc144556d4d14f4eb4bc

Contents?: true

Size: 764 Bytes

Versions: 19

Compression:

Stored size: 764 Bytes

Contents

module Bundler
  class Settings
    def initialize(root)
      @root   = root
      @config = File.exist?(config_file) ? YAML.load_file(config_file) : {}
    end

    def [](key)
      key = "BUNDLE_#{key.to_s.upcase}"
      @config[key] || ENV[key]
    end

    def []=(key, value)
      key = "BUNDLE_#{key.to_s.upcase}"
      @config[key] = value
      FileUtils.mkdir_p(config_file.dirname)
      File.open(config_file, 'w') do |f|
        f.puts @config.to_yaml
      end
      value
    end

    def without=(array)
      self[:without] = array.join(":")
    end

    def without
      self[:without] ? self[:without].split(":").map { |w| w.to_sym } : []
    end

  private

    def config_file
      Pathname.new("#{@root}/.bundle/config")
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
bundler-0.9.26 lib/bundler/settings.rb
bundler-0.9.25 lib/bundler/settings.rb
bundler-0.9.24 lib/bundler/settings.rb
bundler-0.9.23 lib/bundler/settings.rb
bundler-0.9.22 lib/bundler/settings.rb
bundler-0.9.21 lib/bundler/settings.rb
bundler-0.9.20 lib/bundler/settings.rb
bundler-0.9.19 lib/bundler/settings.rb
bundler-0.9.18 lib/bundler/settings.rb
bundler-0.9.17 lib/bundler/settings.rb
bundler-0.9.16 lib/bundler/settings.rb
bundler-0.9.15 lib/bundler/settings.rb
bundler-0.9.14 lib/bundler/settings.rb
bundler-0.9.13 lib/bundler/settings.rb
bundler-0.9.12 lib/bundler/settings.rb
bundler-0.9.11 lib/bundler/settings.rb
bundler-0.9.10 lib/bundler/settings.rb
bundler-0.9.9 lib/bundler/settings.rb
bundler-0.9.8 lib/bundler/settings.rb