Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 15678e315f7f0ca03e551295a2fddaa720a54b08 1 parent f899a15
jugyo jugyo authored

Showing 2 changed files with 10 additions and 13 deletions. Show diff stats Hide diff stats

  1. +9 12 lib/earthquake/core.rb
  2. +1 1  lib/earthquake/get_access_token.rb
21 lib/earthquake/core.rb
@@ -48,13 +48,12 @@ def reload
48 48
49 49 def load_config
50 50 # TODO: parse argv
51   - config.merge!(
52   - :dir => File.expand_path('~/.earthquake'),
53   - :plugin_dir => File.expand_path('~/.earthquake/plugin'),
54   - :consumer_key => 'RmzuwQ5g0SYObMfebIKJag',
55   - :consumer_secret => 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU',
56   - :time_format => Time::DATE_FORMATS[:short]
57   - )
  51 + config[:dir] ||= File.expand_path(ARGV[0] || '~/.earthquake')
  52 + config[:time_format] ||= Time::DATE_FORMATS[:short]
  53 + config[:plugin_dir] ||= File.join(config[:dir], 'plugin')
  54 + config[:file] ||= File.join(config[:dir], 'config')
  55 + config[:consumer_key] ||= 'RmzuwQ5g0SYObMfebIKJag'
  56 + config[:consumer_secret] ||= 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU'
58 57
59 58 [config[:dir], config[:plugin_dir]].each do |dir|
60 59 unless File.exists?(dir)
@@ -62,14 +61,12 @@ def load_config
62 61 end
63 62 end
64 63
65   - config[:file] ||= File.join(config[:dir], 'config')
66   -
67   - unless File.exists?(config[:file])
  64 + if File.exists?(config[:file])
  65 + load config[:file]
  66 + else
68 67 File.open(config[:file], 'w')
69 68 end
70 69
71   - load config[:file]
72   -
73 70 get_access_token unless self.config[:token] && self.config[:secret]
74 71 end
75 72
2  lib/earthquake/get_access_token.rb
@@ -12,7 +12,7 @@ def get_access_token
12 12 Launchy::Browser.run(request_token.authorize_url)
13 13
14 14 print "2) Enter the PIN: "
15   - pin = gets.strip
  15 + pin = STDIN.gets.strip
16 16
17 17 access_token = request_token.get_access_token(:oauth_verifier => pin)
18 18 config[:token] = access_token.token

0 comments on commit 15678e3

Please sign in to comment.
Something went wrong with that request. Please try again.