Sha256: 1b3bfe9fb489862a11f5b9c8075755ae1c83887faf5d74029d267c3057a31bf2
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'yaml' module Relish module Command class Base DEFAULT_HOST = 'relishapp.com' GLOBAL_OPTIONS_FILE = File.join(File.expand_path('~'), '.relish') LOCAL_OPTIONS_FILE = '.relish' attr_reader :args def initialize(args) @args = args @options = get_options end def organization @options['--organization'] || @options['-o'] || parsed_options_file['organization'] end def project @options['--project'] || @options['-p'] || parsed_options_file['project'] end def host @options['--host'] || DEFAULT_HOST end def api_token parsed_options_file['api_token'] end def get_options parsed_options_file.merge(Hash[*args]) end def parsed_options_file @parsed_options_file ||= {}.tap do |parsed_options| [GLOBAL_OPTIONS_FILE, LOCAL_OPTIONS_FILE].each do |options_file| parsed_options.merge!(YAML.load_file(options_file)) if File.exist?(options_file) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relish-0.0.2 | lib/relish/commands/base.rb |