earthquake 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b67d0711b61d5ffd750f5e2c32533b376149337c
4
- data.tar.gz: 99b668a42fc0220f3db351f7e74d6d9fb0e63568
3
+ metadata.gz: a7ffafd0d3ca9cb9323cfbc64cc3f34a271db5c8
4
+ data.tar.gz: 95e27275fee012094eeb664e751e1c9cce368977
5
5
  SHA512:
6
- metadata.gz: fced4dd9126ee990b0cebdbb81c4ed6f33f72d1ad0aaaf251e04c07da55495cc4ca4ac1713ab4fb1421760f64cbcd2509b4476a67874fee538510fc39f086dcf
7
- data.tar.gz: 2a5029a51afe819d0236de6bfc8de7d3d82bf71f0da942e48e8a1fcae0da92444dab9a62adfb4a71b62defa3b668dba9580a9f8e31ecf318fded804936885919
6
+ metadata.gz: 60e816f16be331db21e33fbaef14d571be5c646bc025b10b65277ae6a5e759dc5b94a391ecce32047a7a60eb63157e75cf349231cda8de8dc1eac2571e820e6a
7
+ data.tar.gz: f64d7910095ee485bb614103005c265953c8cef438235ec0e9241e41b57044542d566f85cbaa29ef29ade9bdc4e309f557362f008fae444a80a58c83fde0398f
@@ -0,0 +1,19 @@
1
+ # Based on the Fedora image
2
+ FROM fedora
3
+
4
+ MAINTAINER "Maciej Lasyk" <maciek@lasyk.info>
5
+
6
+ # install main packages:
7
+ RUN yum -y update
8
+ RUN yum -y install openssl-devel openssl readline readline-devel gcc gcc-c++ rubygems rubygems-devel ruby ruby-devel
9
+
10
+ # install earthquake
11
+ RUN gem install earthquake
12
+
13
+ # set the env:
14
+ RUN useradd -d /home/twitter twitter
15
+ USER twitter
16
+ ENV HOME /home/twitter
17
+ WORKDIR /home/twitter
18
+
19
+ CMD ["earthquake"]
data/README.md CHANGED
@@ -2,7 +2,7 @@ Earthquake
2
2
  ====
3
3
 
4
4
  Terminal-based Twitter Client with Streaming API support.
5
- Only supports Ruby 1.9.
5
+ Only supports Ruby 1.9 and later.
6
6
 
7
7
  Homepage: [https://github.com/jugyo/earthquake](https://github.com/jugyo/earthquake)
8
8
  Twitter: [http://twitter.com/earthquakegem](http://twitter.com/earthquakegem)
@@ -24,6 +24,16 @@ Features
24
24
  Install
25
25
  ----
26
26
 
27
+ Quick-installation using Docker (http://docker.io)
28
+ -----
29
+
30
+ Just clone the repo and:
31
+
32
+ $ sudo docker build -t earthquake .
33
+ $ sudo docker run --rm -i -name earthquake -t earthquake
34
+
35
+ Normall installation
36
+ -----
27
37
  You'll need openssl and readline support with your 1.9.2. If you are
28
38
  using rvm you can run:
29
39
 
@@ -41,18 +51,17 @@ Then install the gem:
41
51
 
42
52
  $ sudo apt-get install libssl-dev
43
53
 
44
- Usage
45
- ----
46
-
54
+ Command-Line Usage
55
+ -----------------
47
56
  ### Launch
48
57
 
49
58
  $ earthquake
59
+
60
+ ### Help
50
61
 
51
- Commands
52
- ----
62
+ ⚡ :help
53
63
 
54
64
  ### Tweet
55
-
56
65
  ⚡ Hello World!
57
66
 
58
67
  ### Show
@@ -33,7 +33,8 @@ end
33
33
 
34
34
  require 'earthquake'
35
35
  if command
36
- Earthquake.invoke(command, options)
36
+ result = Earthquake.invoke(command, options)
37
+ result.join if result.is_a?(Thread)
37
38
  else
38
39
  Earthquake.start(options)
39
40
  end
@@ -2,6 +2,7 @@
2
2
  json
3
3
  thread
4
4
  readline
5
+ date
5
6
  active_support/core_ext
6
7
  active_support/dependencies
7
8
  active_support/cache
@@ -11,6 +12,7 @@
11
12
  launchy
12
13
  oauth
13
14
  twitter_oauth
15
+ yaml
14
16
  ).each { |lib| require lib }
15
17
 
16
18
  Thread.abort_on_exception = true
@@ -480,7 +480,7 @@ Earthquake.init do
480
480
  puts "the host must be gist.github.com".c(41)
481
481
  else
482
482
  puts "..."
483
- gist_id = uri.path[/\d+/]
483
+ gist_id = uri.path[%r|/(\d+)/?$|,1]
484
484
  meta = JSON.parse(open("https://api.github.com/gists/#{gist_id}").read)
485
485
  filename = meta["files"].keys[0]
486
486
  raw = meta['files'][filename]['content']
@@ -145,11 +145,7 @@ module Earthquake
145
145
 
146
146
  EM.add_periodic_timer(config[:output_interval]) do
147
147
  if @last_data_received_at && Time.now - @last_data_received_at > config[:no_data_timeout]
148
- begin
149
- reconnect
150
- rescue EventMachine::ConnectionError => e
151
- # ignore
152
- end
148
+ reconnect
153
149
  end
154
150
  if Readline.line_buffer.nil? || Readline.line_buffer.empty?
155
151
  sync { output }
@@ -165,6 +161,8 @@ module Earthquake
165
161
  def reconnect
166
162
  item_queue.clear
167
163
  start_stream(config[:api])
164
+ rescue EventMachine::ConnectionError => e
165
+ # ignore
168
166
  end
169
167
 
170
168
  def start_stream(options)
@@ -5,14 +5,16 @@ module Twitter
5
5
  @reconnect_callback.call(timeout, @reconnect_retries) if @reconnect_callback
6
6
 
7
7
  if timeout == 0
8
- reconnect @options[:host], @options[:port]
9
8
  start_tls if @options[:ssl]
9
+ reconnect @options[:host], @options[:port]
10
10
  else
11
11
  EM.add_timer(timeout) do
12
- reconnect @options[:host], @options[:port]
13
12
  start_tls if @options[:ssl]
13
+ reconnect @options[:host], @options[:port]
14
14
  end
15
15
  end
16
+ rescue EventMachine::ConnectionError => e
17
+ # ignore
16
18
  end
17
19
  end
18
20
  end
@@ -37,6 +37,7 @@ module Earthquake
37
37
  @table.delete(@table.read(var))
38
38
  @table.write(var, id)
39
39
  @table.write(id, var)
40
+ @table.write(@prefix + '_', id)
40
41
  var.dup
41
42
  end
42
43
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  require 'stringio'
3
+ require 'monitor'
3
4
 
4
5
  module Earthquake
5
6
  module Output
@@ -50,22 +51,31 @@ module Earthquake
50
51
  end
51
52
 
52
53
  def insert(*messages)
53
- $stdout = StringIO.new
54
+ insert_monitor.synchronize do
55
+ begin
56
+ try_swap = !$stdout.is_a?(StringIO)
57
+ $stdout = StringIO.new if try_swap
54
58
 
55
- puts messages
56
- yield if block_given?
59
+ puts messages
60
+ yield if block_given?
57
61
 
58
- unless $stdout.string.empty?
59
- STDOUT.print "\e[0G\e[K#{$stdout.string}"
60
- Readline.refresh_line
62
+ unless $stdout.string.empty?
63
+ STDOUT.print "\e[0G\e[K#{$stdout.string}"
64
+ Readline.refresh_line
65
+ end
66
+ ensure
67
+ $stdout = STDOUT if try_swap
68
+ end
61
69
  end
62
- ensure
63
- $stdout = STDOUT
64
70
  end
65
71
 
66
72
  def color_of(screen_name)
67
73
  config[:colors][screen_name.delete("^0-9A-Za-z_").to_i(36) % config[:colors].size]
68
74
  end
75
+
76
+ def insert_monitor
77
+ @insert_monitor ||= Monitor.new
78
+ end
69
79
  end
70
80
 
71
81
  init do
@@ -1,3 +1,3 @@
1
1
  module Earthquake
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earthquake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-12 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twitter-stream
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: notify
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: i18n
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: awesome_print
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: launchy
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: oauth
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
@@ -126,42 +126,42 @@ dependencies:
126
126
  name: slop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 3.4.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 3.4.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '2.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '2.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: bundler
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: Twitter Client on Terminal with Twitter Streaming API.
@@ -172,14 +172,16 @@ executables:
172
172
  extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
- - .document
176
- - .gitignore
177
- - .rspec
175
+ - ".document"
176
+ - ".gitignore"
177
+ - ".rspec"
178
+ - Dockerfile
178
179
  - Gemfile
179
180
  - LICENSE.txt
180
181
  - README.md
181
182
  - Rakefile
182
183
  - bin/earthquake
184
+ - consumer.yml
183
185
  - earthquake.gemspec
184
186
  - lib/earthquake.rb
185
187
  - lib/earthquake/cache.rb
@@ -196,7 +198,6 @@ files:
196
198
  - lib/earthquake/version.rb
197
199
  - spec/earthquake_option_parser_spec.rb
198
200
  - spec/spec_helper.rb
199
- - consumer.yml
200
201
  homepage: https://github.com/jugyo/earthquake
201
202
  licenses: []
202
203
  metadata: {}
@@ -206,21 +207,20 @@ require_paths:
206
207
  - lib
207
208
  required_ruby_version: !ruby/object:Gem::Requirement
208
209
  requirements:
209
- - - '>='
210
+ - - ">="
210
211
  - !ruby/object:Gem::Version
211
212
  version: '0'
212
213
  required_rubygems_version: !ruby/object:Gem::Requirement
213
214
  requirements:
214
- - - '>='
215
+ - - ">="
215
216
  - !ruby/object:Gem::Version
216
217
  version: '0'
217
218
  requirements: []
218
219
  rubyforge_project: earthquake
219
- rubygems_version: 2.0.3
220
+ rubygems_version: 2.2.2
220
221
  signing_key:
221
222
  specification_version: 4
222
223
  summary: Terminal Twitter Client
223
224
  test_files:
224
225
  - spec/earthquake_option_parser_spec.rb
225
226
  - spec/spec_helper.rb
226
- has_rdoc: