Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

You can specify the directory for earthquake as ARGV[0]

  • Loading branch information...
commit 15678e315f7f0ca03e551295a2fddaa720a54b08 1 parent f899a15
jugyo jugyo authored
Showing with 10 additions and 13 deletions.
  1. +9 −12 lib/earthquake/core.rb
  2. +1 −1  lib/earthquake/get_access_token.rb
21 lib/earthquake/core.rb
View
@@ -48,13 +48,12 @@ def reload
def load_config
# TODO: parse argv
- config.merge!(
- :dir => File.expand_path('~/.earthquake'),
- :plugin_dir => File.expand_path('~/.earthquake/plugin'),
- :consumer_key => 'RmzuwQ5g0SYObMfebIKJag',
- :consumer_secret => 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU',
- :time_format => Time::DATE_FORMATS[:short]
- )
+ config[:dir] ||= File.expand_path(ARGV[0] || '~/.earthquake')
+ config[:time_format] ||= Time::DATE_FORMATS[:short]
+ config[:plugin_dir] ||= File.join(config[:dir], 'plugin')
+ config[:file] ||= File.join(config[:dir], 'config')
+ config[:consumer_key] ||= 'RmzuwQ5g0SYObMfebIKJag'
+ config[:consumer_secret] ||= 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU'
[config[:dir], config[:plugin_dir]].each do |dir|
unless File.exists?(dir)
@@ -62,14 +61,12 @@ def load_config
end
end
- config[:file] ||= File.join(config[:dir], 'config')
-
- unless File.exists?(config[:file])
+ if File.exists?(config[:file])
+ load config[:file]
+ else
File.open(config[:file], 'w')
end
- load config[:file]
-
get_access_token unless self.config[:token] && self.config[:secret]
end
2  lib/earthquake/get_access_token.rb
View
@@ -12,7 +12,7 @@ def get_access_token
Launchy::Browser.run(request_token.authorize_url)
print "2) Enter the PIN: "
- pin = gets.strip
+ pin = STDIN.gets.strip
access_token = request_token.get_access_token(:oauth_verifier => pin)
config[:token] = access_token.token
Please sign in to comment.
Something went wrong with that request. Please try again.