lib/instapusher/configuration.rb in instapusher-0.0.32 vs lib/instapusher/configuration.rb in instapusher-0.0.33

- old
+ new

@@ -19,9 +19,33 @@ if debug puts @_settings.inspect end end + def ask_for_api_key + puts "" + puts "Note: Your instapusher API key is available at http://www.instapusher.com/my/api_key" + puts "" + puts "Enter your Instapusher API key:" + api_key = ask + api_key + 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.write instapusher_config.to_yaml + end + + puts "" + puts "You are all set. Start using instapusher." + end + + def ask + $stdin.gets.to_s.strip + end + def method_missing(name, *args, &block) self.load @_settings[name.to_s] end end