Class: IORB::Config
- Inherits:
-
Object
- Object
- IORB::Config
- Defined in:
- lib/iorb.rb
Class Method Summary collapse
Class Method Details
.api_key ⇒ Object
60 61 62 |
# File 'lib/iorb.rb', line 60 def self.api_key YAML.load_file(self.file)['api-key'] end |
.check ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/iorb.rb', line 44 def self.check if not File.exist?(self.file) $stderr.puts "\niorb config file missing, creating one." key = ask("Paste you drop.io api key: ") { |q| q.echo = '*' } File.open(self.file, 'w') do |f| f.puts({ 'api-key' => (key.strip.chomp || 'invalid') }.to_yaml) end $stderr.puts "\nConfig file #{self.file} created.\n\n" exit 1 end end |
.file ⇒ Object
56 57 58 |
# File 'lib/iorb.rb', line 56 def self.file "#{ENV['HOME']}/.iorbrc" end |