require 'rubygems' require 'thor' require 'thor/group' require 'yaml' require 'rest_client' module Factor module CLI class Command < Thor CONFIG_FILE_DIR = File.expand_path("~/.factor") no_tasks do def initialize(*vals) @client = Factor::Client::Client.new @client.login_token(get_config[:token]) super(*vals) end def save_config(config) File.open(CONFIG_FILE_DIR,'w') do |file| YAML::dump(config,file) end @client.login_token(get_config[:token]) end def get_config File.exists?(CONFIG_FILE_DIR) ? YAML::load_file(CONFIG_FILE_DIR) : {} end end end end end