earthquake 0.9.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +1 -0
- data/bin/earthquake +9 -23
- data/earthquake.gemspec +2 -2
- data/lib/earthquake/commands.rb +6 -5
- data/lib/earthquake/core.rb +9 -2
- data/lib/earthquake/ext.rb +0 -15
- data/lib/earthquake/input.rb +7 -6
- data/lib/earthquake/option_parser.rb +33 -0
- data/lib/earthquake/output.rb +9 -4
- data/lib/earthquake/twitter.rb +1 -19
- data/lib/earthquake/version.rb +1 -1
- data/spec/earthquake_option_parser_spec.rb +78 -0
- data/spec/spec_helper.rb +8 -2
- metadata +31 -54
- data/spec/earthquake_spec.rb +0 -7
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: b67d0711b61d5ffd750f5e2c32533b376149337c
         | 
| 4 | 
            +
              data.tar.gz: 99b668a42fc0220f3db351f7e74d6d9fb0e63568
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: fced4dd9126ee990b0cebdbb81c4ed6f33f72d1ad0aaaf251e04c07da55495cc4ca4ac1713ab4fb1421760f64cbcd2509b4476a67874fee538510fc39f086dcf
         | 
| 7 | 
            +
              data.tar.gz: 2a5029a51afe819d0236de6bfc8de7d3d82bf71f0da942e48e8a1fcae0da92444dab9a62adfb4a71b62defa3b668dba9580a9f8e31ecf318fded804936885919
         | 
    
        data/README.md
    CHANGED
    
    | @@ -28,6 +28,7 @@ You'll need openssl and readline support with your 1.9.2. If you are | |
| 28 28 | 
             
            using rvm you can run:
         | 
| 29 29 |  | 
| 30 30 | 
             
                $ rvm pkg install openssl
         | 
| 31 | 
            +
                $ rvm pkg install readline
         | 
| 31 32 | 
             
                $ rvm remove 1.9.2
         | 
| 32 33 | 
             
                $ rvm install 1.9.2 --with-openssl-dir=$HOME/.rvm/usr \
         | 
| 33 34 | 
             
                  --with-readline-dir=$HOME/.rvm/usr
         | 
    
        data/bin/earthquake
    CHANGED
    
    | @@ -1,33 +1,19 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            require ' | 
| 2 | 
            +
            require 'pathname'
         | 
| 3 | 
            +
            $:.unshift Pathname.new(__FILE__).realpath.join('../../lib') if $0 == __FILE__
         | 
| 4 | 
            +
            require 'earthquake/option_parser'
         | 
| 5 | 
            +
            require "earthquake/version"
         | 
| 3 6 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
            slop.banner "Usage: earthquake [options] [directory]"
         | 
| 7 | 
            -
            slop.on :d, :debug, 'Enable debug mode'
         | 
| 8 | 
            -
            slop.on :n, :'no-logo', 'No Logo'
         | 
| 9 | 
            -
            slop.on :c, :command, "Invoke a command and exit", true
         | 
| 10 | 
            -
            slop.on :'--no-stream', "No stream mode"
         | 
| 7 | 
            +
            option_parser = Earthquake::OptionParser.new(ARGV.dup)
         | 
| 8 | 
            +
            options = nil
         | 
| 11 9 | 
             
            begin
         | 
| 12 | 
            -
               | 
| 10 | 
            +
              options = option_parser.parse
         | 
| 11 | 
            +
            rescue Earthquake::OptionParser::Help
         | 
| 12 | 
            +
              exit
         | 
| 13 13 | 
             
            rescue => e
         | 
| 14 14 | 
             
              puts e
         | 
| 15 15 | 
             
              exit!
         | 
| 16 16 | 
             
            end
         | 
| 17 | 
            -
            options = slop.to_hash
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            # XXX: work around slop's feature (bug?)
         | 
| 20 | 
            -
            options.each do |key, val|
         | 
| 21 | 
            -
              val = val.nil? ? nil : true if key.to_s =~ /^no-/
         | 
| 22 | 
            -
              options[key] = val
         | 
| 23 | 
            -
            end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            options.delete(:help)
         | 
| 26 | 
            -
            options[:dir] = argv.shift unless argv.empty?
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            require 'pathname'
         | 
| 29 | 
            -
            $:.unshift Pathname.new(__FILE__).realpath.join('../../lib') if $0 == __FILE__
         | 
| 30 | 
            -
            require "earthquake/version"
         | 
| 31 17 |  | 
| 32 18 | 
             
            command = options.delete(:command)
         | 
| 33 19 | 
             
            no_logo = options.delete(:'no-logo')
         | 
    
        data/earthquake.gemspec
    CHANGED
    
    | @@ -25,8 +25,8 @@ Gem::Specification.new do |s| | |
| 25 25 | 
             
              s.add_runtime_dependency "awesome_print"
         | 
| 26 26 | 
             
              s.add_runtime_dependency "launchy"
         | 
| 27 27 | 
             
              s.add_runtime_dependency "oauth"
         | 
| 28 | 
            -
              s.add_runtime_dependency "twitter_oauth", "= 0. | 
| 29 | 
            -
              s.add_runtime_dependency "slop", "~> 3.0"
         | 
| 28 | 
            +
              s.add_runtime_dependency "jugyo-twitter_oauth", "= 0.5.0.pre5"
         | 
| 29 | 
            +
              s.add_runtime_dependency "slop", "~> 3.4.0"
         | 
| 30 30 | 
             
              s.add_development_dependency "rspec", "~> 2.0"
         | 
| 31 31 | 
             
              s.add_development_dependency "bundler"
         | 
| 32 32 |  | 
    
        data/lib/earthquake/commands.rb
    CHANGED
    
    | @@ -112,6 +112,7 @@ Earthquake.init do | |
| 112 112 | 
             
                return text unless config[:eval_as_ruby_string_for_update]
         | 
| 113 113 | 
             
                begin
         | 
| 114 114 | 
             
                  text = eval(%|"#{text.gsub('"', '\"')}"|)
         | 
| 115 | 
            +
                rescue SyntaxError => e
         | 
| 115 116 | 
             
                rescue Exception => e
         | 
| 116 117 | 
             
                  puts e.message.c(:notice)
         | 
| 117 118 | 
             
                end
         | 
| @@ -238,16 +239,14 @@ Earthquake.init do | |
| 238 239 | 
             
                if user.key?("error")
         | 
| 239 240 | 
             
                  user = twitter.status(m[1])["user"] || {}
         | 
| 240 241 | 
             
                end
         | 
| 241 | 
            -
                ap user.slice(*%w( | 
| 242 | 
            +
                ap user.slice(*%w(id_str screen_name name profile_image_url description url location time_zone lang protected statuses_count followers_count friends_count listed_count created_at))
         | 
| 242 243 | 
             
              end
         | 
| 243 244 |  | 
| 244 245 | 
             
              help :user, "show user info"
         | 
| 245 246 |  | 
| 246 247 | 
             
              command :search do |m|
         | 
| 247 248 | 
             
                search_options = config[:search_options] ? config[:search_options].dup : {}
         | 
| 248 | 
            -
                puts_items twitter.search(m[1], search_options)[ | 
| 249 | 
            -
                  s["user"] = {"screen_name" => s["from_user"]}
         | 
| 250 | 
            -
                  s["_disable_cache"] = true
         | 
| 249 | 
            +
                puts_items twitter.search(m[1], search_options)['statuses'].each { |s|
         | 
| 251 250 | 
             
                  words = m[1].split(/\s+/).reject{|x| x[0] =~ /^-|^(OR|AND)$/ }.map{|x|
         | 
| 252 251 | 
             
                    case x
         | 
| 253 252 | 
             
                    when /^from:(.+)/, /^to:(.+)/
         | 
| @@ -427,7 +426,9 @@ Earthquake.init do | |
| 427 426 | 
             
              help :update_profile_image, "updates profile image from local file path"
         | 
| 428 427 |  | 
| 429 428 | 
             
              command %r|^:open\s+(\d+)$|, :as => :open do |m|
         | 
| 430 | 
            -
                matches =  | 
| 429 | 
            +
                matches = twitter.status(m[1])['retweeted_status'].nil? ? 
         | 
| 430 | 
            +
                  URI.extract(twitter.status(m[1])["text"],["http", "https"]) :
         | 
| 431 | 
            +
                  URI.extract(twitter.status(m[1])['retweeted_status']["text"],["http", "https"]) 
         | 
| 431 432 | 
             
                unless matches.empty?
         | 
| 432 433 | 
             
                  matches.each do |match_url|
         | 
| 433 434 | 
             
                    browse match_url
         | 
    
        data/lib/earthquake/core.rb
    CHANGED
    
    | @@ -64,6 +64,8 @@ module Earthquake | |
| 64 64 | 
             
                    prompt:          '⚡ ',
         | 
| 65 65 | 
             
                    consumer_key:    consumer['key'],
         | 
| 66 66 | 
             
                    consumer_secret: consumer['secret'],
         | 
| 67 | 
            +
                    api_version:     '1.1',
         | 
| 68 | 
            +
                    secure:          true,
         | 
| 67 69 | 
             
                    output_interval: 1,
         | 
| 68 70 | 
             
                    history_size:    1000,
         | 
| 69 71 | 
             
                    api:             { :host => 'userstream.twitter.com', :path => '/2/user.json', :ssl => true },
         | 
| @@ -132,7 +134,7 @@ module Earthquake | |
| 132 134 | 
             
                          Readline::HISTORY.pop if buf.empty? || Readline::HISTORY[-1] == Readline::HISTORY[-2]
         | 
| 133 135 | 
             
                        end
         | 
| 134 136 | 
             
                        sync {
         | 
| 135 | 
            -
                          reload
         | 
| 137 | 
            +
                          reload unless config[:reload] == false
         | 
| 136 138 | 
             
                          store_history
         | 
| 137 139 | 
             
                          input(buf.strip)
         | 
| 138 140 | 
             
                        }
         | 
| @@ -246,7 +248,12 @@ module Earthquake | |
| 246 248 | 
             
                end
         | 
| 247 249 |  | 
| 248 250 | 
             
                def error(e)
         | 
| 249 | 
            -
                   | 
| 251 | 
            +
                  case e
         | 
| 252 | 
            +
                  when Exception
         | 
| 253 | 
            +
                    insert "[ERROR] #{e.message}\n    #{e.backtrace.join("\n    ")}".c(:notice)
         | 
| 254 | 
            +
                  else
         | 
| 255 | 
            +
                    insert "[ERROR] #{e}".c(:notice)
         | 
| 256 | 
            +
                  end
         | 
| 250 257 | 
             
                end
         | 
| 251 258 |  | 
| 252 259 | 
             
                def notify(message, options = {})
         | 
    
        data/lib/earthquake/ext.rb
    CHANGED
    
    | @@ -17,21 +17,6 @@ module Twitter | |
| 17 17 | 
             
              end
         | 
| 18 18 | 
             
            end
         | 
| 19 19 |  | 
| 20 | 
            -
            module TwitterOAuth
         | 
| 21 | 
            -
              class Client
         | 
| 22 | 
            -
                [:get, :post, :delete].each { |m| public m }
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                private
         | 
| 25 | 
            -
                def consumer
         | 
| 26 | 
            -
                  @consumer ||= OAuth::Consumer.new(
         | 
| 27 | 
            -
                    @consumer_key,
         | 
| 28 | 
            -
                    @consumer_secret,
         | 
| 29 | 
            -
                    { :site => 'https://api.twitter.com', :proxy => @proxy }
         | 
| 30 | 
            -
                  )
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
              end
         | 
| 33 | 
            -
            end
         | 
| 34 | 
            -
             | 
| 35 20 | 
             
            class String
         | 
| 36 21 | 
             
              def c(*codes)
         | 
| 37 22 | 
             
                codes = codes.flatten.map { |code|
         | 
    
        data/lib/earthquake/input.rb
    CHANGED
    
    | @@ -63,6 +63,7 @@ module Earthquake | |
| 63 63 | 
             
                      end
         | 
| 64 64 | 
             
                    end
         | 
| 65 65 | 
             
                    command_names << ":#{options[:as]}" if options[:as]
         | 
| 66 | 
            +
                    commands.delete_if { |_| _[:pattern] == pattern }
         | 
| 66 67 | 
             
                    commands << {:pattern => pattern, :block => block}
         | 
| 67 68 | 
             
                  else
         | 
| 68 69 | 
             
                    commands.detect {|c| c[:pattern] =~ pattern}
         | 
| @@ -72,9 +73,9 @@ module Earthquake | |
| 72 73 | 
             
                def confirm(message, type = config[:confirm_type])
         | 
| 73 74 | 
             
                  s = case type
         | 
| 74 75 | 
             
                      when :y
         | 
| 75 | 
            -
                        ask( | 
| 76 | 
            +
                        ask(message.u.c(:notice), "[Yn] ")
         | 
| 76 77 | 
             
                      when :n
         | 
| 77 | 
            -
                        ask( | 
| 78 | 
            +
                        ask(message.u.c(:notice), "[yN] ")
         | 
| 78 79 | 
             
                      else
         | 
| 79 80 | 
             
                        raise "type must be :y or :n"
         | 
| 80 81 | 
             
                      end
         | 
| @@ -86,9 +87,9 @@ module Earthquake | |
| 86 87 | 
             
                  end
         | 
| 87 88 | 
             
                end
         | 
| 88 89 |  | 
| 89 | 
            -
                def ask(message)
         | 
| 90 | 
            -
                   | 
| 91 | 
            -
                  ( | 
| 90 | 
            +
                def ask(message, prompt)
         | 
| 91 | 
            +
                  puts message
         | 
| 92 | 
            +
                  (Readline.readline(prompt) || "").chomp
         | 
| 92 93 | 
             
                end
         | 
| 93 94 |  | 
| 94 95 | 
             
                def async_e(&block)
         | 
| @@ -98,7 +99,7 @@ module Earthquake | |
| 98 99 | 
             
                def handle_api_error(&block)
         | 
| 99 100 | 
             
                  result = block.call
         | 
| 100 101 | 
             
                  if result["error"]
         | 
| 101 | 
            -
                     | 
| 102 | 
            +
                    error result["error"]
         | 
| 102 103 | 
             
                  end
         | 
| 103 104 | 
             
                end
         | 
| 104 105 | 
             
              end
         | 
| @@ -0,0 +1,33 @@ | |
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
            require 'slop'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Earthquake
         | 
| 5 | 
            +
              class OptionParser
         | 
| 6 | 
            +
                Help = Class.new(StandardError)
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def initialize(argv)
         | 
| 9 | 
            +
                  @argv = argv
         | 
| 10 | 
            +
                  @slop = setup_slop
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def parse
         | 
| 14 | 
            +
                  @slop.parse!(@argv)
         | 
| 15 | 
            +
                  options = @slop.to_hash
         | 
| 16 | 
            +
                  raise Help if options.delete(:help)
         | 
| 17 | 
            +
                  options[:dir] = @argv.shift unless @argv.empty?
         | 
| 18 | 
            +
                  options
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                private
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def setup_slop
         | 
| 24 | 
            +
                  Slop.new(:strict => true, :help => true).tap do |s|
         | 
| 25 | 
            +
                    s.banner 'Usage: earthquake [options] [directory]'
         | 
| 26 | 
            +
                    s.on :d, :debug, 'Enable debug mode'
         | 
| 27 | 
            +
                    s.on :n, :'no-logo', 'No Logo'
         | 
| 28 | 
            +
                    s.on :c, :command, 'Invoke a command and exit', :argument => true
         | 
| 29 | 
            +
                    s.on :'--no-stream', 'No stream mode'
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
            end
         | 
    
        data/lib/earthquake/output.rb
    CHANGED
    
    | @@ -80,7 +80,7 @@ module Earthquake | |
| 80 80 | 
             
                  :event  => 42,
         | 
| 81 81 | 
             
                  :url    => [4, 36]
         | 
| 82 82 | 
             
                )
         | 
| 83 | 
            -
                config[:raw_text] ||=  | 
| 83 | 
            +
                config[:raw_text] ||= true
         | 
| 84 84 |  | 
| 85 85 | 
             
                output :tweet do |item|
         | 
| 86 86 | 
             
                  next unless item["text"]
         | 
| @@ -100,9 +100,14 @@ module Earthquake | |
| 100 100 |  | 
| 101 101 | 
             
                  id = id2var(item["id"])
         | 
| 102 102 |  | 
| 103 | 
            -
                  text = (item["retweeted_status"]  | 
| 104 | 
            -
                   | 
| 105 | 
            -
             | 
| 103 | 
            +
                  text = (item["retweeted_status"] ? "RT @#{item["retweeted_status"]["user"]["screen_name"]}: #{item["retweeted_status"]["text"]}" : item["text"]).u
         | 
| 104 | 
            +
                  if config[:raw_text] && /\n/ =~ text
         | 
| 105 | 
            +
                    text.prepend("\n")
         | 
| 106 | 
            +
                    text.gsub!(/\n/, "\n       " + "|".c(:info))
         | 
| 107 | 
            +
                    text << "\n      "
         | 
| 108 | 
            +
                  else
         | 
| 109 | 
            +
                    text.gsub!(/\s+/, ' ')
         | 
| 110 | 
            +
                  end
         | 
| 106 111 | 
             
                  text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
         | 
| 107 112 | 
             
                  text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
         | 
| 108 113 | 
             
                  if config[:expand_url]
         | 
    
        data/lib/earthquake/twitter.rb
    CHANGED
    
    | @@ -5,7 +5,7 @@ module Earthquake | |
| 5 5 | 
             
              end
         | 
| 6 6 |  | 
| 7 7 | 
             
              init do
         | 
| 8 | 
            -
                @twitter = TwitterOAuth::Client.new(config.slice(:consumer_key, :consumer_secret, :token, :secret))
         | 
| 8 | 
            +
                @twitter = TwitterOAuth::Client.new(config.slice(:consumer_key, :consumer_secret, :token, :secret, :api_version, :secure))
         | 
| 9 9 |  | 
| 10 10 | 
             
                output do |item|
         | 
| 11 11 | 
             
                  next if item["text"].nil? || item["_disable_cache"]
         | 
| @@ -31,24 +31,6 @@ module Earthquake | |
| 31 31 | 
             
                    end
         | 
| 32 32 | 
             
                    alias_method_chain m, :cache
         | 
| 33 33 | 
             
                  end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  def initialize(options = {})
         | 
| 36 | 
            -
                    @consumer_key = options[:consumer_key]
         | 
| 37 | 
            -
                    @consumer_secret = options[:consumer_secret]
         | 
| 38 | 
            -
                    @token = options[:token]
         | 
| 39 | 
            -
                    @secret = options[:secret]
         | 
| 40 | 
            -
                    @proxy = ENV['http_proxy']
         | 
| 41 | 
            -
                  end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                  def consumer
         | 
| 44 | 
            -
                    options = { :site => 'http://api.twitter.com' }
         | 
| 45 | 
            -
                    options.update( :proxy => @proxy ) if @proxy
         | 
| 46 | 
            -
                    @consumer ||= OAuth::Consumer.new(
         | 
| 47 | 
            -
                      @consumer_key,
         | 
| 48 | 
            -
                      @consumer_secret,
         | 
| 49 | 
            -
                      options
         | 
| 50 | 
            -
                    )
         | 
| 51 | 
            -
                  end
         | 
| 52 34 | 
             
                end
         | 
| 53 35 | 
             
              end
         | 
| 54 36 |  | 
    
        data/lib/earthquake/version.rb
    CHANGED
    
    
| @@ -0,0 +1,78 @@ | |
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
            require 'earthquake/option_parser'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe Earthquake::OptionParser do
         | 
| 6 | 
            +
              describe '#parse' do
         | 
| 7 | 
            +
                it 'should return an hash' do
         | 
| 8 | 
            +
                  options = Earthquake::OptionParser.new([]).parse
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                it 'parses debug option' do
         | 
| 12 | 
            +
                  %w{-d --debug}.each do |opt|
         | 
| 13 | 
            +
                    options = Earthquake::OptionParser.new([opt]).parse
         | 
| 14 | 
            +
                    expect(options[:debug]).to be_true
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                it 'parses no-logo option' do
         | 
| 19 | 
            +
                  %w{-n --no-logo}.each do |opt|
         | 
| 20 | 
            +
                    options = Earthquake::OptionParser.new([opt]).parse
         | 
| 21 | 
            +
                    expect(options[:'no-logo']).to be_true
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                it 'parses command option' do
         | 
| 26 | 
            +
                  %w{-c --command}.each do |opt|
         | 
| 27 | 
            +
                    command = 'dummy'
         | 
| 28 | 
            +
                    options = Earthquake::OptionParser.new([opt, command]).parse
         | 
| 29 | 
            +
                    expect(options[:command]).to eq(command)
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                it 'parses no-stream option' do
         | 
| 34 | 
            +
                  options = Earthquake::OptionParser.new(['--no-stream']).parse
         | 
| 35 | 
            +
                  expect(options[:'no-stream']).to be_true
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                def with_test_output_stream(out, &block)
         | 
| 39 | 
            +
                  old_stdout = $stderr
         | 
| 40 | 
            +
                  $stderr = out
         | 
| 41 | 
            +
                  yield
         | 
| 42 | 
            +
                  out.close
         | 
| 43 | 
            +
                ensure
         | 
| 44 | 
            +
                  $stderr = old_stdout
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                it 'parses help option' do
         | 
| 48 | 
            +
                  old_stderr = $stderr
         | 
| 49 | 
            +
                  begin
         | 
| 50 | 
            +
                    $stderr = out = StringIO.new
         | 
| 51 | 
            +
                    Earthquake::OptionParser.new(['--help']).parse
         | 
| 52 | 
            +
                    out.close
         | 
| 53 | 
            +
                    expect(out.string).to match(/^Usage: /)
         | 
| 54 | 
            +
                  rescue => e
         | 
| 55 | 
            +
                    # do nothing
         | 
| 56 | 
            +
                  ensure
         | 
| 57 | 
            +
                    $stderr = old_stderr
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                it 'raises exception for invalid option' do
         | 
| 62 | 
            +
                  expect {
         | 
| 63 | 
            +
                    Earthquake::OptionParser.new(['--foo']).parse
         | 
| 64 | 
            +
                  }.to raise_exception
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                it 'removes help option' do
         | 
| 68 | 
            +
                  options= Earthquake::OptionParser.new([]).parse
         | 
| 69 | 
            +
                  expect(options).to_not be_key(:help)
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                it 'adds rest of arguments as :dir' do
         | 
| 73 | 
            +
                  dir = 'foo'
         | 
| 74 | 
            +
                  options= Earthquake::OptionParser.new([dir]).parse
         | 
| 75 | 
            +
                  expect(options[:dir]).to eq(dir)
         | 
| 76 | 
            +
                end
         | 
| 77 | 
            +
              end
         | 
| 78 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,164 +1,144 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: earthquake
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 1.0.0
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - jugyo
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 11 | 
            +
            date: 2013-06-12 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 14 | 
             
              name: twitter-stream
         | 
| 16 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 17 | 
            +
                - - '>='
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 19 | 
             
                    version: '0'
         | 
| 22 20 | 
             
              type: :runtime
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 | 
            -
                - -  | 
| 24 | 
            +
                - - '>='
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 26 | 
             
                    version: '0'
         | 
| 30 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 28 | 
             
              name: notify
         | 
| 32 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 30 | 
             
                requirements:
         | 
| 35 | 
            -
                - -  | 
| 31 | 
            +
                - - '>='
         | 
| 36 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 33 | 
             
                    version: '0'
         | 
| 38 34 | 
             
              type: :runtime
         | 
| 39 35 | 
             
              prerelease: false
         | 
| 40 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 37 | 
             
                requirements:
         | 
| 43 | 
            -
                - -  | 
| 38 | 
            +
                - - '>='
         | 
| 44 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 40 | 
             
                    version: '0'
         | 
| 46 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 42 | 
             
              name: i18n
         | 
| 48 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 44 | 
             
                requirements:
         | 
| 51 | 
            -
                - -  | 
| 45 | 
            +
                - - '>='
         | 
| 52 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 47 | 
             
                    version: '0'
         | 
| 54 48 | 
             
              type: :runtime
         | 
| 55 49 | 
             
              prerelease: false
         | 
| 56 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 51 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 52 | 
            +
                - - '>='
         | 
| 60 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 54 | 
             
                    version: '0'
         | 
| 62 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 56 | 
             
              name: activesupport
         | 
| 64 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 58 | 
             
                requirements:
         | 
| 67 | 
            -
                - -  | 
| 59 | 
            +
                - - '>='
         | 
| 68 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 61 | 
             
                    version: '0'
         | 
| 70 62 | 
             
              type: :runtime
         | 
| 71 63 | 
             
              prerelease: false
         | 
| 72 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 65 | 
             
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 66 | 
            +
                - - '>='
         | 
| 76 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 68 | 
             
                    version: '0'
         | 
| 78 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 70 | 
             
              name: awesome_print
         | 
| 80 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 72 | 
             
                requirements:
         | 
| 83 | 
            -
                - -  | 
| 73 | 
            +
                - - '>='
         | 
| 84 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 75 | 
             
                    version: '0'
         | 
| 86 76 | 
             
              type: :runtime
         | 
| 87 77 | 
             
              prerelease: false
         | 
| 88 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            -
                none: false
         | 
| 90 79 | 
             
                requirements:
         | 
| 91 | 
            -
                - -  | 
| 80 | 
            +
                - - '>='
         | 
| 92 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 82 | 
             
                    version: '0'
         | 
| 94 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 95 84 | 
             
              name: launchy
         | 
| 96 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 97 | 
            -
                none: false
         | 
| 98 86 | 
             
                requirements:
         | 
| 99 | 
            -
                - -  | 
| 87 | 
            +
                - - '>='
         | 
| 100 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 89 | 
             
                    version: '0'
         | 
| 102 90 | 
             
              type: :runtime
         | 
| 103 91 | 
             
              prerelease: false
         | 
| 104 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 105 | 
            -
                none: false
         | 
| 106 93 | 
             
                requirements:
         | 
| 107 | 
            -
                - -  | 
| 94 | 
            +
                - - '>='
         | 
| 108 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 96 | 
             
                    version: '0'
         | 
| 110 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 98 | 
             
              name: oauth
         | 
| 112 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 | 
            -
                none: false
         | 
| 114 100 | 
             
                requirements:
         | 
| 115 | 
            -
                - -  | 
| 101 | 
            +
                - - '>='
         | 
| 116 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 103 | 
             
                    version: '0'
         | 
| 118 104 | 
             
              type: :runtime
         | 
| 119 105 | 
             
              prerelease: false
         | 
| 120 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                none: false
         | 
| 122 107 | 
             
                requirements:
         | 
| 123 | 
            -
                - -  | 
| 108 | 
            +
                - - '>='
         | 
| 124 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 110 | 
             
                    version: '0'
         | 
| 126 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 | 
            -
              name: twitter_oauth
         | 
| 112 | 
            +
              name: jugyo-twitter_oauth
         | 
| 128 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            -
                none: false
         | 
| 130 114 | 
             
                requirements:
         | 
| 131 115 | 
             
                - - '='
         | 
| 132 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 133 | 
            -
                    version: 0. | 
| 117 | 
            +
                    version: 0.5.0.pre5
         | 
| 134 118 | 
             
              type: :runtime
         | 
| 135 119 | 
             
              prerelease: false
         | 
| 136 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            -
                none: false
         | 
| 138 121 | 
             
                requirements:
         | 
| 139 122 | 
             
                - - '='
         | 
| 140 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 141 | 
            -
                    version: 0. | 
| 124 | 
            +
                    version: 0.5.0.pre5
         | 
| 142 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 143 126 | 
             
              name: slop
         | 
| 144 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 145 | 
            -
                none: false
         | 
| 146 128 | 
             
                requirements:
         | 
| 147 129 | 
             
                - - ~>
         | 
| 148 130 | 
             
                  - !ruby/object:Gem::Version
         | 
| 149 | 
            -
                    version:  | 
| 131 | 
            +
                    version: 3.4.0
         | 
| 150 132 | 
             
              type: :runtime
         | 
| 151 133 | 
             
              prerelease: false
         | 
| 152 134 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 153 | 
            -
                none: false
         | 
| 154 135 | 
             
                requirements:
         | 
| 155 136 | 
             
                - - ~>
         | 
| 156 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 157 | 
            -
                    version:  | 
| 138 | 
            +
                    version: 3.4.0
         | 
| 158 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 159 140 | 
             
              name: rspec
         | 
| 160 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 161 | 
            -
                none: false
         | 
| 162 142 | 
             
                requirements:
         | 
| 163 143 | 
             
                - - ~>
         | 
| 164 144 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -166,7 +146,6 @@ dependencies: | |
| 166 146 | 
             
              type: :development
         | 
| 167 147 | 
             
              prerelease: false
         | 
| 168 148 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 169 | 
            -
                none: false
         | 
| 170 149 | 
             
                requirements:
         | 
| 171 150 | 
             
                - - ~>
         | 
| 172 151 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -174,17 +153,15 @@ dependencies: | |
| 174 153 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 175 154 | 
             
              name: bundler
         | 
| 176 155 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 177 | 
            -
                none: false
         | 
| 178 156 | 
             
                requirements:
         | 
| 179 | 
            -
                - -  | 
| 157 | 
            +
                - - '>='
         | 
| 180 158 | 
             
                  - !ruby/object:Gem::Version
         | 
| 181 159 | 
             
                    version: '0'
         | 
| 182 160 | 
             
              type: :development
         | 
| 183 161 | 
             
              prerelease: false
         | 
| 184 162 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 185 | 
            -
                none: false
         | 
| 186 163 | 
             
                requirements:
         | 
| 187 | 
            -
                - -  | 
| 164 | 
            +
                - - '>='
         | 
| 188 165 | 
             
                  - !ruby/object:Gem::Version
         | 
| 189 166 | 
             
                    version: '0'
         | 
| 190 167 | 
             
            description: Twitter Client on Terminal with Twitter Streaming API.
         | 
| @@ -213,37 +190,37 @@ files: | |
| 213 190 | 
             
            - lib/earthquake/help.rb
         | 
| 214 191 | 
             
            - lib/earthquake/id_var.rb
         | 
| 215 192 | 
             
            - lib/earthquake/input.rb
         | 
| 193 | 
            +
            - lib/earthquake/option_parser.rb
         | 
| 216 194 | 
             
            - lib/earthquake/output.rb
         | 
| 217 195 | 
             
            - lib/earthquake/twitter.rb
         | 
| 218 196 | 
             
            - lib/earthquake/version.rb
         | 
| 219 | 
            -
            - spec/ | 
| 197 | 
            +
            - spec/earthquake_option_parser_spec.rb
         | 
| 220 198 | 
             
            - spec/spec_helper.rb
         | 
| 221 199 | 
             
            - consumer.yml
         | 
| 222 200 | 
             
            homepage: https://github.com/jugyo/earthquake
         | 
| 223 201 | 
             
            licenses: []
         | 
| 202 | 
            +
            metadata: {}
         | 
| 224 203 | 
             
            post_install_message: 
         | 
| 225 204 | 
             
            rdoc_options: []
         | 
| 226 205 | 
             
            require_paths:
         | 
| 227 206 | 
             
            - lib
         | 
| 228 207 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 229 | 
            -
              none: false
         | 
| 230 208 | 
             
              requirements:
         | 
| 231 | 
            -
              - -  | 
| 209 | 
            +
              - - '>='
         | 
| 232 210 | 
             
                - !ruby/object:Gem::Version
         | 
| 233 211 | 
             
                  version: '0'
         | 
| 234 212 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 235 | 
            -
              none: false
         | 
| 236 213 | 
             
              requirements:
         | 
| 237 | 
            -
              - -  | 
| 214 | 
            +
              - - '>='
         | 
| 238 215 | 
             
                - !ruby/object:Gem::Version
         | 
| 239 216 | 
             
                  version: '0'
         | 
| 240 217 | 
             
            requirements: []
         | 
| 241 218 | 
             
            rubyforge_project: earthquake
         | 
| 242 | 
            -
            rubygems_version:  | 
| 219 | 
            +
            rubygems_version: 2.0.3
         | 
| 243 220 | 
             
            signing_key: 
         | 
| 244 | 
            -
            specification_version:  | 
| 221 | 
            +
            specification_version: 4
         | 
| 245 222 | 
             
            summary: Terminal Twitter Client
         | 
| 246 223 | 
             
            test_files:
         | 
| 247 | 
            -
            - spec/ | 
| 224 | 
            +
            - spec/earthquake_option_parser_spec.rb
         | 
| 248 225 | 
             
            - spec/spec_helper.rb
         | 
| 249 226 | 
             
            has_rdoc: 
         |