tweetwine 0.3.2 → 0.4.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.
Files changed (46) hide show
  1. data/.gitignore +6 -0
  2. data/CHANGELOG.rdoc +9 -0
  3. data/Gemfile +5 -13
  4. data/LICENSE.txt +1 -1
  5. data/README.md +3 -2
  6. data/Rakefile +8 -2
  7. data/lib/tweetwine/character_encoding.rb +1 -1
  8. data/lib/tweetwine/cli.rb +9 -3
  9. data/lib/tweetwine/config.rb +3 -3
  10. data/lib/tweetwine/exceptions.rb +54 -0
  11. data/lib/tweetwine/http.rb +1 -1
  12. data/lib/tweetwine/{util.rb → support.rb} +19 -12
  13. data/lib/tweetwine/tweet.rb +69 -0
  14. data/lib/tweetwine/twitter.rb +70 -72
  15. data/lib/tweetwine/ui.rb +36 -41
  16. data/lib/tweetwine/uri.rb +31 -0
  17. data/lib/tweetwine/version.rb +15 -0
  18. data/lib/tweetwine.rb +6 -64
  19. data/man/tweetwine.7 +4 -3
  20. data/man/tweetwine.7.ronn +3 -2
  21. data/release-script.txt +10 -0
  22. data/test/example/authorization_example.rb +40 -0
  23. data/test/example/example_helper.rb +1 -1
  24. data/test/example/global_options_example.rb +64 -0
  25. data/test/example/search_statuses_example.rb +36 -31
  26. data/test/example/show_followers_example.rb +1 -1
  27. data/test/example/show_friends_example.rb +1 -1
  28. data/test/example/show_home_example.rb +17 -29
  29. data/test/example/show_mentions_example.rb +2 -2
  30. data/test/example/show_user_example.rb +14 -12
  31. data/test/example/update_status_example.rb +9 -9
  32. data/test/example/use_http_proxy_example.rb +7 -6
  33. data/test/example/{application_behavior_example.rb → user_help_example.rb} +6 -39
  34. data/test/unit/config_test.rb +1 -1
  35. data/test/unit/http_test.rb +1 -21
  36. data/test/unit/oauth_test.rb +11 -11
  37. data/test/unit/{util_test.rb → support_test.rb} +37 -38
  38. data/test/unit/tweet_helper.rb +83 -0
  39. data/test/unit/tweet_test.rb +153 -0
  40. data/test/unit/twitter_test.rb +240 -248
  41. data/test/unit/ui_test.rb +174 -78
  42. data/test/unit/unit_helper.rb +18 -6
  43. data/test/unit/uri_test.rb +41 -0
  44. data/test/unit/url_shortener_test.rb +7 -7
  45. data/tweetwine.gemspec +12 -22
  46. metadata +52 -73
data/test/unit/ui_test.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  # coding: utf-8
2
2
 
3
- require "unit_helper"
3
+ require 'unit_helper'
4
+ require 'tweet_helper'
4
5
 
5
6
  module Tweetwine::Test
6
7
 
7
8
  class UITest < UnitTestCase
9
+ include TweetHelper
10
+
8
11
  context "a UI instance" do
9
12
  setup do
10
13
  @in = mock
@@ -69,75 +72,109 @@ class UITest < UnitTestCase
69
72
  @ui = UI.new({:in => @in, :out => @out, :colors => false })
70
73
  end
71
74
 
72
- should "output a record as user info when no status is given" do
75
+ should "output tweet with just user info" do
73
76
  from_user = "fooman"
74
- record = { :from_user => from_user }
77
+ tweet = create_tweet(:from_user => from_user)
75
78
  @out.expects(:puts).with(<<-END
76
79
  #{from_user}
77
80
 
78
81
  END
79
82
  )
80
- @ui.show_record(record)
83
+ @ui.show_tweet(tweet)
81
84
  end
82
85
 
83
- should "output a record as status info when status is given, without in-reply info" do
86
+ should "output regular tweet" do
84
87
  from_user = "fooman"
85
88
  status = "Hi, @barman! Lulz woo! #hellos"
86
- record = {
89
+ tweet = create_tweet(
87
90
  :from_user => from_user,
88
- :status => status,
89
- :created_at => Time.at(1),
90
- :to_user => nil
91
- }
92
- Util.expects(:humanize_time_diff).returns([2, "secs"])
91
+ :status => status
92
+ )
93
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
93
94
  @out.expects(:puts).with(<<-END
94
95
  #{from_user}, 2 secs ago:
95
96
  #{status}
96
97
 
97
98
  END
98
99
  )
99
- @ui.show_record(record)
100
+ @ui.show_tweet(tweet)
100
101
  end
101
102
 
102
- should "output a record as status info when status is given, with in-reply info" do
103
+ should "output replying tweet" do
103
104
  from_user = "barman"
104
105
  to_user = "fooman"
105
- status = "Hi, @fooman! How are you doing?"
106
- record = {
106
+ status = "Hi, @#{to_user}! How are you doing?"
107
+ tweet = create_tweet(
107
108
  :from_user => from_user,
108
109
  :status => status,
109
- :created_at => Time.at(1),
110
110
  :to_user => to_user
111
- }
112
- Util.expects(:humanize_time_diff).returns([2, "secs"])
111
+ )
112
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
113
113
  @out.expects(:puts).with(<<-END
114
114
  #{from_user}, in reply to #{to_user}, 2 secs ago:
115
115
  #{status}
116
116
 
117
117
  END
118
118
  )
119
- @ui.show_record(record)
119
+ @ui.show_tweet(tweet)
120
120
  end
121
121
 
122
+ should "output regular retweet" do
123
+ from_user = "barman"
124
+ rt_user = "fooman"
125
+ status = "status worth retweeting"
126
+ tweet = create_tweet(
127
+ :from_user => from_user,
128
+ :status => status,
129
+ :rt_user => rt_user
130
+ )
131
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
132
+ @out.expects(:puts).with(<<-END
133
+ #{rt_user} RT #{from_user}, 2 secs ago:
134
+ #{status}
135
+
136
+ END
137
+ )
138
+ @ui.show_tweet(tweet)
139
+ end
140
+
141
+ should "output replying retweet" do
142
+ from_user = "barman"
143
+ to_user = "jackman"
144
+ rt_user = "fooman"
145
+ status = "@#{to_user}, reply worth retweeting"
146
+ tweet = create_tweet(
147
+ :from_user => from_user,
148
+ :to_user => to_user,
149
+ :status => status,
150
+ :rt_user => rt_user
151
+ )
152
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
153
+ @out.expects(:puts).with(<<-END
154
+ #{rt_user} RT #{from_user}, in reply to #{to_user}, 2 secs ago:
155
+ #{status}
156
+
157
+ END
158
+ )
159
+ @ui.show_tweet(tweet)
160
+ end
122
161
 
123
162
  should "unescape HTML in a status" do
124
163
  from_user = "fooman"
125
164
  escaped_status = "apple &gt; orange &amp; grapefruit &lt; banana"
126
165
  unescaped_status = "apple > orange & grapefruit < banana"
127
- record = {
166
+ tweet = create_tweet(
128
167
  :from_user => from_user,
129
- :status => escaped_status,
130
- :created_at => Time.at(1),
131
- :to_user => nil
132
- }
133
- Util.expects(:humanize_time_diff).returns([2, "secs"])
168
+ :status => escaped_status
169
+ )
170
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
134
171
  @out.expects(:puts).with(<<-END
135
172
  #{from_user}, 2 secs ago:
136
173
  #{unescaped_status}
137
174
 
138
175
  END
139
176
  )
140
- @ui.show_record(record)
177
+ @ui.show_tweet(tweet)
141
178
  end
142
179
 
143
180
  should "output a preview of a status" do
@@ -157,53 +194,89 @@ class UITest < UnitTestCase
157
194
  @ui = UI.new({:in => @in, :out => @out, :colors => true})
158
195
  end
159
196
 
160
- should "output a record as user info when no status is given" do
197
+ should "output tweet with just user info" do
161
198
  from_user = "fooman"
162
- record = { :from_user => from_user }
199
+ tweet = create_tweet(:from_user => from_user)
163
200
  @out.expects(:puts).with(<<-END
164
201
  \e[32m#{from_user}\e[0m
165
202
 
166
203
  END
167
204
  )
168
- @ui.show_record(record)
205
+ @ui.show_tweet(tweet)
169
206
  end
170
207
 
171
- should "output a record as status info when status is given, without in-reply info" do
208
+ should "output regular tweet" do
172
209
  from_user = "fooman"
173
210
  status = "Wondering about the meaning of life."
174
- record = {
211
+ tweet = create_tweet(
175
212
  :from_user => from_user,
176
- :status => status,
177
- :created_at => Time.at(1),
178
- :to_user => nil
179
- }
180
- Util.expects(:humanize_time_diff).returns([2, "secs"])
213
+ :status => status
214
+ )
215
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
181
216
  @out.expects(:puts).with(<<-END
182
217
  \e[32m#{from_user}\e[0m, 2 secs ago:
183
218
  #{status}
184
219
 
185
220
  END
186
221
  )
187
- @ui.show_record(record)
222
+ @ui.show_tweet(tweet)
188
223
  end
189
224
 
190
- should "output a record as status info when status is given, with in-reply info" do
225
+ should "output replying tweet" do
191
226
  from_user = "barman"
192
227
  to_user = "fooman"
193
- record = {
228
+ tweet = create_tweet(
194
229
  :from_user => from_user,
195
230
  :status => "@#{to_user}! How are you doing?",
196
- :created_at => Time.at(1),
197
231
  :to_user => to_user
198
- }
199
- Util.expects(:humanize_time_diff).returns([2, "secs"])
232
+ )
233
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
200
234
  @out.expects(:puts).with(<<-END
201
235
  \e[32m#{from_user}\e[0m, in reply to \e[32m#{to_user}\e[0m, 2 secs ago:
202
236
  \e[33m@#{to_user}\e[0m! How are you doing?
203
237
 
204
238
  END
205
239
  )
206
- @ui.show_record(record)
240
+ @ui.show_tweet(tweet)
241
+ end
242
+
243
+ should "output regular retweet" do
244
+ from_user = "barman"
245
+ rt_user = "fooman"
246
+ status = "status worth retweeting"
247
+ tweet = create_tweet(
248
+ :from_user => from_user,
249
+ :status => status,
250
+ :rt_user => rt_user
251
+ )
252
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
253
+ @out.expects(:puts).with(<<-END
254
+ \e[32m#{rt_user}\e[0m RT \e[32m#{from_user}\e[0m, 2 secs ago:
255
+ #{status}
256
+
257
+ END
258
+ )
259
+ @ui.show_tweet(tweet)
260
+ end
261
+
262
+ should "output replying retweet" do
263
+ from_user = "barman"
264
+ to_user = "jackman"
265
+ rt_user = "fooman"
266
+ tweet = create_tweet(
267
+ :from_user => from_user,
268
+ :to_user => to_user,
269
+ :status => "@#{to_user}, reply worth retweeting",
270
+ :rt_user => rt_user
271
+ )
272
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
273
+ @out.expects(:puts).with(<<-END
274
+ \e[32m#{rt_user}\e[0m RT \e[32m#{from_user}\e[0m, in reply to \e[32m#{to_user}\e[0m, 2 secs ago:
275
+ \e[33m@#{to_user}\e[0m, reply worth retweeting
276
+
277
+ END
278
+ )
279
+ @ui.show_tweet(tweet)
207
280
  end
208
281
 
209
282
  should "output a preview of a status" do
@@ -220,39 +293,35 @@ class UITest < UnitTestCase
220
293
  should "highlight hashtags in a status" do
221
294
  from_user = "barman"
222
295
  hashtags = %w{#slang #beignHappy}
223
- record = {
296
+ tweet = create_tweet(
224
297
  :from_user => from_user,
225
- :status => "Lulz, so happy! #{hashtags[0]} #{hashtags[1]}",
226
- :created_at => Time.at(1),
227
- :to_user => nil
228
- }
229
- Util.expects(:humanize_time_diff).returns([2, "secs"])
298
+ :status => "Lulz, so happy! #{hashtags[0]} #{hashtags[1]}"
299
+ )
300
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
230
301
  @out.expects(:puts).with(<<-END
231
302
  \e[32m#{from_user}\e[0m, 2 secs ago:
232
303
  Lulz, so happy! \e[35m#{hashtags[0]}\e[0m \e[35m#{hashtags[1]}\e[0m
233
304
 
234
305
  END
235
306
  )
236
- @ui.show_record(record)
307
+ @ui.show_tweet(tweet)
237
308
  end
238
309
 
239
310
  %w{http://is.gd/1qLk3 http://is.gd/1qLk3?id=foo}.each do |url|
240
311
  should "highlight HTTP and HTTPS URLs in a status, given #{url}" do
241
312
  from_user = "barman"
242
- record = {
313
+ tweet = create_tweet(
243
314
  :from_user => from_user,
244
- :status => "New Rails³ - #{url}",
245
- :created_at => Time.at(1),
246
- :to_user => nil
247
- }
248
- Util.expects(:humanize_time_diff).returns([2, "secs"])
315
+ :status => "New Rails³ - #{url}"
316
+ )
317
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
249
318
  @out.expects(:puts).with(<<-END
250
319
  \e[32m#{from_user}\e[0m, 2 secs ago:
251
320
  New Rails³ - \e[36m#{url}\e[0m
252
321
 
253
322
  END
254
323
  )
255
- @ui.show_record(record)
324
+ @ui.show_tweet(tweet)
256
325
  end
257
326
  end
258
327
 
@@ -262,60 +331,87 @@ New Rails³ - \e[36m#{url}\e[0m
262
331
  ].each do |(first_url, second_url)|
263
332
  should "highlight HTTP and HTTPS URLs in a status, given #{first_url} and #{second_url}" do
264
333
  from_user = "barman"
265
- record = {
334
+ tweet = create_tweet(
266
335
  :from_user => from_user,
267
- :status => "Links: #{first_url} and #{second_url} np",
268
- :created_at => Time.at(1),
269
- :to_user => nil
270
- }
271
- Util.expects(:humanize_time_diff).returns([2, "secs"])
336
+ :status => "Links: #{first_url} and #{second_url} np"
337
+ )
338
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
272
339
  @out.expects(:puts).with(<<-END
273
340
  \e[32m#{from_user}\e[0m, 2 secs ago:
274
341
  Links: \e[36m#{first_url}\e[0m and \e[36m#{second_url}\e[0m np
275
342
 
276
343
  END
277
344
  )
278
- @ui.show_record(record)
345
+ @ui.show_tweet(tweet)
279
346
  end
280
347
  end
281
348
 
282
349
  should "highlight usernames in a status" do
283
350
  from_user = "barman"
284
351
  users = %w{@fooman @barbaz @spoonman}
285
- record = {
352
+ tweet = create_tweet(
286
353
  :from_user => from_user,
287
- :status => "I salute you #{users[0]}, #{users[1]}, and #{users[2]}!",
288
- :created_at => Time.at(1),
289
- :to_user => nil
290
- }
291
- Util.expects(:humanize_time_diff).returns([2, "secs"])
354
+ :status => "I salute you #{users[0]}, #{users[1]}, and #{users[2]}!"
355
+ )
356
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
292
357
  @out.expects(:puts).with(<<-END
293
358
  \e[32m#{from_user}\e[0m, 2 secs ago:
294
359
  I salute you \e[33m#{users[0]}\e[0m, \e[33m#{users[1]}\e[0m, and \e[33m#{users[2]}\e[0m!
295
360
 
296
361
  END
297
362
  )
298
- @ui.show_record(record)
363
+ @ui.show_tweet(tweet)
299
364
  end
300
365
 
301
366
  should "not highlight email addresses as usernames in a status" do
302
367
  from_user = "barman"
303
368
  users = %w{@fooman @barbaz}
304
369
  email = "barbaz@foo.net"
305
- record = {
370
+ tweet = create_tweet(
306
371
  :from_user => from_user,
307
- :status => "Hi, #{users[0]}! You should notify #{users[1]}, #{email}",
308
- :created_at => Time.at(1),
309
- :to_user => nil
310
- }
311
- Util.expects(:humanize_time_diff).returns([2, "secs"])
372
+ :status => "Hi, #{users[0]}! You should notify #{users[1]}, #{email}"
373
+ )
374
+ Support.expects(:humanize_time_diff).returns([2, "secs"])
312
375
  @out.expects(:puts).with(<<-END
313
376
  \e[32m#{from_user}\e[0m, 2 secs ago:
314
377
  Hi, \e[33m#{users[0]}\e[0m! You should notify \e[33m#{users[1]}\e[0m, #{email}
315
378
 
316
379
  END
317
380
  )
318
- @ui.show_record(record)
381
+ @ui.show_tweet(tweet)
382
+ end
383
+ end
384
+
385
+ context "for outputting a collection of tweets" do
386
+ setup do
387
+ @users = %w{first_user second_user}
388
+ statuses = @users.map { |from| "Hi, I'm #{from}." }
389
+ @users_and_statuses = @users.zip statuses
390
+ @outputs = @users_and_statuses.map { |(user, status)| <<-END
391
+ #{user}, 2 secs ago:
392
+ #{status}
393
+
394
+ END
395
+ }
396
+ @tweets = @users_and_statuses.map { |(user, status)| create_tweet(
397
+ :from_user => user,
398
+ :status => status
399
+ )}
400
+ Support.expects(:humanize_time_diff).twice.returns([2, "secs"])
401
+ end
402
+
403
+ should "output tweets in descending order" do
404
+ ui = UI.new({ :out => @out, :show_reverse => false })
405
+ @out.expects(:puts).with(@outputs[0])
406
+ @out.expects(:puts).with(@outputs[1])
407
+ ui.show_tweets(@tweets)
408
+ end
409
+
410
+ should "output tweets in ascending order" do
411
+ ui = UI.new({ :out => @out, :show_reverse => true })
412
+ @out.expects(:puts).with(@outputs[1])
413
+ @out.expects(:puts).with(@outputs[0])
414
+ ui.show_tweets(@tweets)
319
415
  end
320
416
  end
321
417
  end
@@ -16,22 +16,34 @@ module Tweetwine::Test
16
16
  # The method sorts +expected+ and +actual+ in order to compare them. By
17
17
  # default, this sorting is done by calling #sort for each of them. If the
18
18
  # method is called with a block, it is passed to the #sort calls.
19
- def assert_contains_exactly(expected, actual, msg = '', &sorter)
19
+ def assert_contains_exactly(expected, actual, msg = nil, &sorter)
20
20
  expected = block_given? ? expected.sort(&sorter) : expected.sort
21
21
  actual = block_given? ? actual.sort(&sorter) : actual.sort
22
- assert_equal(expected, actual, msg)
22
+ assert_equal(expected, actual, get_message(msg) {
23
+ 'after sorting, collection %s is not equal to %s' % [expected.inspect, actual.inspect]
24
+ })
23
25
  end
24
26
 
25
27
  # Fails unless +str+ is a full match to +regex+.
26
- def assert_full_match(regex, str, msg = '')
28
+ def assert_full_match(regex, str, msg = nil)
27
29
  match_data = regex.match(str)
28
- assert(str == match_data.to_s, msg)
30
+ assert(str == match_data.to_s, get_message(msg) {
31
+ '%s is not a full match to %s' % [str, regex.inspect]
32
+ })
29
33
  end
30
34
 
31
35
  # Fails if +str+ is a full match to +regex+.
32
- def assert_no_full_match(regex, str, msg = '')
36
+ def assert_no_full_match(regex, str, msg = nil)
33
37
  match_data = regex.match(str)
34
- assert(str != match_data.to_s, msg)
38
+ assert(str != match_data.to_s, get_message(msg) {
39
+ '%s is a full match to %s' % [str, regex.inspect]
40
+ })
41
+ end
42
+
43
+ private
44
+
45
+ def get_message(given, &default)
46
+ given.nil? ? default.call : given
35
47
  end
36
48
  end
37
49
 
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+
3
+ require "unit_helper"
4
+
5
+ module Tweetwine::Test
6
+
7
+ class UriTest < UnitTestCase
8
+ context "for percent-encoding strings" do
9
+ [
10
+ %w{a a},
11
+ %w{B B},
12
+ %w{3 3},
13
+ %w{. period},
14
+ %w{- dash},
15
+ %w{_ underscore},
16
+ ].each do |char, desc|
17
+ should "not encode safe characters, case #{desc}" do
18
+ assert_equal char, Uri.percent_encode(char)
19
+ end
20
+ end
21
+
22
+ should "encode space character with percent-encoding, not with '+' character" do
23
+ assert_equal "%20", Uri.percent_encode(" ")
24
+ end
25
+
26
+ [
27
+ %w{& %26 ampersand},
28
+ %w{? %3F question mark},
29
+ %w{/ %2F slash},
30
+ %w{: %3A colon},
31
+ %w{, %2C comma}
32
+ ].each do |char, expected, desc|
33
+ should "encode unsafe characters that URI.encode leaves by default unencoded, case #{desc}" do
34
+ assert_equal char, Uri.parser.escape(char)
35
+ assert_equal expected, Uri.percent_encode(char)
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -90,7 +90,7 @@ class UrlShortenerTest < UnitTestCase
90
90
  },
91
91
  :xpath_selector => "//input[@id='short_url']/@value")
92
92
  @http.expects(:get).
93
- with("http://shorten.it/create?token=xyz&url=http://www.ruby-doc.org/core/")
93
+ with("http://shorten.it/create?token=xyz&url=http://www.ruby-doc.org/core/")
94
94
  url_shortener.shorten("http://www.ruby-doc.org/core/")
95
95
  end
96
96
  end
@@ -103,7 +103,7 @@ class UrlShortenerTest < UnitTestCase
103
103
  :url_param_name => "url",
104
104
  :xpath_selector => "//input[@id='short_url']/@value")
105
105
  @http.expects(:post).
106
- with("http://shorten.it/create", {:url => "http://www.ruby-doc.org/core/"})
106
+ with("http://shorten.it/create", {:url => "http://www.ruby-doc.org/core/"})
107
107
  url_shortener.shorten("http://www.ruby-doc.org/core/")
108
108
  end
109
109
 
@@ -117,9 +117,9 @@ class UrlShortenerTest < UnitTestCase
117
117
  },
118
118
  :xpath_selector => "//input[@id='short_url']/@value")
119
119
  @http.expects(:post).
120
- with("http://shorten.it/create",
121
- :token => "xyz",
122
- :url => "http://www.ruby-doc.org/core/")
120
+ with("http://shorten.it/create",
121
+ :token => "xyz",
122
+ :url => "http://www.ruby-doc.org/core/")
123
123
  url_shortener.shorten("http://www.ruby-doc.org/core/")
124
124
  end
125
125
  end
@@ -132,8 +132,8 @@ class UrlShortenerTest < UnitTestCase
132
132
  :url_param_name => "url",
133
133
  :xpath_selector => "//input[@id='short_url']/@value")
134
134
  @http.expects(:post).
135
- with("http://shorten.it/create", :url => "http://www.ruby-doc.org/core/").
136
- raises(HttpError.new(404, "Not Found"))
135
+ with("http://shorten.it/create", :url => "http://www.ruby-doc.org/core/").
136
+ raises(HttpError.new(404, "Not Found"))
137
137
  assert_raise(HttpError) { url_shortener.shorten("http://www.ruby-doc.org/core/") }
138
138
  end
139
139
  end
data/tweetwine.gemspec CHANGED
@@ -2,49 +2,39 @@
2
2
 
3
3
  $LOAD_PATH.unshift(File.expand_path('lib', File.dirname(__FILE__)))
4
4
  name = 'tweetwine'
5
- require name
6
- summary = Tweetwine.summary
7
- version = Tweetwine.version.dup
5
+ require "#{name}/version"
6
+ version = Tweetwine.version
8
7
 
9
8
  Gem::Specification.new do |s|
10
9
  s.name = name
11
- s.version = version
10
+ s.version = version.dup
12
11
 
13
- s.summary = summary
12
+ s.summary = Tweetwine.summary
14
13
  s.description = <<-END
15
14
  A simple but tasty Twitter agent for command line use, designed for quickly
16
15
  showing the latest tweets.
17
16
  END
18
17
 
19
18
  s.email = 'tkareine@gmail.com'
20
- s.homepage = 'https://github.com/tuomas/tweetwine'
19
+ s.homepage = 'https://github.com/tkareine/tweetwine'
21
20
 
22
21
  s.authors = ['Tuomas Kareinen']
23
22
 
24
- s.executables = %w{tweetwine}
25
- s.files = Dir[
26
- '*.md',
27
- '*.rdoc',
28
- 'LICENSE.txt',
29
- 'Gemfile',
30
- 'Rakefile',
31
- 'tweetwine.gemspec',
32
- '{bin,contrib,lib}/**/*',
33
- 'man/**/*.[1-9]',
34
- 'man/**/*.ronn'
35
- ]
36
- s.test_files = Dir['test/**/*']
23
+ s.files = `git ls-files`.split("\n") + Dir['man/**/*.[1-9]']
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
37
26
 
38
27
  s.add_dependency 'oauth', '~> 0.4.4'
39
28
  s.add_development_dependency 'contest', '~> 0.1.2'
40
- s.add_development_dependency 'coulda', '~> 0.6.0'
29
+ s.add_development_dependency 'coulda', '~> 0.6.3'
41
30
  s.add_development_dependency 'gem-man', '~> 0.2.0'
42
31
  s.add_development_dependency 'mcmire-matchy', '~> 0.5.2'
43
- s.add_development_dependency 'mocha', '= 0.9.8'
32
+ s.add_development_dependency 'mocha', '~> 0.9.12'
44
33
  s.add_development_dependency 'open4', '~> 1.0.1'
34
+ s.add_development_dependency 'rake', '~> 0.8.7'
45
35
  s.add_development_dependency 'ronn', '~> 0.7.3'
46
36
  s.add_development_dependency 'timecop', '~> 0.3.5'
47
- s.add_development_dependency 'webmock', '~> 1.6.1'
37
+ s.add_development_dependency 'webmock', '~> 1.6.2'
48
38
 
49
39
  s.post_install_message = <<-END
50
40