Sha256: ce64809e089b8a2f752a3c5aec89b0cf050d19720429b016a2b08a1de33957b7
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
require "methadone" module Howami class Configuration include Methadone::CLILogging XDG_CONFIG_HOME = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config') CREDENTIALS_STORE = File.join( XDG_CONFIG_HOME, "howami", "credentials.yml") def self.has_valid_credentials? self.has_stored_credentials? end def self.store_credentials(user_token, user_secret) #create proper XDG directory if doesn't exist FileUtils.mkdir_p( File.dirname(CREDENTIALS_STORE) ) #store File.open(CREDENTIALS_STORE, 'w') do |f| f.puts({ :user_token => user_token, :user_secret => user_secret }.to_yaml) end end def self.get_credentials return nil if not self.has_stored_credentials? YAML.load_file(CREDENTIALS_STORE) end protected def self.has_stored_credentials? File.exist? CREDENTIALS_STORE end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
howami-0.0.1 | lib/howami/configuration.rb |