termtter 1.11.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module Termtter::Client
13
13
  def self.expand_tco_urls!(text, urls)
14
14
  urls.each do |u|
15
15
  next unless u[:expanded_url]
16
- text[/#{Regexp.escape(u[:url])}/] = u[:expanded_url]
16
+ text.sub!(/#{Regexp.escape(u[:url])}/, u[:expanded_url])
17
17
  end
18
18
  end
19
19
  end
@@ -61,7 +61,7 @@ module Termtter::Client
61
61
 
62
62
  result = Termtter::API.twitter.update(arg, params)
63
63
 
64
- if result.text == arg
64
+ if ! result[:error]
65
65
  puts "updated => #{result.text}"
66
66
  else
67
67
  puts TermColor.parse("<red>Failed to update :(</red>")
data/lib/termtter/api.rb CHANGED
@@ -103,9 +103,9 @@ module Termtter
103
103
  :app_name => config.app_name.empty? ? Termtter::APP_NAME : config.app_name,
104
104
  :host => config.host,
105
105
  :header => {
106
- 'User-Agent' => 'Termtter http://github.com/jugyo/termtter',
106
+ 'User-Agent' => 'Termtter http://github.com/termtter/termtter',
107
107
  'X-Twitter-Client' => 'Termtter',
108
- 'X-Twitter-Client-URL' => 'http://github.com/jugyo/termtter',
108
+ 'X-Twitter-Client-URL' => 'http://github.com/termtter/termtter',
109
109
  'X-Twitter-Client-Version' => Termtter::VERSION
110
110
  },
111
111
  :enable_ssl => config.enable_ssl,
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Termtter
4
- VERSION = "1.11.0"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require File.expand_path(File.dirname(__FILE__)) + '/../../spec_helper'
4
+
5
+ describe Termtter::Client, 'plugin expand_tco_url' do
6
+ before do
7
+ be_quiet { Termtter::Client.plug 'defaults/expand_tco_url' }
8
+ end
9
+
10
+ it 'should expand urls' do
11
+ text1 = 'あいうえお http://example.com/xyz'
12
+ urls1 = [{:url => 'http://example.com/xyz', :expanded_url => 'http://example.net/abc'}]
13
+ Termtter::Client.expand_tco_urls!(text1, urls1)
14
+ text1.should == 'あいうえお http://example.net/abc'
15
+ end
16
+
17
+ it 'should not raise exception when url does not matched' do
18
+ text = 'text without urls'
19
+ urls = [{:url => 'http://example.com/xyz', :expanded_url => 'http://example.net/abc'}]
20
+ lambda { Termtter::Client.expand_tco_urls!(text, urls) }.should_not raise_exception
21
+ end
22
+ end
metadata CHANGED
@@ -1,115 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: termtter
3
- version: !ruby/object:Gem::Version
4
- hash: 59
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 11
9
- - 0
10
- version: 1.11.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - jugyo
14
9
  - ujihisa
15
10
  - koichiroo
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2012-04-01 00:00:00 +09:00
21
- default_executable: termtter
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
14
+ date: 2013-04-07 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
24
17
  name: json
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
27
19
  none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 21
32
- segments:
33
- - 1
34
- - 1
35
- - 3
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
36
23
  version: 1.1.3
37
24
  type: :runtime
38
- version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: highline
41
25
  prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: 1.1.3
32
+ - !ruby/object:Gem::Dependency
33
+ name: highline
34
+ requirement: !ruby/object:Gem::Requirement
43
35
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- hash: 3
48
- segments:
49
- - 1
50
- - 5
51
- - 0
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
52
39
  version: 1.5.0
53
40
  type: :runtime
54
- version_requirements: *id002
55
- - !ruby/object:Gem::Dependency
56
- name: termcolor
57
41
  prerelease: false
58
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
59
43
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 23
64
- segments:
65
- - 1
66
- - 0
67
- - 0
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.5.0
48
+ - !ruby/object:Gem::Dependency
49
+ name: termcolor
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
68
55
  version: 1.0.0
69
56
  type: :runtime
70
- version_requirements: *id003
71
- - !ruby/object:Gem::Dependency
72
- name: rubytter
73
57
  prerelease: false
74
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: !ruby/object:Gem::Requirement
75
59
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 7
80
- segments:
81
- - 1
82
- - 4
83
- - 0
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.0
64
+ - !ruby/object:Gem::Dependency
65
+ name: rubytter
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
84
71
  version: 1.4.0
85
72
  type: :runtime
86
- version_requirements: *id004
87
- - !ruby/object:Gem::Dependency
88
- name: notify
89
73
  prerelease: false
90
- requirement: &id005 !ruby/object:Gem::Requirement
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: 1.4.0
80
+ - !ruby/object:Gem::Dependency
81
+ name: notify
82
+ requirement: !ruby/object:Gem::Requirement
91
83
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 21
96
- segments:
97
- - 0
98
- - 2
99
- - 1
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
100
87
  version: 0.2.1
101
88
  type: :runtime
102
- version_requirements: *id005
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: 0.2.1
103
96
  description: Termtter is a terminal based Twitter client.
104
97
  email: jugyo.org@gmail.com
105
- executables:
98
+ executables:
106
99
  - termtter
107
100
  extensions: []
108
-
109
- extra_rdoc_files:
101
+ extra_rdoc_files:
110
102
  - ChangeLog
111
103
  - README.rdoc
112
- files:
104
+ files:
113
105
  - .gitignore
114
106
  - ChangeLog
115
107
  - Gemfile
@@ -344,6 +336,7 @@ files:
344
336
  - spec/plugins/cool_spec.rb
345
337
  - spec/plugins/curry_spec.rb
346
338
  - spec/plugins/db_spec.rb
339
+ - spec/plugins/defaults/expand_tco_url_spec.rb
347
340
  - spec/plugins/defaults/hashtag_spec.rb
348
341
  - spec/plugins/defaults/list_spec.rb
349
342
  - spec/plugins/defaults/plugin_spec.rb
@@ -389,48 +382,40 @@ files:
389
382
  - spec/termtter/task_spec.rb
390
383
  - spec/termtter_spec.rb
391
384
  - termtter.gemspec
392
- has_rdoc: true
393
385
  homepage: http://termtter.github.com/
394
386
  licenses: []
395
-
396
387
  post_install_message:
397
- rdoc_options:
388
+ rdoc_options:
398
389
  - --main
399
390
  - README.rdoc
400
391
  - --exclude
401
392
  - spec
402
- require_paths:
393
+ require_paths:
403
394
  - lib
404
- required_ruby_version: !ruby/object:Gem::Requirement
395
+ required_ruby_version: !ruby/object:Gem::Requirement
405
396
  none: false
406
- requirements:
407
- - - ">="
408
- - !ruby/object:Gem::Version
409
- hash: 3
410
- segments:
411
- - 0
412
- version: "0"
413
- required_rubygems_version: !ruby/object:Gem::Requirement
397
+ requirements:
398
+ - - ! '>='
399
+ - !ruby/object:Gem::Version
400
+ version: '0'
401
+ required_rubygems_version: !ruby/object:Gem::Requirement
414
402
  none: false
415
- requirements:
416
- - - ">="
417
- - !ruby/object:Gem::Version
418
- hash: 3
419
- segments:
420
- - 0
421
- version: "0"
403
+ requirements:
404
+ - - ! '>='
405
+ - !ruby/object:Gem::Version
406
+ version: '0'
422
407
  requirements: []
423
-
424
408
  rubyforge_project: termtter
425
- rubygems_version: 1.3.7
409
+ rubygems_version: 1.8.23
426
410
  signing_key:
427
411
  specification_version: 3
428
412
  summary: Terminal based Twitter client.
429
- test_files:
413
+ test_files:
430
414
  - spec/plugins/capital_update_spec.rb
431
415
  - spec/plugins/cool_spec.rb
432
416
  - spec/plugins/curry_spec.rb
433
417
  - spec/plugins/db_spec.rb
418
+ - spec/plugins/defaults/expand_tco_url_spec.rb
434
419
  - spec/plugins/defaults/hashtag_spec.rb
435
420
  - spec/plugins/defaults/list_spec.rb
436
421
  - spec/plugins/defaults/plugin_spec.rb