require 'rubygems' require 'thor' require 'thor/group' require 'yaml' require 'rest_client' module Factor module CLI class Command < Thor no_tasks do def initialize(*vals) @config_file_dir = File.expand_path("~/.factor") @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