automatic 13.5.0 → 13.6.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.
- data/Gemfile +11 -5
- data/README.md +4 -6
- data/VERSION +1 -1
- data/automatic.gemspec +61 -18
- data/doc/ChangeLog +25 -0
- data/doc/PLUGINS +202 -12
- data/doc/PLUGINS.ja +221 -30
- data/doc/README +1 -1
- data/doc/README.ja +1 -1
- data/lib/automatic.rb +3 -3
- data/lib/automatic/feed_parser.rb +2 -2
- data/lib/automatic/log.rb +12 -2
- data/lib/automatic/pipeline.rb +1 -1
- data/lib/automatic/recipe.rb +5 -2
- data/plugins/custom_feed/svn_log.rb +3 -3
- data/plugins/filter/absolute_uri.rb +8 -4
- data/plugins/filter/accept.rb +61 -0
- data/plugins/filter/full_feed.rb +4 -5
- data/plugins/filter/github_feed.rb +36 -0
- data/plugins/filter/ignore.rb +1 -1
- data/plugins/filter/image.rb +1 -1
- data/plugins/filter/image_source.rb +34 -10
- data/plugins/filter/one.rb +1 -1
- data/plugins/filter/rand.rb +1 -1
- data/plugins/filter/sanitize.rb +50 -0
- data/plugins/filter/sort.rb +1 -1
- data/plugins/filter/tumblr_resize.rb +1 -1
- data/plugins/publish/console.rb +3 -3
- data/plugins/publish/console_link.rb +30 -0
- data/plugins/publish/eject.rb +42 -0
- data/plugins/publish/fluentd.rb +42 -0
- data/plugins/publish/google_calendar.rb +3 -3
- data/plugins/publish/hatena_bookmark.rb +1 -1
- data/plugins/publish/hipchat.rb +45 -0
- data/plugins/publish/instapaper.rb +2 -1
- data/plugins/publish/memcached.rb +44 -0
- data/plugins/publish/pocket.rb +1 -1
- data/plugins/publish/twitter.rb +1 -1
- data/plugins/store/database.rb +3 -3
- data/plugins/store/full_text.rb +2 -2
- data/plugins/store/permalink.rb +1 -1
- data/plugins/store/target_link.rb +3 -2
- data/plugins/subscription/chan_toru.rb +56 -0
- data/plugins/subscription/feed.rb +1 -1
- data/plugins/subscription/g_guide.rb +48 -0
- data/plugins/subscription/google_reader_star.rb +3 -3
- data/plugins/subscription/link.rb +2 -2
- data/plugins/subscription/pocket.rb +49 -0
- data/plugins/subscription/text.rb +3 -12
- data/plugins/subscription/tumblr.rb +7 -1
- data/plugins/subscription/twitter.rb +1 -1
- data/plugins/subscription/twitter_search.rb +50 -0
- data/plugins/subscription/weather.rb +7 -41
- data/script/build +3 -0
- data/spec/fixtures/sampleRecipe.yml +1 -1
- data/spec/lib/automatic/log_spec.rb +31 -0
- data/spec/lib/automatic/pipeline_spec.rb +1 -1
- data/spec/lib/automatic/recipe_spec.rb +1 -1
- data/spec/lib/automatic_spec.rb +3 -3
- data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
- data/spec/plugins/filter/absolute_uri_spec.rb +1 -1
- data/spec/plugins/filter/accept_spec.rb +331 -0
- data/spec/plugins/filter/full_feed_spec.rb +4 -6
- data/spec/plugins/filter/github_feed_spec.rb +54 -0
- data/spec/plugins/filter/ignore_spec.rb +1 -1
- data/spec/plugins/filter/image_source_spec.rb +17 -3
- data/spec/plugins/filter/image_spec.rb +1 -1
- data/spec/plugins/filter/one_spec.rb +1 -1
- data/spec/plugins/filter/rand_spec.rb +1 -1
- data/spec/plugins/filter/sanitize_spec.rb +153 -0
- data/spec/plugins/filter/sort_spec.rb +1 -1
- data/spec/plugins/filter/tumblr_resize_spec.rb +1 -1
- data/spec/plugins/notify/ikachan_spec.rb +1 -1
- data/spec/plugins/publish/console_spec.rb +1 -1
- data/spec/plugins/publish/eject_spec.rb +40 -0
- data/spec/plugins/publish/fluentd_spec.rb +39 -0
- data/spec/plugins/publish/google_calendar_spec.rb +1 -1
- data/spec/plugins/publish/hatena_bookmark_spec.rb +1 -1
- data/spec/plugins/publish/hipchat_spec.rb +69 -0
- data/spec/plugins/publish/instapaper_spec.rb +42 -28
- data/spec/plugins/publish/memcached_spec.rb +63 -0
- data/spec/plugins/publish/pocket_spec.rb +33 -33
- data/spec/plugins/publish/twitter_spec.rb +57 -19
- data/spec/plugins/store/full_text_spec.rb +6 -1
- data/spec/plugins/store/permalink_spec.rb +18 -19
- data/spec/plugins/store/target_link_spec.rb +1 -1
- data/spec/plugins/subscription/chan_toru_spec.rb +56 -0
- data/spec/plugins/subscription/feed_spec.rb +1 -1
- data/spec/plugins/subscription/g_guide_spec.rb +76 -0
- data/spec/plugins/subscription/google_reader_star_spec.rb +1 -1
- data/spec/plugins/subscription/link_spec.rb +1 -1
- data/spec/plugins/subscription/pocket_spec.rb +57 -0
- data/spec/plugins/subscription/text_spec.rb +1 -14
- data/spec/plugins/subscription/tumblr_spec.rb +3 -2
- data/spec/plugins/subscription/twitter_search_spec.rb +57 -0
- data/spec/plugins/subscription/twitter_spec.rb +3 -2
- data/spec/plugins/subscription/weather_spec.rb +2 -15
- data/spec/spec_helper.rb +1 -0
- data/test/integration/test_chan_toru.yml +19 -0
- data/test/integration/test_fluentd.yml +20 -0
- data/test/integration/test_pocket.yml +21 -0
- data/test/integration/test_sanitize.yml +22 -0
- data/test/integration/test_twitter_search.yml +21 -0
- metadata +145 -24
- data/plugins/publish/mail.rb +0 -64
- data/plugins/publish/smtp.rb +0 -48
- data/spec/plugins/publish/mail_spec.rb +0 -53
- data/spec/plugins/publish/smtp_spec.rb +0 -49
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Feb 22, 2012
|
|
5
5
|
# Updated:: Mar 7, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Publish::Hipchat
|
|
3
|
+
# Author:: Kohei Hasegawa <http://github.com/banyan>
|
|
4
|
+
# Created:: Jun 5, 2013
|
|
5
|
+
# Updated:: Jun 5, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
10
|
+
require 'publish/hipchat'
|
|
11
|
+
|
|
12
|
+
describe Automatic::Plugin::PublishHipchat do
|
|
13
|
+
let(:config) {
|
|
14
|
+
{
|
|
15
|
+
'api_token' => "bogus_api_token",
|
|
16
|
+
'room_id' => 'bogus_room',
|
|
17
|
+
'username' => 'bogus_bot',
|
|
18
|
+
'interval' => 1,
|
|
19
|
+
'retry' => 1
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let(:pipeline) {
|
|
24
|
+
AutomaticSpec.generate_pipeline {
|
|
25
|
+
feed { item("http://github.com", 'title', 'description') }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
context 'return feed' do
|
|
30
|
+
subject {
|
|
31
|
+
described_class.new(config, pipeline)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
context 'when successfully' do
|
|
35
|
+
it "should passed proper argument to HipChat::Client" do
|
|
36
|
+
client = mock('client').as_null_object
|
|
37
|
+
HipChat::Client.should_receive(:new).with("bogus_api_token").and_return(client)
|
|
38
|
+
subject.run
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should post the link in the feed" do
|
|
42
|
+
client = mock("client")
|
|
43
|
+
client.should_receive(:send).with('bogus_bot', 'description', {"color"=>"yellow", "notify"=>false})
|
|
44
|
+
subject.instance_variable_set(:@client, client)
|
|
45
|
+
subject.run.should have(1).feed
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'when raise an error during post' do
|
|
50
|
+
it do
|
|
51
|
+
client = mock("client")
|
|
52
|
+
client.stub(:send).and_raise
|
|
53
|
+
subject.instance_variable_set(:@client, client)
|
|
54
|
+
Automatic::Log.should_receive(:puts).twice
|
|
55
|
+
subject.run.should have(1).feed
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'when feed is empty' do
|
|
61
|
+
subject {
|
|
62
|
+
described_class.new(config)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
it "should not post" do
|
|
66
|
+
subject.run.should have(0).feed
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# 774 <http://id774.net>
|
|
5
5
|
# Created:: Feb 9, 2013
|
|
6
6
|
# Updated:: Mar 22, 2013
|
|
7
|
-
# Copyright::
|
|
7
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
9
|
|
|
10
10
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -12,24 +12,39 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
|
12
12
|
require 'publish/instapaper'
|
|
13
13
|
|
|
14
14
|
describe Automatic::Plugin::PublishInstapaper do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
}
|
|
15
|
+
context 'when feed' do
|
|
16
|
+
subject {
|
|
17
|
+
Automatic::Plugin::PublishInstapaper.new(
|
|
18
|
+
{ 'email' => "email@example.com",
|
|
19
|
+
'password' => "pswd",
|
|
20
|
+
'interval' => 5,
|
|
21
|
+
'retry' => 5
|
|
22
|
+
},
|
|
23
|
+
AutomaticSpec.generate_pipeline {
|
|
24
|
+
feed { item "http://github.com" }
|
|
25
|
+
})}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
it "should post the link in the feed" do
|
|
28
|
+
instapaper = mock("instapaper")
|
|
29
|
+
instapaper.should_receive(:add).with("http://github.com", nil, '')
|
|
30
|
+
subject.instance_variable_set(:@instapaper, instapaper)
|
|
31
|
+
subject.run.should have(1).feed
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'when feed is empty' do
|
|
36
|
+
subject {
|
|
37
|
+
Automatic::Plugin::PublishInstapaper.new(
|
|
38
|
+
{ 'email' => "email@example.com",
|
|
39
|
+
'password' => "pswd",
|
|
40
|
+
'interval' => 1,
|
|
41
|
+
'retry' => 1
|
|
42
|
+
},
|
|
43
|
+
AutomaticSpec.generate_pipeline {
|
|
44
|
+
feed { item "http://github.com" }
|
|
45
|
+
})}
|
|
46
|
+
|
|
47
|
+
its (:run) { subject.run.should have(1).feed }
|
|
33
48
|
end
|
|
34
49
|
end
|
|
35
50
|
|
|
@@ -41,9 +56,7 @@ describe Automatic::Plugin::Instapaper do
|
|
|
41
56
|
'password' => "pswd",
|
|
42
57
|
'interval' => 5,
|
|
43
58
|
'retry' => 5
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
}
|
|
59
|
+
})}
|
|
47
60
|
|
|
48
61
|
url = "http://www.google.com"
|
|
49
62
|
title = "automatic test"
|
|
@@ -52,17 +65,18 @@ describe Automatic::Plugin::Instapaper do
|
|
|
52
65
|
specify {
|
|
53
66
|
res = stub("res")
|
|
54
67
|
res.should_receive(:code).and_return("201")
|
|
55
|
-
|
|
56
68
|
subject.should_receive(:request).and_return(res)
|
|
57
69
|
subject.add(url, title, description)
|
|
58
70
|
}
|
|
59
71
|
|
|
60
|
-
specify {
|
|
61
|
-
res = mock("res")
|
|
62
|
-
res.should_receive(:code).twice.and_return("403")
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
it 'raise error' do
|
|
74
|
+
lambda{
|
|
75
|
+
res = mock("res")
|
|
76
|
+
res.should_receive(:code).twice.and_return("403")
|
|
77
|
+
subject.should_receive(:request).and_return(res)
|
|
78
|
+
subject.add(url, title, description)
|
|
79
|
+
}.should raise_error
|
|
80
|
+
end
|
|
67
81
|
end
|
|
68
82
|
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Publish::Memcached
|
|
3
|
+
# Author:: 774 <http://id774.net>
|
|
4
|
+
# Created:: Jun 25, 2013
|
|
5
|
+
# Updated:: Jun 25, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
10
|
+
|
|
11
|
+
require 'publish/memcached'
|
|
12
|
+
|
|
13
|
+
describe Automatic::Plugin::PublishMemcached do
|
|
14
|
+
context 'when feed' do
|
|
15
|
+
describe 'should put the feeds to memcached' do
|
|
16
|
+
subject {
|
|
17
|
+
Automatic::Plugin::PublishMemcached.new(
|
|
18
|
+
{
|
|
19
|
+
'host' => "localhost",
|
|
20
|
+
'port' => "11211",
|
|
21
|
+
'key' => "rspec"
|
|
22
|
+
},
|
|
23
|
+
AutomaticSpec.generate_pipeline{
|
|
24
|
+
feed {
|
|
25
|
+
item "http://blog.id774.net/post/2012/01/30/18/", "ブログをはじめた",
|
|
26
|
+
"なぜいまブログなのか
|
|
27
|
+
|
|
28
|
+
いままでインターネット全体に公開するブログとして、はてなダイアリーを利用してきた。それ以外のある程度まとまった文章は Facebook に書いてきた。それはそれで良かったのだけど、いろいろと思うところもあり、このたび新しくブログをはじめることにした。
|
|
29
|
+
|
|
30
|
+
はてなダイアリーはシンタックスハイライト (プログラミング言語の色付けのこと) が充実していたので利用していた。しかし最近登場した CoffeeScript や Haml のような新しい言語には対応していない。新しくはてなブログというのも始まったが、ダイアリー以上にシンタックスハイライトが使えないようだ。
|
|
31
|
+
|
|
32
|
+
そこで、今後インターネット上で文章を書いていくにあたりどうするか考えた。"
|
|
33
|
+
item "http://blog.id774.net/post/2012/01/30/38/", "Twitter Viewer つくった",
|
|
34
|
+
"Twitter を閲覧するための Web アプリをつくった。
|
|
35
|
+
|
|
36
|
+
Twitter Viewer
|
|
37
|
+
|
|
38
|
+
やっていることは至ってシンプルで RDB にためた発言をブラウザに表示させているだけである。内容は Rails の Scaffold ほとんどそのまま。 CSS はサイトローカルな Bootstrap を読み込んでいる。簡単なアプリだが、ブラウザにいちど表示させてしまえば電波が入らない地下鉄などでもゆっくり読めるので、モバイル環境で大量の発言をざっとチェックしたいときなどに使えて意外と実用的である。発言のクロールは別途おこなう必要がある。この例では Termtter の ActiveRecord プラグインを利用している。"
|
|
39
|
+
item "http://blog.id774.net/post/2012/01/30/48/", "PC-98 とエミュレータ",
|
|
40
|
+
"Facebook には少し書いたのだが、今年に入ってから 90 年代に使っていた PC-98 と呼ばれる PC を発掘したので起動した。もう 15 年前後も経っているというのに正常に利用することができて感動してしまった。あの ThinkPad ですら数年ほど電源を入れないで放置しておくと起動しないことが多いのに、さすが発売当初 40 〜 50 万円程もした高級マシンである。そんなわけで今回は PC-98 の話。
|
|
41
|
+
|
|
42
|
+
PC-98 のソフトを使う
|
|
43
|
+
当時のソフトウェアを利用するためには以下のものが必要だ。
|
|
44
|
+
1. PC-98 エミュレータ
|
|
45
|
+
2. MS-DOS (オペレーティングシステム)
|
|
46
|
+
3. 動作させる対象のソフトウェア"
|
|
47
|
+
}
|
|
48
|
+
feed {
|
|
49
|
+
item "http://d.hatena.ne.jp/Naruhodius/20120130/1327862031", "ブログを移転しました",
|
|
50
|
+
"いままでこの「はてなダイアリー」にブログを書いてきましたが、以下のアドレスにブログを移転することにしました。このブログはもう更新されません。以下の新しいブログを購読してください。"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
its (:run) {
|
|
57
|
+
fluentd = mock("memcached")
|
|
58
|
+
subject.run.should have(2).feed
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# Created:: May 15, 2013
|
|
5
5
|
# Updated:: May 15, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -11,41 +11,41 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
|
11
11
|
require 'publish/pocket'
|
|
12
12
|
|
|
13
13
|
describe Automatic::Plugin::PublishPocket do
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
}
|
|
14
|
+
context 'return feed' do
|
|
15
|
+
subject {
|
|
16
|
+
Automatic::Plugin::PublishPocket.new(
|
|
17
|
+
{ 'consumer_key' => "hugehuge",
|
|
18
|
+
'access_token' => "hogehoge",
|
|
19
|
+
'interval' => 1,
|
|
20
|
+
'retry' => 1
|
|
21
|
+
},
|
|
22
|
+
AutomaticSpec.generate_pipeline {
|
|
23
|
+
feed { item "http://github.com" }
|
|
24
|
+
})}
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
it "should post the link in the feed" do
|
|
27
|
+
client = mock("client")
|
|
28
|
+
client.should_receive(:add).with(:url => 'http://github.com')
|
|
29
|
+
subject.instance_variable_set(:@client, client)
|
|
30
|
+
subject.run.should have(1).feed
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should not post" do
|
|
34
|
+
subject.run.should have(1).feed
|
|
35
|
+
end
|
|
32
36
|
end
|
|
33
|
-
end
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
AutomaticSpec.generate_pipeline{
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
}
|
|
38
|
+
context 'not return feed' do
|
|
39
|
+
subject {
|
|
40
|
+
Automatic::Plugin::PublishPocket.new(
|
|
41
|
+
{ 'consumer_key' => "hugehuge",
|
|
42
|
+
'access_token' => "hogehoge",
|
|
43
|
+
'interval' => 1,
|
|
44
|
+
'retry' => 1
|
|
45
|
+
})}
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
it "should un post" do
|
|
48
|
+
subject.run.should have(0).feed
|
|
49
|
+
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# Created:: May 5, 2013
|
|
5
5
|
# Updated:: May 5, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -11,25 +11,63 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
|
11
11
|
require 'publish/twitter'
|
|
12
12
|
|
|
13
13
|
describe Automatic::Plugin::PublishTwitter do
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'interval' => 5,
|
|
21
|
-
'retry' => 5
|
|
22
|
-
},
|
|
23
|
-
AutomaticSpec.generate_pipeline{
|
|
14
|
+
context 'when feed' do
|
|
15
|
+
describe 'should post the link tweet' do
|
|
16
|
+
subject {
|
|
17
|
+
Automatic::Plugin::PublishTwitter.new(
|
|
18
|
+
{},
|
|
19
|
+
AutomaticSpec.generate_pipeline{
|
|
24
20
|
feed { item "http://github.com" }
|
|
21
|
+
})}
|
|
22
|
+
|
|
23
|
+
its (:run) {
|
|
24
|
+
twitter = mock("twitter")
|
|
25
|
+
twitter.should_receive(:update).with(" http://github.com")
|
|
26
|
+
subject.instance_variable_set(:@twitter, twitter)
|
|
27
|
+
subject.run.should have(1).feed
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe 'should post the tweet_tmp' do
|
|
32
|
+
subject {
|
|
33
|
+
Automatic::Plugin::PublishTwitter.new(
|
|
34
|
+
{ 'tweet_tmp' => 'publish-twitter'},
|
|
35
|
+
AutomaticSpec.generate_pipeline{
|
|
36
|
+
feed { item "http://github.com" }
|
|
37
|
+
})}
|
|
38
|
+
|
|
39
|
+
its (:run) {
|
|
40
|
+
twitter = mock("twitter")
|
|
41
|
+
twitter.should_receive(:update).with("publish-twitter")
|
|
42
|
+
subject.instance_variable_set(:@twitter, twitter)
|
|
43
|
+
subject.run.should have(1).feed
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe 'interval & retry was used error' do
|
|
48
|
+
subject {
|
|
49
|
+
Automatic::Plugin::PublishTwitter.new(
|
|
50
|
+
{ 'interval' => 1, 'retry' => 1 },
|
|
51
|
+
AutomaticSpec.generate_pipeline{
|
|
52
|
+
feed { item "http://github.com" }
|
|
53
|
+
})}
|
|
54
|
+
|
|
55
|
+
its (:run) {
|
|
56
|
+
subject.run.should have(1).feed
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'when feed is empty' do
|
|
62
|
+
describe 'should not post' do
|
|
63
|
+
subject {
|
|
64
|
+
Automatic::Plugin::PublishTwitter.new(
|
|
65
|
+
{},
|
|
66
|
+
)}
|
|
67
|
+
|
|
68
|
+
its (:run) {
|
|
69
|
+
subject.run.should have(0).feed
|
|
25
70
|
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
it "should post the link tweet" do
|
|
30
|
-
twitter = mock("twitter")
|
|
31
|
-
twitter.should_receive(:update).with(" http://github.com")
|
|
32
|
-
subject.instance_variable_set(:@twitter, twitter)
|
|
33
|
-
subject.run.should have(1).feed
|
|
71
|
+
end
|
|
34
72
|
end
|
|
35
73
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Name:: Automatic::Plugin::Store::FullText
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Updated:: Jun 14, 2012
|
|
5
|
-
# Copyright::
|
|
5
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
6
6
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
7
7
|
|
|
8
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -15,7 +15,12 @@ describe Automatic::Plugin::StoreFullText do
|
|
|
15
15
|
@db_filename = "test_full_text.db"
|
|
16
16
|
db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
|
|
17
17
|
db_path.delete if db_path.exist?
|
|
18
|
+
tmp_out = StringIO.new()
|
|
19
|
+
$stdout = tmp_out
|
|
18
20
|
Automatic::Plugin::StoreFullText.new({"db" => @db_filename}).run
|
|
21
|
+
$stdout = STDOUT
|
|
22
|
+
tmp_out.rewind()
|
|
23
|
+
Automatic::Log.puts("info", tmp_out.read())
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
it "should store 1 record for the new blog entry" do
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Name:: Automatic::Plugin::Store::Permalink
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Updated:: Dec 17, 2012
|
|
5
|
-
# Copyright::
|
|
5
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
6
6
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
7
7
|
|
|
8
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
@@ -10,12 +10,21 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
|
10
10
|
require 'store/permalink'
|
|
11
11
|
require 'pathname'
|
|
12
12
|
|
|
13
|
+
def db_cleate(db_name)
|
|
14
|
+
db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{db_name}"
|
|
15
|
+
db_path.delete if db_path.exist?
|
|
16
|
+
tmp_out = StringIO.new()
|
|
17
|
+
$stdout = tmp_out
|
|
18
|
+
Automatic::Plugin::StorePermalink.new({"db" => db_name}).run
|
|
19
|
+
$stdout = STDOUT
|
|
20
|
+
tmp_out.rewind()
|
|
21
|
+
Automatic::Log.puts("info", tmp_out.read())
|
|
22
|
+
end
|
|
23
|
+
|
|
13
24
|
describe Automatic::Plugin::StorePermalink do
|
|
14
25
|
it "should store 1 record for the new link" do
|
|
15
26
|
@db_filename = "test_permalink.db"
|
|
16
|
-
|
|
17
|
-
db_path.delete if db_path.exist?
|
|
18
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
27
|
+
db_cleate(@db_filename)
|
|
19
28
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
20
29
|
AutomaticSpec.generate_pipeline {
|
|
21
30
|
feed { item "http://github.com" }
|
|
@@ -28,9 +37,7 @@ describe Automatic::Plugin::StorePermalink do
|
|
|
28
37
|
|
|
29
38
|
it "should not store record for the existent link" do
|
|
30
39
|
@db_filename = "test_permalink.db"
|
|
31
|
-
|
|
32
|
-
db_path.delete if db_path.exist?
|
|
33
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
40
|
+
db_cleate(@db_filename)
|
|
34
41
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
35
42
|
AutomaticSpec.generate_pipeline {
|
|
36
43
|
feed { item "http://github.com" }
|
|
@@ -45,9 +52,7 @@ describe Automatic::Plugin::StorePermalink do
|
|
|
45
52
|
|
|
46
53
|
it "should be considered the case of the feed link nil" do
|
|
47
54
|
@db_filename = "test_permalink.db"
|
|
48
|
-
|
|
49
|
-
db_path.delete if db_path.exist?
|
|
50
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
55
|
+
db_cleate(@db_filename)
|
|
51
56
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
52
57
|
AutomaticSpec.generate_pipeline {
|
|
53
58
|
feed {
|
|
@@ -74,9 +79,7 @@ describe Automatic::Plugin::StorePermalink do
|
|
|
74
79
|
|
|
75
80
|
it "should be considered the case of duplicated links" do
|
|
76
81
|
@db_filename = "test_permalink.db"
|
|
77
|
-
|
|
78
|
-
db_path.delete if db_path.exist?
|
|
79
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
82
|
+
db_cleate(@db_filename)
|
|
80
83
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
81
84
|
AutomaticSpec.generate_pipeline {
|
|
82
85
|
feed {
|
|
@@ -103,9 +106,7 @@ describe Automatic::Plugin::StorePermalink do
|
|
|
103
106
|
|
|
104
107
|
it "No feed should be generated when there is same feed." do
|
|
105
108
|
@db_filename = "test_permalink.db"
|
|
106
|
-
|
|
107
|
-
db_path.delete if db_path.exist?
|
|
108
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
109
|
+
db_cleate(@db_filename)
|
|
109
110
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
110
111
|
AutomaticSpec.generate_pipeline {
|
|
111
112
|
feed {
|
|
@@ -155,9 +156,7 @@ describe Automatic::Plugin::StorePermalink do
|
|
|
155
156
|
|
|
156
157
|
it "Only new feed should be generated when there is new feed." do
|
|
157
158
|
@db_filename = "test_permalink.db"
|
|
158
|
-
|
|
159
|
-
db_path.delete if db_path.exist?
|
|
160
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
159
|
+
db_cleate(@db_filename)
|
|
161
160
|
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
162
161
|
AutomaticSpec.generate_pipeline {
|
|
163
162
|
feed {
|