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