earthquake 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -140,7 +140,7 @@ You can try it by using the :eval command:
140
140
  Plugins
141
141
  ----
142
142
 
143
- => [https://github.com/jugyo/earthquake/wiki/Plugin](https://github.com/jugyo/earthquake/wiki/Plugin)
143
+ => [https://github.com/jugyo/earthquake/wiki/Plugins](https://github.com/jugyo/earthquake/wiki/Plugins)
144
144
 
145
145
  Making Plugin
146
146
  ----
@@ -216,6 +216,16 @@ The 'm' is a MatchData.
216
216
  end
217
217
  end
218
218
 
219
+ ### Replacing the output for tweets
220
+
221
+ Earthquake.init do
222
+ output :tweet do |item|
223
+ next unless item["text"]
224
+ name = item["user"]["screen_name"]
225
+ puts "#{name.c(color_of(name))}: foo"
226
+ end
227
+ end
228
+
219
229
  ### Defining completion
220
230
 
221
231
  Earthquake.init do
@@ -227,6 +237,8 @@ The 'm' is a MatchData.
227
237
  TODO
228
238
  ----
229
239
 
240
+ * Earthquake should parse ARGV
241
+ * ruby1.9nize
230
242
  * guideline for plugin
231
243
  * deal proxy
232
244
  * spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
data/earthquake.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{earthquake}
8
- s.version = "0.6.5"
8
+ s.version = "0.6.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo"]
12
- s.date = %q{2011-04-08}
12
+ s.date = %q{2011-04-11}
13
13
  s.default_executable = %q{earthquake}
14
14
  s.description = %q{Twitter Client on Terminal with Twitter Streaming API.}
15
15
  s.email = %q{jugyo.org@gmail.com}
@@ -60,7 +60,7 @@ Accordingly, you should renew the access token if it is old.
60
60
  }
61
61
  s.require_paths = ["lib"]
62
62
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
63
- s.rubygems_version = %q{1.6.2}
63
+ s.rubygems_version = %q{1.6.0}
64
64
  s.summary = %q{Twitter Client on Terminal.}
65
65
  s.test_files = [
66
66
  "spec/earthquake_spec.rb",
@@ -44,10 +44,7 @@ Earthquake.init do
44
44
  end
45
45
 
46
46
  command :status do |m|
47
- puts_items tweet = twitter.status(m[1])
48
- if tweet["in_reply_to_status_id"]
49
- puts_items twitter.status(tweet["in_reply_to_status_id"]).tap { |t| t["_mark"] = " " }
50
- end
47
+ puts_items twitter.status(m[1])
51
48
  end
52
49
 
53
50
  # $xx
@@ -241,4 +238,8 @@ Earthquake.init do
241
238
  end
242
239
  end
243
240
  end
241
+
242
+ command :edit_config do
243
+ system ENV["EDITOR"], config[:file]
244
+ end
244
245
  end
@@ -31,19 +31,18 @@ module Earthquake
31
31
  reload
32
32
  return if text.empty?
33
33
 
34
- begin
35
- input_filters.each { |f| text = f.call(text) }
34
+ input_filters.each { |f| text = f.call(text) }
36
35
 
37
- if command = command(text)
38
- command[:block].call(command[:pattern].match(text))
39
- elsif !text.empty?
40
- puts "Command not found".c(43)
41
- end
42
-
43
- store_history
44
- rescue Exception => e
45
- error e
36
+ if command = command(text)
37
+ command[:block].call(command[:pattern].match(text))
38
+ elsif !text.empty?
39
+ puts "Command not found".c(43)
46
40
  end
41
+
42
+ store_history
43
+ reload
44
+ rescue Exception => e
45
+ error e
47
46
  end
48
47
 
49
48
  def command(pattern, options = {}, &block)
@@ -67,16 +66,18 @@ module Earthquake
67
66
  def confirm(message, type = :y)
68
67
  case type
69
68
  when :y
70
- print "#{message} [Yn] ".u
71
- return !(gets.strip =~ /^n$/i)
69
+ return !(ask("#{message} [Yn] ".u) =~ /^n$/i)
72
70
  when :n
73
- print "#{message} [yN] ".u
74
- return !!(gets.strip =~ /^y$/i)
71
+ return !!(ask("#{message} [yN] ".u) =~ /^y$/i)
75
72
  else
76
73
  raise "type must be :y or :n"
77
74
  end
78
75
  end
79
76
 
77
+ def ask(message)
78
+ Readline.readline(message, false)
79
+ end
80
+
80
81
  def async_e(&block)
81
82
  async { handle_api_error(&block) }
82
83
  end
@@ -127,6 +127,12 @@ module Earthquake
127
127
  puts status
128
128
  end
129
129
 
130
+ output :delete do |item|
131
+ if item["delete"]
132
+ puts "[deleted]".c(:event) + " #{id2var item["delete"]["status"]["id"]}"
133
+ end
134
+ end
135
+
130
136
  output :event do |item|
131
137
  next unless item["event"]
132
138
 
@@ -136,8 +142,6 @@ module Earthquake
136
142
  puts "[#{item["event"]}]".c(:event) + " #{item["source"]["screen_name"]} => #{item["target"]["screen_name"]}"
137
143
  when "favorite", "unfavorite"
138
144
  puts "[#{item["event"]}]".c(:event) + " #{item["source"]["screen_name"]} => #{item["target"]["screen_name"]} : #{item["target_object"]["text"].u}"
139
- when "delete"
140
- puts "[deleted]".c(:event) + " #{item["delete"]["status"]["id"]}"
141
145
  else
142
146
  if config[:debug]
143
147
  ap item
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: earthquake
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.5
5
+ version: 0.6.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-08 00:00:00 +09:00
13
+ date: 2011-04-11 00:00:00 +09:00
14
14
  default_executable: earthquake
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  requirements: []
206
206
 
207
207
  rubyforge_project:
208
- rubygems_version: 1.6.2
208
+ rubygems_version: 1.6.0
209
209
  signing_key:
210
210
  specification_version: 3
211
211
  summary: Twitter Client on Terminal.