lib/instapusher/configuration.rb in instapusher-0.0.34 vs lib/instapusher/configuration.rb in instapusher-0.1.0
- old
+ new
@@ -6,11 +6,11 @@
extend self
@_settings = {}
attr_reader :_settings
def load(debug = false, filename=nil)
- filename ||= File.join(ENV['HOME'], '.instapusher')
+ filename ||= File.join(ENV['HOME'], instapusher_file_name)
unless File.exist? filename
File.new(filename, File::CREAT|File::TRUNC|File::RDWR, 0644).close
end
@@ -31,11 +31,11 @@
end
def ask_for_and_write_api_key
api_key = ask_for_api_key
instapusher_config = {"api_key" => api_key}
- File.open(File.join(Dir.home, ".instapusher"), "w") do |file|
+ File.open(File.join(Dir.home, instapusher_file_name), "w") do |file|
file.write instapusher_config.to_yaml
end
puts ""
puts "You are all set. Start using instapusher."
@@ -47,7 +47,12 @@
def method_missing(name, *args, &block)
self.load
@_settings[name.to_s]
end
+
+ def instapusher_file_name
+ '.instapusher'
+ end
+
end
end