Sha256: 0811d282b478c577d417a2b56418141db79c1cd77d5fa14d2bb9838b8514b8ff

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require 'yaml'

class Gitme
  class CommandLineOptions

    DEFAULT_REPO_FILE = File.expand_path('~/.gitme.yml')

    attr :repositories

    def initialize(options)
      @repositories = read_repository_settings(options)
    end

    def read_repository_settings(options)
      YAML.load(File.read(options[:f] || DEFAULT_REPO_FILE))
    end

    def fetch(repository)
      unless @repositories[repository]
        raise(Gitme::Error,"Non-existent repository: #{repository}")
      end
      @repositories[repository].inject({:name => repository}) do |hash,pair|
        hash[pair.first.to_sym] = pair.last
        hash
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitme-0.0.1 lib/gitme/command_line_options.rb