Sha256: 8c49ccdea333af49f472c277f39fc1473ca68ac7f2540b49999f7546b77ddf4d

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

require 'pathname'

require 'mixlib/config'

module Vendorificator
  class Config
    extend Mixlib::Config

    attr_accessor :environment

    configure do |c|
      c[:basedir] = 'vendor'
      c[:branch_prefix] = 'vendor'
      c[:remotes] = %w(origin)
    end

    def self.from_file(filename)
      pathname = Pathname.new(filename).cleanpath.expand_path

      self[:vendorfile_path] = pathname
      self[:root_dir] =
        if ( pathname.basename.to_s == 'vendor.rb' &&
               pathname.dirname.basename.to_s == 'config' )
          # Correctly recognize root dir if main config is 'config/vendor.rb'
          pathname.dirname.dirname
        else
          pathname.dirname
        end

      super(pathname.to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vendorificator-0.2.0 lib/vendorificator/config.rb