lib/invoker/power/config.rb in invoker-1.0.4 vs lib/invoker/power/config.rb in invoker-1.1.0
- old
+ new
@@ -1,14 +1,17 @@
require "yaml"
+
module Invoker
module Power
# Save and Load Invoker::Power config
class ConfigExists < StandardError; end
+
class Config
- CONFIG_LOCATION = File.join(ENV['HOME'], ".invoker")
+ CONFIG_LOCATION = File.join(Dir.home, ".invoker", "config")
+
def self.has_config?
- File.exists?(CONFIG_LOCATION)
+ File.exist?(CONFIG_LOCATION)
end
def self.create(options = {})
if has_config?
raise ConfigExists, "Config file already exists at location #{CONFIG_LOCATION}"
@@ -16,10 +19,10 @@
config = new(options)
config.save
end
def self.delete
- if File.exists?(CONFIG_LOCATION)
+ if File.exist?(CONFIG_LOCATION)
File.delete(CONFIG_LOCATION)
end
end
def initialize(options = {})