Sha256: 0dc0b01959f98cd8176d21f22fca9a293f9854abca15024bd2a940cf115c5eac

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

module Gitenv

  class Config
    include Context

    attr_reader :actions
    attr_accessor :repository
    attr_reader :home

    def initialize home
      @home = home
      @actions = []
    end

    def repo path
      @repository = File.expand_path path
    end

    def symlink file, options = {}
      Action.new(self, Symlink, enumerator(file), options).tap{ |a| @actions << a }
    end

    def copy file, options = {}
      Action.new(self, Copy, enumerator(file), options).tap{ |a| @actions << a }
    end

    def all_files
      :all_files
    end

    def dot_files
      :dot_files
    end

    private

    def enumerator file
      if file == :all_files
        AllFiles.new
      elsif file == :dot_files
        DotFiles.new
      else
        OneFile.new file
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitenv-0.0.5 lib/gitenv/config.rb