Sha256: 9cf662353fe452d01b313b506587dd1f478679beaf0ffd7d22c40e5e0b77aaa2

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
factor-0.0.83 lib/cli/command.rb
factor-0.0.82 lib/cli/command.rb
factor-0.0.81 lib/cli/command.rb
factor-0.0.8 lib/cli/command.rb
factor-0.0.7 lib/cli/command.rb