Sha256: af91cbad189232ca639e61375c0785ffbf7a20799fd4f1e422e1b6ddabd7e878
Contents?: true
Size: 557 Bytes
Versions: 3
Compression:
Stored size: 557 Bytes
Contents
class Boilercode::Config attr_reader :creds, :file_path def initialize @file_path = File.expand_path("~/.boilercode.yml") @creds = read_from_file if token_expired? puts Boilercode::Command.new.pastel.red "Token expired. Please re-authenticate." end end def read_from_file return {} unless File.exist?(file_path) YAML.load_file(file_path) end def token_expired? creds[:issued_at] && (Time.now.to_i - creds[:issued_at]) > (3600 * 24) end def creds_present? creds[:email] && creds[:password] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
boilercode-0.1.2 | lib/boilercode/config.rb |
boilercode-0.1.1 | lib/boilercode/config.rb |
boilercode-0.1.0 | lib/boilercode/config.rb |