atig 0.4.1 → 0.4.2

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: 3e201d9ce1842a733c03d41341dd68c6d9b87532
4
- data.tar.gz: 0a3320335a18a898edc078983d931fe96638d9ab
3
+ metadata.gz: f52437a64db888b7a72bfcb418fdfe62222e0380
4
+ data.tar.gz: 064c715ba416098c2602455f2d637f662a63b06d
5
5
  SHA512:
6
- metadata.gz: 71203f2d8ba4e7ce17683c1a814754a9f83e51593861154209e683f24ac60a0b33eda8247ca78fcdb7342c722e05940c839e2e358d00b297e1d5351352a24aff
7
- data.tar.gz: a7f51a1b6a287ce03f2afaac5691b0edb780aab67b1e8d056a48c62d4a8c8ce2743cb742ee32cc20378fdf2f0a6d5b34c7d502cacd555758304a48bdf77bd452
6
+ metadata.gz: 2d7094055345ec00bebe4b8a2ea7a8f36c26500dfc8530c9fc25c5d8d353c584209dd11c25b66b921c1d76b5e3e6f14bdc85c0a3176e1458806a7813963754ec
7
+ data.tar.gz: 28ecc6f10e97b88ffd6215d9c6e1688a9a4572edbeda0479a526fde67c33f97d4d81aec4d958e53f8f191d6909a4803fade7e0b3d876fb5041c71c62ad872413
@@ -36,12 +36,17 @@ only
36
36
 
37
37
  発言関連
38
38
  ------------------------------
39
+ stream
40
+ `UserStream`_ を有効にします。
41
+ 実行中の変更には対応していません。
39
42
  footer=\ ``footer``
40
43
  発言の末尾に、 ``footer`` を追加します。
41
44
  ただし ``footer`` がfalseの場合は、追加しません。
42
45
  old_style_reply
43
46
  @nickで始まる発言が、@nick の最新の発言へのreplyとなるモードに切り替えます。
44
47
 
48
+ .. _UserStream: https://dev.twitter.com/docs/streaming-apis/streams/user
49
+
45
50
  URL短縮関係
46
51
  ------------------------------
47
52
 
@@ -4,11 +4,18 @@ require 'atig/agent/agent'
4
4
  module Atig
5
5
  module Agent
6
6
  class Timeline < Atig::Agent::Agent
7
+ DEFAULT_INTERVAL = 60
8
+
7
9
  def initialize(context, api, db)
8
- return if context.opts.stream
10
+ @opts = context.opts
11
+ return if @opts.stream
9
12
  super
10
13
  end
11
- def interval; 30 end
14
+
15
+ def interval
16
+ @interval ||= @opts.interval.nil? ? DEFAULT_INTERVAL : @opts.interval.to_i
17
+ end
18
+
12
19
  def path; '/statuses/home_timeline' end
13
20
  def source; :timeline end
14
21
  end
@@ -16,33 +16,43 @@ module Atig
16
16
  end
17
17
 
18
18
  def call(status)
19
- target = if @opts.untiny_whole_urls then
20
- URI.regexp(%w[http https])
21
- else
22
- %r{
23
- http:// (?:
24
- (?: bit\.ly | (?: tin | rub) yurl\.com | j\.mp | t\.co
25
- | htn.to
26
- | is\.gd | cli\.gs | tr\.im | u\.nu | airme\.us
27
- | ff\.im | twurl.nl | bkite\.com | tumblr\.com
28
- | pic\.gd | sn\.im | digg\.com | goo\.gl)
29
- / [0-9a-z=-]+ |
30
- blip\.fm/~ (?> [0-9a-z]+) (?! /) |
31
- flic\.kr/[a-z0-9/]+
32
- )
33
- }ix
34
- end
35
-
19
+ target = short_url_regexp
20
+ entities = status.entities
36
21
  status.merge :text => status.text.gsub(target) {|url|
37
- x = @cache[url]
38
- if x then
39
- x
40
- else
41
- @cache[url] = resolve_http_redirect(URI(url)).to_s || url
22
+ unless entities.nil? or (entities = entities.urls).empty?
23
+ @cache[url] ||= search_url_from_entities(url, entities)
42
24
  end
25
+ @cache[url] ||= resolve_http_redirect(URI(url)).to_s || url
43
26
  }
44
27
  end
45
28
 
29
+ private
30
+
31
+ def short_url_regexp
32
+ return URI.regexp(%w[http https]) if @opts.untiny_whole_urls
33
+ %r{
34
+ https?:// (?:
35
+ (?: bit\.ly | (?: tin | rub) yurl\.com | j\.mp | t\.co
36
+ | htn.to
37
+ | is\.gd | cli\.gs | tr\.im | u\.nu | airme\.us
38
+ | ff\.im | twurl.nl | bkite\.com | tumblr\.com
39
+ | pic\.gd | sn\.im | digg\.com | goo\.gl)
40
+ / [0-9a-z=-]+ |
41
+ blip\.fm/~ (?> [0-9a-z]+) (?! /) |
42
+ flic\.kr/[a-z0-9/]+
43
+ )
44
+ }ix
45
+ end
46
+
47
+ def search_url_from_entities(url, entities)
48
+ expanded_url = nil
49
+ entities.reject! do |entity|
50
+ entity.url == url &&
51
+ (expanded_url = entity.expanded_url)
52
+ end
53
+ expanded_url
54
+ end
55
+
46
56
  def resolve_http_redirect(uri, limit = 3)
47
57
  return uri if limit.zero? or uri.nil?
48
58
  log :debug, uri.inspect
@@ -1,3 +1,3 @@
1
1
  module Atig
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -12,7 +12,7 @@ describe Atig::Command::Destroy,"when status is not removed" do
12
12
 
13
13
  it "should specified other's status" do
14
14
  entry = entry user(2,'other'), status('blah blah', 'id'=>'1')
15
- @statuses.stub!(:find_by_tid).with('b').and_return(entry)
15
+ @statuses.stub(:find_by_tid).with('b').and_return(entry)
16
16
 
17
17
  @channel.should_receive(:notify).with("The status you specified by the ID tid is not yours.")
18
18
  call "#twitter","destory",%w(b)
@@ -27,7 +27,7 @@ describe Atig::Command::Destroy,"when remove recently tweet" do
27
27
 
28
28
  target = status 'blah blah', 'id'=>'1'
29
29
  entry = entry @me, target,'entry',1
30
- @res = mock 'res'
30
+ @res = double 'res'
31
31
 
32
32
  stub_status(:find_by_tid,'a' => entry)
33
33
  stub_status(:find_by_sid,'mzp:a' => entry)
@@ -71,7 +71,7 @@ describe Atig::Command::Destroy,"when remove old tweet" do
71
71
 
72
72
  target = status 'blah blah', 'id'=>'1'
73
73
  entry = entry @me, target,'entry',1
74
- @res = mock 'res'
74
+ @res = double 'res'
75
75
 
76
76
  stub_status(:find_by_tid,'a' => entry)
77
77
  stub_status(:find_by_sid,'mzp:a' => entry)
@@ -10,7 +10,7 @@ describe Atig::Command::Favorite do
10
10
 
11
11
  target = status 'blah blah', 'id'=>'1'
12
12
  entry = entry user(1,'mzp'), target
13
- @res = mock 'res'
13
+ @res = double 'res'
14
14
 
15
15
  stub_status(:find_by_tid,'a' => entry)
16
16
  stub_status(:find_by_sid,'mzp:a' => entry)
@@ -9,9 +9,9 @@ describe Atig::Command::Limit do
9
9
  before do
10
10
  @reset = ::Time.utc(2010,9,25,8,24,12)
11
11
  @command = init Atig::Command::Limit
12
- @api.stub!(:limit).and_return(150)
13
- @api.stub!(:remain).and_return(148)
14
- @api.stub!(:reset).and_return(@reset)
12
+ @api.stub(:limit).and_return(150)
13
+ @api.stub(:remain).and_return(148)
14
+ @api.stub(:reset).and_return(@reset)
15
15
  end
16
16
 
17
17
  it "should provide limit command" do
@@ -24,14 +24,14 @@ describe Atig::Command::Option, 'when have many property' do
24
24
  @opts.foo2 = 42
25
25
  @opts.foo3 = 42.1
26
26
 
27
- @opts.stub!(:foo1=)
28
- @opts.stub!(:foo2=)
29
- @opts.stub!(:foo3=)
27
+ @opts.stub(:foo1=)
28
+ @opts.stub(:foo2=)
29
+ @opts.stub(:foo3=)
30
30
  end
31
31
 
32
32
  it "should list up values" do
33
33
  xs = []
34
- @channel.stub!(:notify){|x| xs << x}
34
+ @channel.stub(:notify){|x| xs << x}
35
35
  call '#twitter', 'opt', %w()
36
36
  xs.should == [
37
37
  "foo1 => true",
@@ -47,9 +47,9 @@ describe Atig::Command::Option, 'when have bool property' do
47
47
 
48
48
  before do
49
49
  @command = init Atig::Command::Option
50
- @opts.stub!(:foo).and_return true
51
- @opts.stub!(:foo=){|v| @value = v }
52
- @channel.stub!(:notify)
50
+ @opts.stub(:foo).and_return true
51
+ @opts.stub(:foo=){|v| @value = v }
52
+ @channel.stub(:notify)
53
53
  end
54
54
 
55
55
  it "should show the value" do
@@ -68,9 +68,9 @@ describe Atig::Command::Option, 'when have int property' do
68
68
 
69
69
  before do
70
70
  @command = init Atig::Command::Option
71
- @opts.stub!(:foo).and_return 42
72
- @opts.stub!(:foo=){|v| @value = v }
73
- @channel.stub!(:notify)
71
+ @opts.stub(:foo).and_return 42
72
+ @opts.stub(:foo=){|v| @value = v }
73
+ @channel.stub(:notify)
74
74
  end
75
75
 
76
76
  it "should show the value" do
@@ -89,9 +89,9 @@ describe Atig::Command::Option, 'when have float property' do
89
89
 
90
90
  before do
91
91
  @command = init Atig::Command::Option
92
- @opts.stub!(:foo).and_return 1.23
93
- @opts.stub!(:foo=){|v| @value = v }
94
- @channel.stub!(:notify)
92
+ @opts.stub(:foo).and_return 1.23
93
+ @opts.stub(:foo=){|v| @value = v }
94
+ @channel.stub(:notify)
95
95
  end
96
96
 
97
97
  it "should show the value" do
@@ -110,9 +110,9 @@ describe Atig::Command::Option, 'when have string property' do
110
110
 
111
111
  before do
112
112
  @command = init Atig::Command::Option
113
- @opts.stub!(:foo).and_return "bar"
114
- @opts.stub!(:foo=){|v| @value = v }
115
- @channel.stub!(:notify)
113
+ @opts.stub(:foo).and_return "bar"
114
+ @opts.stub(:foo=){|v| @value = v }
115
+ @channel.stub(:notify)
116
116
  end
117
117
 
118
118
  it "should show the value" do
@@ -10,7 +10,7 @@ describe Atig::Command::Reply do
10
10
 
11
11
  target = status 'blah blah', 'id'=>'1'
12
12
  entry = entry user(1,'mzp'), target
13
- @res = mock 'res'
13
+ @res = double 'res'
14
14
 
15
15
  stub_status(:find_by_tid,'a' => entry)
16
16
  stub_status(:find_by_sid,'mzp:a' => entry)
@@ -6,17 +6,17 @@ require 'atig/command/retweet'
6
6
  describe Atig::Command::Retweet do
7
7
  include CommandHelper
8
8
  before do
9
- bitly = mock("Bitly")
10
- bitly.stub!(:shorten).and_return{|s|
9
+ bitly = double("Bitly")
10
+ bitly.stub(:shorten).and_return{|s|
11
11
  "[#{s}]"
12
12
  }
13
- Atig::Bitly.stub!(:no_login).and_return(bitly)
13
+ Atig::Bitly.stub(:no_login).and_return(bitly)
14
14
 
15
15
  @command = init Atig::Command::Retweet
16
16
 
17
17
  target = status 'blah blah blah blah blah blah blah blah', 'id'=>'1'
18
18
  entry = entry user(1,'mzp'), target
19
- @res = mock 'res'
19
+ @res = double 'res'
20
20
 
21
21
  stub_status(:find_by_tid,'a' => entry)
22
22
  stub_status(:find_by_sid,'mzp:a' => entry)
@@ -6,7 +6,7 @@ require 'atig/command/thread'
6
6
  describe Atig::Command::Thread do
7
7
  include CommandHelper
8
8
  before do
9
- u = mock 'user'
9
+ u = double 'user'
10
10
  @entries = [
11
11
  entry(u, status(''),'entry-0'),
12
12
  entry(u, status('','in_reply_to_status_id'=>2),'entry-1'),
@@ -16,10 +16,10 @@ describe Atig::Command::Thread do
16
16
  ]
17
17
  @command = init Atig::Command::Thread
18
18
  @messages = []
19
- @channel.stub!(:message).and_return{|entry,_|
19
+ @channel.stub(:message).and_return{|entry,_|
20
20
  @messages.unshift entry
21
21
  }
22
- @statuses.stub!(:find_by_status_id).with(anything).and_return{|id|
22
+ @statuses.stub(:find_by_status_id).with(anything).and_return{|id|
23
23
  @entries[id.to_i]
24
24
  }
25
25
  end
@@ -7,9 +7,9 @@ describe Atig::Command::Time do
7
7
  include CommandHelper
8
8
 
9
9
  def user(offset, tz)
10
- u = mock "user-#{offset}"
11
- u.stub!(:utc_offset).and_return(offset)
12
- u.stub!(:time_zone).and_return(tz)
10
+ u = double "user-#{offset}"
11
+ u.stub(:utc_offset).and_return(offset)
12
+ u.stub(:time_zone).and_return(tz)
13
13
  u
14
14
  end
15
15
 
@@ -8,10 +8,10 @@ describe Atig::Command::UserInfo do
8
8
 
9
9
  before do
10
10
  @command = init Atig::Command::UserInfo
11
- @status = stub "status"
12
- @user = stub "user"
13
- @user.stub!(:description).and_return('hogehoge')
14
- @user.stub!(:status).and_return(@status)
11
+ @status = double "status"
12
+ @user = double "user"
13
+ @user.stub(:description).and_return('hogehoge')
14
+ @user.stub(:status).and_return(@status)
15
15
  end
16
16
 
17
17
  it "should show the source via DB" do
@@ -8,10 +8,10 @@ describe Atig::Command::Version do
8
8
 
9
9
  before do
10
10
  @command = init Atig::Command::Version
11
- @status = stub "status"
12
- @status.stub!(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
13
- @user = stub "user"
14
- @user.stub!(:status).and_return(@status)
11
+ @status = double "status"
12
+ @status.stub(:source).and_return('<a href="http://echofon.com/" rel="nofollow">Echofon</a>')
13
+ @user = double "user"
14
+ @user.stub(:status).and_return(@status)
15
15
  end
16
16
 
17
17
  it "should provide version command" do
@@ -33,8 +33,8 @@ describe Atig::Command::Version do
33
33
  end
34
34
 
35
35
  it "should show the source of web" do
36
- status = stub "status"
37
- status.stub!(:source).and_return('web')
36
+ status = double "status"
37
+ status.stub(:source).and_return('web')
38
38
  @statuses.
39
39
  should_receive(:find_by_screen_name).
40
40
  with('mzp',:limit => 1).
@@ -49,7 +49,7 @@ describe Atig::Command::Version do
49
49
  end
50
50
 
51
51
  it "should show the source via API" do
52
- @statuses.stub!(:find_by_screen_name).and_return(@status)
52
+ @statuses.stub(:find_by_screen_name).and_return(@status)
53
53
  @statuses.should_receive(:find_by_screen_name).with('mzp',:limit => 1).and_return(nil)
54
54
  @statuses.should_receive(:add).with(:status => @status, :user => @user, :source=>:version)
55
55
  @api.should_receive(:get).with('users/show',:screen_name=>'mzp').and_return(@user)
@@ -16,20 +16,20 @@ describe Atig::Command::Whois do
16
16
 
17
17
  before do
18
18
  @command = init Atig::Command::Whois
19
- @status = stub 'status'
20
- @status.stub!(:created_at).and_return(time(::Time.at(42)))
21
- @user = stub "user"
22
- @user.stub!(:name) .and_return('name')
23
- @user.stub!(:id) .and_return('10')
24
- @user.stub!(:screen_name).and_return('screen_name')
25
- @user.stub!(:description).and_return('blah blah')
26
- @user.stub!(:protected) .and_return(false)
27
- @user.stub!(:location) .and_return('Tokyo, Japan')
28
- @user.stub!(:created_at) .and_return(time(::Time.at(0)))
29
- @user.stub!(:status) .and_return(@status)
19
+ @status = double 'status'
20
+ @status.stub(:created_at).and_return(time(::Time.at(42)))
21
+ @user = double "user"
22
+ @user.stub(:name) .and_return('name')
23
+ @user.stub(:id) .and_return('10')
24
+ @user.stub(:screen_name).and_return('screen_name')
25
+ @user.stub(:description).and_return('blah blah')
26
+ @user.stub(:protected) .and_return(false)
27
+ @user.stub(:location) .and_return('Tokyo, Japan')
28
+ @user.stub(:created_at) .and_return(time(::Time.at(0)))
29
+ @user.stub(:status) .and_return(@status)
30
30
 
31
- ::Time.stub!(:now).and_return(::Time.at(50))
32
- @followings.stub!(:find_by_screen_name).with('mzp').and_return(@user)
31
+ ::Time.stub(:now).and_return(::Time.at(50))
32
+ @followings.stub(:find_by_screen_name).with('mzp').and_return(@user)
33
33
  end
34
34
 
35
35
  it "should proide whois command" do
@@ -56,7 +56,7 @@ describe Atig::Command::Whois do
56
56
  end
57
57
 
58
58
  it "should append /protect if the user is protected" do
59
- @user.stub!(:protected).and_return(true)
59
+ @user.stub(:protected).and_return(true)
60
60
  commands = []
61
61
  @gateway.should_receive(:post){|_,command,_,_,*params|
62
62
  commands << command
@@ -64,13 +64,13 @@ end
64
64
 
65
65
  module CommandHelper
66
66
  def init(klass)
67
- @log = mock 'log'
67
+ @log = double 'log'
68
68
  @opts = Atig::Option.new({})
69
69
  context = OpenStruct.new :log=>@log, :opts=>@opts
70
70
 
71
- @channel = mock 'channel'
71
+ @channel = double 'channel'
72
72
  @gateway = FakeGateway.new @channel
73
- @api = mock 'api'
73
+ @api = double 'api'
74
74
  @statuses = FakeDbEntry.new 'status DB'
75
75
  @followings = FakeDbEntry.new 'followings DB'
76
76
  @lists = {
@@ -88,7 +88,7 @@ module CommandHelper
88
88
  end
89
89
 
90
90
  def stub_status(key, hash)
91
- @statuses.stub!(key).and_return{|arg,*_|
91
+ @statuses.stub(key).and_return{|arg,*_|
92
92
  hash.fetch(arg, hash[:default])
93
93
  }
94
94
  end
@@ -6,8 +6,8 @@ require 'ostruct'
6
6
 
7
7
  describe Atig::Db::SizedUniqArray do
8
8
  def item(id)
9
- item = stub "Item-#{id}"
10
- item.stub!(:id).and_return id
9
+ item = double "Item-#{id}"
10
+ item.stub(:id).and_return id
11
11
  item
12
12
  end
13
13
 
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  describe Atig::IFilter::ExpandUrl, "when disable whole url" do
12
12
  def filtered(text)
13
- ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(:log=>mock('log'),:opts=>OpenStruct.new)
13
+ ifilter = Atig::IFilter::ExpandUrl.new OpenStruct.new(:log=>double('log'),:opts=>OpenStruct.new)
14
14
  ifilter.call status(text)
15
15
  end
16
16
 
@@ -26,7 +26,7 @@ end
26
26
  describe Atig::IFilter::ExpandUrl, "when enable whole url" do
27
27
  def filtered(text)
28
28
  context = OpenStruct.new(
29
- :log => mock('log'),
29
+ :log => double('log'),
30
30
  :opts => OpenStruct.new(:untiny_whole_urls=>true))
31
31
  ifilter = Atig::IFilter::ExpandUrl.new(context)
32
32
  ifilter.call status(text)
@@ -42,3 +42,24 @@ describe Atig::IFilter::ExpandUrl, "when enable whole url" do
42
42
  end
43
43
  end
44
44
 
45
+ describe Atig::IFilter::ExpandUrl, "when has urls entities" do
46
+ def filtered(text, opts)
47
+ context = OpenStruct.new(
48
+ :log => double('log'),
49
+ :opts => OpenStruct.new)
50
+ ifilter = Atig::IFilter::ExpandUrl.new(context)
51
+ ifilter.call status(text, opts)
52
+ end
53
+
54
+ it "should expand t.co" do
55
+ opts = {
56
+ "entities" => {
57
+ "urls" => [{
58
+ "url" => "http://t.co/1Vyoux4kB8",
59
+ "expanded_url" => "http://example.com/"
60
+ }]
61
+ }
62
+ }
63
+ filtered("http://t.co/1Vyoux4kB8", opts).should be_text("http://example.com/")
64
+ end
65
+ end
@@ -6,7 +6,7 @@ require 'atig/twitter_struct'
6
6
 
7
7
  describe Atig::IFilter::Sid, "when disable tid" do
8
8
  def filtered(text)
9
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>mock('log'),
9
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
10
10
  :opts=>OpenStruct.new))
11
11
  ifilter.call status(text,'sid'=>1)
12
12
  end
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  describe Atig::IFilter::Sid, "when enable tid" do
20
20
  def filtered(text)
21
- ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>mock('log'),
21
+ ifilter = Atig::IFilter::Sid.new(OpenStruct.new(:log=>double('log'),
22
22
  :opts=>OpenStruct.new(:sid=>true)))
23
23
  ifilter.call status(text,'sid'=>1)
24
24
  end
@@ -6,7 +6,7 @@ require 'atig/twitter_struct'
6
6
 
7
7
  describe Atig::IFilter::Tid, "when disable tid" do
8
8
  def filtered(text)
9
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>mock('log'),
9
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
10
10
  :opts=>OpenStruct.new))
11
11
  ifilter.call status(text,'tid'=>1)
12
12
  end
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  describe Atig::IFilter::Tid, "when enable tid" do
20
20
  def filtered(text)
21
- ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>mock('log'),
21
+ ifilter = Atig::IFilter::Tid.new(OpenStruct.new(:log=>double('log'),
22
22
  :opts=>OpenStruct.new(:tid=>true)))
23
23
  ifilter.call status(text,'tid'=>1)
24
24
  end
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  describe Atig::OFilter::EscapeUrl do
11
11
  before do
12
- @logger = mock('Logger')
12
+ @logger = double('Logger')
13
13
  @logger.should_receive(:info).at_most(:once)
14
14
  @logger.should_receive(:error).at_most(:once)
15
15
  @logger.should_receive(:debug).at_most(:once)
@@ -32,7 +32,7 @@ end
32
32
  if defined? ::Punycode then
33
33
  describe Atig::OFilter::EscapeUrl,"when punycode is enabled" do
34
34
  before do
35
- @logger = mock('Logger')
35
+ @logger = double('Logger')
36
36
  @logger.should_receive(:info).at_most(:once)
37
37
  @logger.should_receive(:error).at_most(:once)
38
38
  @logger.should_receive(:debug).at_most(:once)
@@ -6,9 +6,9 @@ require 'ostruct'
6
6
 
7
7
  describe Atig::OFilter::ShortUrl,"when no-login bitly" do
8
8
  before do
9
- logger = mock('Logger')
10
- bitly = mock("Bitly")
11
- bitly.stub!(:shorten).and_return{|s|
9
+ logger = double('Logger')
10
+ bitly = double("Bitly")
11
+ bitly.stub(:shorten).and_return{|s|
12
12
  "[#{s}]"
13
13
  }
14
14
  Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
@@ -24,9 +24,9 @@ end
24
24
 
25
25
  describe Atig::OFilter::ShortUrl,"when no-login bitly with size" do
26
26
  before do
27
- logger = mock('Logger')
28
- bitly = mock("Bitly")
29
- bitly.stub!(:shorten).and_return{|s|
27
+ logger = double('Logger')
28
+ bitly = double("Bitly")
29
+ bitly.stub(:shorten).and_return{|s|
30
30
  "[#{s}]"
31
31
  }
32
32
  Atig::Bitly.should_receive(:no_login).with(logger).and_return(bitly)
@@ -42,9 +42,9 @@ end
42
42
 
43
43
  describe Atig::OFilter::ShortUrl,"when login bitly" do
44
44
  before do
45
- logger = mock('Logger')
46
- bitly = mock("Bitly")
47
- bitly.stub!(:shorten).and_return{|s|
45
+ logger = double('Logger')
46
+ bitly = double("Bitly")
47
+ bitly.stub(:shorten).and_return{|s|
48
48
  "[#{s}]"
49
49
  }
50
50
  Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
@@ -60,9 +60,9 @@ end
60
60
 
61
61
  describe Atig::OFilter::ShortUrl,"when login bitly with size" do
62
62
  before do
63
- logger = mock('Logger')
64
- bitly = mock("Bitly")
65
- bitly.stub!(:shorten).and_return{|s|
63
+ logger = double('Logger')
64
+ bitly = double("Bitly")
65
+ bitly.stub(:shorten).and_return{|s|
66
66
  "[#{s}]"
67
67
  }
68
68
  Atig::Bitly.should_receive(:login).with(logger,"username","api_key").and_return(bitly)
@@ -78,9 +78,9 @@ end
78
78
 
79
79
  describe Atig::OFilter::ShortUrl,"when unu bitly" do
80
80
  before do
81
- logger = mock('Logger')
82
- unu = mock("Unu")
83
- unu.stub!(:shorten).and_return{|s|
81
+ logger = double('Logger')
82
+ unu = double("Unu")
83
+ unu.stub(:shorten).and_return{|s|
84
84
  "[#{s}]"
85
85
  }
86
86
  Atig::Unu.should_receive(:new).with(logger).and_return(unu)
@@ -96,9 +96,9 @@ end
96
96
 
97
97
  describe Atig::OFilter::ShortUrl,"when no-login unu with size" do
98
98
  before do
99
- logger = mock('Logger')
100
- unu = mock("Unu")
101
- unu.stub!(:shorten).and_return{|s|
99
+ logger = double('Logger')
100
+ unu = double("Unu")
101
+ unu.stub(:shorten).and_return{|s|
102
102
  "[#{s}]"
103
103
  }
104
104
  Atig::Unu.should_receive(:new).with(logger).and_return(unu)
@@ -114,7 +114,7 @@ end
114
114
 
115
115
  describe Atig::OFilter::ShortUrl,"when nop" do
116
116
  before do
117
- logger = mock('Logger')
117
+ logger = double('Logger')
118
118
 
119
119
  @ofilter = Atig::OFilter::ShortUrl.new(OpenStruct.new(:log=>logger, :opts=>OpenStruct.new()))
120
120
  end
@@ -19,17 +19,17 @@ def status(text, opt = {})
19
19
  end
20
20
 
21
21
  def user(id, name)
22
- user = stub("User-#{name}")
23
- user.stub!(:id).and_return(id)
24
- user.stub!(:screen_name).and_return(name)
22
+ user = double("User-#{name}")
23
+ user.stub(:id).and_return(id)
24
+ user.stub(:screen_name).and_return(name)
25
25
  user
26
26
  end
27
27
 
28
28
  def entry(user, status, name = 'entry', id = 0)
29
- entry = stub name
30
- entry.stub!('id').and_return(id)
31
- entry.stub!('user').and_return(user)
32
- entry.stub!('status').and_return(status)
29
+ entry = double name
30
+ entry.stub('id').and_return(id)
31
+ entry.stub('user').and_return(user)
32
+ entry.stub('status').and_return(status)
33
33
  entry
34
34
  end
35
35
 
@@ -13,8 +13,8 @@ describe Atig::UpdateChecker,'when use git version' do
13
13
  end
14
14
 
15
15
  before do
16
- Atig::UpdateChecker.stub!(:git?).and_return(true)
17
- Atig::UpdateChecker.stub!(:commits).
16
+ Atig::UpdateChecker.stub(:git?).and_return(true)
17
+ Atig::UpdateChecker.stub(:commits).
18
18
  and_return [
19
19
  commit('a', 'foo'),
20
20
  commit('b', 'bar'),
@@ -25,29 +25,29 @@ describe Atig::UpdateChecker,'when use git version' do
25
25
  end
26
26
 
27
27
  it "should not do anything when use HEAD version" do
28
- Atig::UpdateChecker.stub!(:local_repos?).and_return true
29
- Atig::UpdateChecker.stub!(:server_version).and_return rev('a')
28
+ Atig::UpdateChecker.stub(:local_repos?).and_return true
29
+ Atig::UpdateChecker.stub(:server_version).and_return rev('a')
30
30
 
31
31
  Atig::UpdateChecker.latest.should == []
32
32
  end
33
33
 
34
34
  it "should notify when not use HEAD version" do
35
- Atig::UpdateChecker.stub!(:local_repos?).and_return false
36
- Atig::UpdateChecker.stub!(:server_version).and_return rev('b')
35
+ Atig::UpdateChecker.stub(:local_repos?).and_return false
36
+ Atig::UpdateChecker.stub(:server_version).and_return rev('b')
37
37
 
38
38
  Atig::UpdateChecker.latest.should == [ 'foo' ]
39
39
  end
40
40
 
41
41
  it "should notify many changes" do
42
- Atig::UpdateChecker.stub!(:local_repos?).and_return false
43
- Atig::UpdateChecker.stub!(:server_version).and_return rev('d')
42
+ Atig::UpdateChecker.stub(:local_repos?).and_return false
43
+ Atig::UpdateChecker.stub(:server_version).and_return rev('d')
44
44
 
45
45
  Atig::UpdateChecker.latest.should == [ 'foo', 'bar', 'baz' ]
46
46
  end
47
47
 
48
48
  it "should notify all changes" do
49
- Atig::UpdateChecker.stub!(:local_repos?).and_return false
50
- Atig::UpdateChecker.stub!(:server_version).and_return rev('z')
49
+ Atig::UpdateChecker.stub(:local_repos?).and_return false
50
+ Atig::UpdateChecker.stub(:server_version).and_return rev('z')
51
51
 
52
52
  Atig::UpdateChecker.latest.should == [ 'foo', 'bar', 'baz', 'xyzzy', 'fuga' ]
53
53
  end
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.3.2
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: 1.3.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-irc
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: oauth
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: rake
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: json
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: bundler
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: :development
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: rspec
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: :development
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
112
112
  name: coveralls
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Atig.rb is Twitter Irc Gateway.
@@ -130,9 +130,9 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - .gitignore
134
- - .rspec
135
- - .travis.yml
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".travis.yml"
136
136
  - Gemfile
137
137
  - Gemfile.lock
138
138
  - README.mkdn
@@ -308,17 +308,17 @@ require_paths:
308
308
  - lib
309
309
  required_ruby_version: !ruby/object:Gem::Requirement
310
310
  requirements:
311
- - - '>='
311
+ - - ">="
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0'
314
314
  required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  requirements:
316
- - - '>='
316
+ - - ">="
317
317
  - !ruby/object:Gem::Version
318
318
  version: '0'
319
319
  requirements: []
320
320
  rubyforge_project:
321
- rubygems_version: 2.0.6
321
+ rubygems_version: 2.1.8
322
322
  signing_key:
323
323
  specification_version: 4
324
324
  summary: Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.
@@ -366,3 +366,4 @@ test_files:
366
366
  - spec/sized_hash_spec.rb
367
367
  - spec/spec_helper.rb
368
368
  - spec/update_checker_spec.rb
369
+ has_rdoc: