automatic 14.12.2 → 26.08
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.
- checksums.yaml +5 -5
- data/README.md +635 -83
- data/VERSION +1 -1
- data/automatic.gemspec +109 -248
- data/bin/automatic +20 -139
- data/config/feed2console.yml +10 -4
- data/config/feed2markdown.yml +41 -0
- data/doc/AI_TUTORIAL.md +518 -0
- data/doc/BASIC_DESIGN.md +516 -0
- data/doc/COPYING.LESSER +165 -0
- data/doc/DEPLOYMENT.md +824 -0
- data/doc/LICENSE.md +14 -0
- data/doc/PLUGINS.md +1875 -0
- data/doc/PLUGIN_DEVELOPMENT.md +86 -0
- data/doc/POLICY.md +857 -0
- data/doc/QUICKSTART.md +256 -0
- data/doc/RELEASING.md +381 -0
- data/doc/REQUIREMENTS.md +526 -0
- data/doc/VERSIONS +208 -0
- data/lib/automatic/cli.rb +248 -0
- data/lib/automatic/environment.rb +31 -5
- data/lib/automatic/feed_maker.rb +10 -9
- data/lib/automatic/feed_parser.rb +51 -35
- data/lib/automatic/http.rb +107 -0
- data/lib/automatic/log.rb +49 -18
- data/lib/automatic/opml.rb +3 -1
- data/lib/automatic/pipeline.rb +63 -32
- data/lib/automatic/recipe.rb +56 -17
- data/lib/automatic/version.rb +14 -1
- data/lib/automatic.rb +78 -20
- data/plugins/custom_feed/svn_log.rb +73 -32
- data/plugins/custom_feed/web.rb +348 -0
- data/plugins/filter/absolute_uri.rb +43 -27
- data/plugins/filter/accept.rb +38 -45
- data/plugins/filter/claude.rb +217 -0
- data/plugins/filter/clear.rb +12 -8
- data/plugins/filter/description_link.rb +49 -51
- data/plugins/filter/full_feed.rb +158 -52
- data/plugins/filter/gemini.rb +216 -0
- data/plugins/filter/github_feed.rb +38 -26
- data/plugins/filter/ignore.rb +33 -44
- data/plugins/filter/image.rb +36 -25
- data/plugins/filter/image_source.rb +58 -52
- data/plugins/filter/join.rb +107 -0
- data/plugins/filter/one.rb +19 -26
- data/plugins/filter/open_ai.rb +198 -0
- data/plugins/filter/rand.rb +16 -17
- data/plugins/filter/sakura_ai.rb +205 -0
- data/plugins/filter/sanitize.rb +29 -34
- data/plugins/filter/sort.rb +20 -27
- data/plugins/filter/tumblr_resize.rb +31 -23
- data/plugins/notify/ikachan.rb +86 -48
- data/plugins/provide/fluentd.rb +43 -24
- data/plugins/publish/amazon_s3.rb +73 -40
- data/plugins/publish/console.rb +19 -16
- data/plugins/publish/console_link.rb +20 -17
- data/plugins/publish/eject.rb +48 -26
- data/plugins/publish/fluentd.rb +50 -30
- data/plugins/publish/hatena_bookmark.rb +88 -71
- data/plugins/publish/instapaper.rb +69 -59
- data/plugins/publish/markdown.rb +278 -0
- data/plugins/publish/memcached.rb +35 -29
- data/plugins/store/database.rb +50 -48
- data/plugins/store/digest.rb +212 -0
- data/plugins/store/file.rb +99 -68
- data/plugins/store/full_text.rb +32 -25
- data/plugins/store/permalink.rb +18 -22
- data/plugins/subscription/feed.rb +34 -21
- data/plugins/subscription/link.rb +31 -32
- data/plugins/subscription/text.rb +32 -46
- data/plugins/subscription/tumblr.rb +55 -44
- data/plugins/subscription/xml.rb +40 -36
- metadata +108 -321
- data/Gemfile +0 -38
- data/Rakefile +0 -59
- data/doc/ChangeLog +0 -303
- data/doc/PLUGINS +0 -750
- data/doc/PLUGINS.ja +0 -753
- data/doc/README +0 -511
- data/doc/README.ja +0 -519
- data/plugins/filter/google_news.rb +0 -50
- data/plugins/publish/google_calendar.rb +0 -84
- data/plugins/publish/hipchat.rb +0 -46
- data/plugins/publish/pocket.rb +0 -45
- data/plugins/publish/twitter.rb +0 -58
- data/plugins/subscription/chan_toru.rb +0 -57
- data/plugins/subscription/g_guide.rb +0 -57
- data/plugins/subscription/pocket.rb +0 -51
- data/plugins/subscription/twitter.rb +0 -69
- data/plugins/subscription/twitter_search.rb +0 -50
- data/plugins/subscription/weather.rb +0 -33
- data/script/build +0 -84
- data/spec/fixtures/sampleFeeds.tsv +0 -1
- data/spec/fixtures/sampleFeeds2.tsv +0 -2
- data/spec/fixtures/sampleRecipe.yml +0 -24
- data/spec/lib/automatic/log_spec.rb +0 -32
- data/spec/lib/automatic/pipeline_spec.rb +0 -68
- data/spec/lib/automatic/recipe_spec.rb +0 -40
- data/spec/lib/automatic_spec.rb +0 -99
- data/spec/plugins/custom_feed/svn_log_spec.rb +0 -31
- data/spec/plugins/filter/absolute_uri_spec.rb +0 -61
- data/spec/plugins/filter/accept_spec.rb +0 -331
- data/spec/plugins/filter/clear_spec.rb +0 -49
- data/spec/plugins/filter/description_link_spec.rb +0 -138
- data/spec/plugins/filter/full_feed_spec.rb +0 -129
- data/spec/plugins/filter/github_feed_spec.rb +0 -55
- data/spec/plugins/filter/google_news_spec.rb +0 -69
- data/spec/plugins/filter/ignore_spec.rb +0 -328
- data/spec/plugins/filter/image_source_spec.rb +0 -89
- data/spec/plugins/filter/image_spec.rb +0 -65
- data/spec/plugins/filter/one_spec.rb +0 -71
- data/spec/plugins/filter/rand_spec.rb +0 -52
- data/spec/plugins/filter/sanitize_spec.rb +0 -153
- data/spec/plugins/filter/sort_spec.rb +0 -189
- data/spec/plugins/filter/tumblr_resize_spec.rb +0 -109
- data/spec/plugins/notify/ikachan_spec.rb +0 -58
- data/spec/plugins/provide/fluentd_spec.rb +0 -49
- data/spec/plugins/publish/amazon_s3_spec.rb +0 -40
- data/spec/plugins/publish/console_spec.rb +0 -30
- data/spec/plugins/publish/eject_spec.rb +0 -40
- data/spec/plugins/publish/fluentd_spec.rb +0 -40
- data/spec/plugins/publish/google_calendar_spec.rb +0 -83
- data/spec/plugins/publish/hatena_bookmark_spec.rb +0 -134
- data/spec/plugins/publish/hipchat_spec.rb +0 -69
- data/spec/plugins/publish/instapaper_spec.rb +0 -82
- data/spec/plugins/publish/memcached_spec.rb +0 -63
- data/spec/plugins/publish/pocket_spec.rb +0 -51
- data/spec/plugins/publish/twitter_spec.rb +0 -73
- data/spec/plugins/store/file_spec.rb +0 -58
- data/spec/plugins/store/full_text_spec.rb +0 -152
- data/spec/plugins/store/permalink_spec.rb +0 -206
- data/spec/plugins/subscription/chan_toru_spec.rb +0 -56
- data/spec/plugins/subscription/feed_spec.rb +0 -71
- data/spec/plugins/subscription/g_guide_spec.rb +0 -82
- data/spec/plugins/subscription/link_spec.rb +0 -72
- data/spec/plugins/subscription/pocket_spec.rb +0 -57
- data/spec/plugins/subscription/text_spec.rb +0 -84
- data/spec/plugins/subscription/tumblr_spec.rb +0 -74
- data/spec/plugins/subscription/twitter_search_spec.rb +0 -57
- data/spec/plugins/subscription/twitter_spec.rb +0 -73
- data/spec/plugins/subscription/weather_spec.rb +0 -44
- data/spec/plugins/subscription/xml_spec.rb +0 -84
- data/spec/spec_helper.rb +0 -106
- data/spec/user_dir/plugins/store/mock.rb +0 -16
- data/test/fixtures/sampleOPML.xml +0 -11
- data/test/integration/test_absoluteurl.yml +0 -25
- data/test/integration/test_activerecord.yml +0 -24
- data/test/integration/test_add_pocket.yml +0 -26
- data/test/integration/test_chan_toru.yml +0 -21
- data/test/integration/test_descriptionlink.yml +0 -21
- data/test/integration/test_fluentd.yml +0 -22
- data/test/integration/test_fulltext.yml +0 -30
- data/test/integration/test_google_news.yml +0 -21
- data/test/integration/test_googlealert.yml +0 -21
- data/test/integration/test_hatenabookmark.yml +0 -30
- data/test/integration/test_ignore.yml +0 -25
- data/test/integration/test_ignore2.yml +0 -22
- data/test/integration/test_image2local.yml +0 -33
- data/test/integration/test_instapaper.yml +0 -26
- data/test/integration/test_link2local.yml +0 -34
- data/test/integration/test_one.yml +0 -23
- data/test/integration/test_pocket.yml +0 -22
- data/test/integration/test_rand.yml +0 -21
- data/test/integration/test_sanitize.yml +0 -23
- data/test/integration/test_sort.yml +0 -36
- data/test/integration/test_svnlog.yml +0 -15
- data/test/integration/test_text2feed.yml +0 -36
- data/test/integration/test_tumblr2local.yml +0 -43
- data/test/integration/test_twitter_search.yml +0 -22
- data/test/integration/test_weather.yml +0 -19
- data/test/integration/test_xml2fluentd.yml +0 -21
- data/vendor/.gitkeep +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Memcached
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Created:: Jun 25, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 = double("memcached")
|
|
58
|
-
subject.run.should have(2).feed
|
|
59
|
-
}
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Pocket
|
|
3
|
-
# Author:: soramugi <http://soramugi.net>
|
|
4
|
-
# Created:: May 15, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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/pocket'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishPocket do
|
|
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
|
-
})}
|
|
25
|
-
|
|
26
|
-
it "should post the link in the feed" do
|
|
27
|
-
client = double("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
|
|
36
|
-
end
|
|
37
|
-
|
|
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
|
-
})}
|
|
46
|
-
|
|
47
|
-
it "should un post" do
|
|
48
|
-
subject.run.should have(0).feed
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Twitter
|
|
3
|
-
# Author:: soramugi <http://soramugi.net>
|
|
4
|
-
# Created:: May 5, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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/twitter'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishTwitter do
|
|
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{
|
|
20
|
-
feed { item "http://github.com" }
|
|
21
|
-
})}
|
|
22
|
-
|
|
23
|
-
its (:run) {
|
|
24
|
-
twitter = double("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 = double("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
|
|
70
|
-
}
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Store::File
|
|
3
|
-
# Author:: kzgs
|
|
4
|
-
# 774 <http://id774.net>
|
|
5
|
-
# Created:: Mar 4, 2012
|
|
6
|
-
# Updated:: Feb 25, 2014
|
|
7
|
-
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
|
|
8
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
|
-
|
|
10
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
11
|
-
|
|
12
|
-
require 'store/file'
|
|
13
|
-
require 'tmpdir'
|
|
14
|
-
require 'pathname'
|
|
15
|
-
|
|
16
|
-
describe Automatic::Plugin::StoreFile do
|
|
17
|
-
it "should store the target link" do
|
|
18
|
-
Dir.mktmpdir do |dir|
|
|
19
|
-
instance = Automatic::Plugin::StoreFile.new(
|
|
20
|
-
{ "path" => dir },
|
|
21
|
-
AutomaticSpec.generate_pipeline {
|
|
22
|
-
feed { item "http://id774.net/test/store/rss" }
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
instance.run.should have(1).feed
|
|
26
|
-
(Pathname(dir)+"rss").should be_exist
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should error during file download" do
|
|
31
|
-
Dir.mktmpdir do |dir|
|
|
32
|
-
instance = Automatic::Plugin::StoreFile.new(
|
|
33
|
-
{ "path" => dir },
|
|
34
|
-
AutomaticSpec.generate_pipeline {
|
|
35
|
-
feed { item "aaa" }
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
instance.run.should have(0).feed
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "should error and retry during file download" do
|
|
43
|
-
Dir.mktmpdir do |dir|
|
|
44
|
-
instance = Automatic::Plugin::StoreFile.new(
|
|
45
|
-
{
|
|
46
|
-
"path" => dir,
|
|
47
|
-
'retry' => 1,
|
|
48
|
-
'interval' => 2
|
|
49
|
-
},
|
|
50
|
-
AutomaticSpec.generate_pipeline {
|
|
51
|
-
feed { item "aaa" }
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
instance.run.should have(0).feed
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
end
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Store::FullText
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Updated:: Oct 16, 2014
|
|
5
|
-
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
|
|
6
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
7
|
-
|
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
9
|
-
|
|
10
|
-
require 'store/full_text'
|
|
11
|
-
require 'pathname'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::StoreFullText do
|
|
14
|
-
before do
|
|
15
|
-
@db_filename = "test_full_text.db"
|
|
16
|
-
db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
|
|
17
|
-
db_path.delete if db_path.exist?
|
|
18
|
-
tmp_out = StringIO.new()
|
|
19
|
-
$stdout = tmp_out
|
|
20
|
-
Automatic::Plugin::StoreFullText.new({"db" => @db_filename}).run
|
|
21
|
-
$stdout = STDOUT
|
|
22
|
-
tmp_out.rewind()
|
|
23
|
-
Automatic::Log.puts("info", tmp_out.read())
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should store 1 record for the new blog entry" do
|
|
27
|
-
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
28
|
-
AutomaticSpec.generate_pipeline {
|
|
29
|
-
feed {
|
|
30
|
-
item "http://blog.id774.net/blogs/feed/",
|
|
31
|
-
"dummy title",
|
|
32
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
33
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
Automatic::Plugin::Blog.count.should eq 0
|
|
39
|
-
lambda {
|
|
40
|
-
instance.run.should have(1).feed
|
|
41
|
-
}.should change(Automatic::Plugin::Blog, :count).by(1)
|
|
42
|
-
Automatic::Plugin::Blog.count.should eq 1
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "should not store record for the existent blog entry" do
|
|
46
|
-
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
47
|
-
AutomaticSpec.generate_pipeline {
|
|
48
|
-
feed { item "http://blog.id774.net/blogs/feed/" }
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
Automatic::Plugin::Blog.count.should eq 0
|
|
53
|
-
instance.run.should have(1).feed
|
|
54
|
-
lambda {
|
|
55
|
-
instance.run.should have(0).feed
|
|
56
|
-
}.should change(Automatic::Plugin::Blog, :count).by(0)
|
|
57
|
-
instance.run.should have(0).feed
|
|
58
|
-
Automatic::Plugin::Blog.count.should eq 1
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "should not store record for the existent blog link" do
|
|
62
|
-
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
63
|
-
AutomaticSpec.generate_pipeline {
|
|
64
|
-
feed {
|
|
65
|
-
item "http://blog.id774.net/post/100",
|
|
66
|
-
"dummy title 1",
|
|
67
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
68
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
73
|
-
AutomaticSpec.generate_pipeline {
|
|
74
|
-
feed {
|
|
75
|
-
item "http://blog.id774.net/post/100",
|
|
76
|
-
"dummy title 2",
|
|
77
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
78
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
Automatic::Plugin::Blog.count.should eq 0
|
|
84
|
-
instance.run.should have(1).feed
|
|
85
|
-
lambda {
|
|
86
|
-
instance2.run.should have(0).feed
|
|
87
|
-
}.should change(Automatic::Plugin::Blog, :count).by(0)
|
|
88
|
-
instance2.run.should have(0).feed
|
|
89
|
-
Automatic::Plugin::Blog.count.should eq 1
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "should not store record for the existent blog title" do
|
|
93
|
-
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
94
|
-
AutomaticSpec.generate_pipeline {
|
|
95
|
-
feed {
|
|
96
|
-
item "http://blog.id774.net/post/100",
|
|
97
|
-
"dummy title 1",
|
|
98
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
99
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
104
|
-
AutomaticSpec.generate_pipeline {
|
|
105
|
-
feed {
|
|
106
|
-
item "http://blog.id774.net/post/200",
|
|
107
|
-
"dummy title 1",
|
|
108
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
109
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
Automatic::Plugin::Blog.count.should eq 0
|
|
115
|
-
instance.run.should have(1).feed
|
|
116
|
-
lambda {
|
|
117
|
-
instance2.run.should have(0).feed
|
|
118
|
-
}.should change(Automatic::Plugin::Blog, :count).by(0)
|
|
119
|
-
instance2.run.should have(0).feed
|
|
120
|
-
Automatic::Plugin::Blog.count.should eq 1
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
it "should store 2 records for the independent entries" do
|
|
124
|
-
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
125
|
-
AutomaticSpec.generate_pipeline {
|
|
126
|
-
feed {
|
|
127
|
-
item "http://blog.id774.net/post/100",
|
|
128
|
-
"dummy title 1",
|
|
129
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
130
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
|
135
|
-
AutomaticSpec.generate_pipeline {
|
|
136
|
-
feed {
|
|
137
|
-
item "http://blog.id774.net/post/200",
|
|
138
|
-
"dummy title 2",
|
|
139
|
-
"aaa bbb ccc http://test2.id774.net ddd eee",
|
|
140
|
-
"Mon, 07 Mar 2011 15:54:11 +0900"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
Automatic::Plugin::Blog.count.should eq 0
|
|
146
|
-
instance.run.should have(1).feed
|
|
147
|
-
lambda {
|
|
148
|
-
instance2.run.should have(1).feed
|
|
149
|
-
}.should change(Automatic::Plugin::Blog, :count).by(1)
|
|
150
|
-
Automatic::Plugin::Blog.count.should eq 2
|
|
151
|
-
end
|
|
152
|
-
end
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Store::Permalink
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Updated:: Dec 17, 2012
|
|
5
|
-
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
6
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
7
|
-
|
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
9
|
-
|
|
10
|
-
require 'store/permalink'
|
|
11
|
-
require 'pathname'
|
|
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
|
-
|
|
24
|
-
describe Automatic::Plugin::StorePermalink do
|
|
25
|
-
it "should store 1 record for the new link" do
|
|
26
|
-
@db_filename = "test_permalink.db"
|
|
27
|
-
db_cleate(@db_filename)
|
|
28
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
29
|
-
AutomaticSpec.generate_pipeline {
|
|
30
|
-
feed { item "http://github.com" }
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
lambda {
|
|
34
|
-
instance.run.should have(1).feed
|
|
35
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(1)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should not store record for the existent link" do
|
|
39
|
-
@db_filename = "test_permalink.db"
|
|
40
|
-
db_cleate(@db_filename)
|
|
41
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
42
|
-
AutomaticSpec.generate_pipeline {
|
|
43
|
-
feed { item "http://github.com" }
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
instance.run.should have(1).feed
|
|
48
|
-
lambda {
|
|
49
|
-
instance.run.should have(0).feed
|
|
50
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "should be considered the case of the feed link nil" do
|
|
54
|
-
@db_filename = "test_permalink.db"
|
|
55
|
-
db_cleate(@db_filename)
|
|
56
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
57
|
-
AutomaticSpec.generate_pipeline {
|
|
58
|
-
feed {
|
|
59
|
-
item "http://id774.net/images/link_1.jpg"
|
|
60
|
-
item "http://id774.net/images/link_2.jpg"
|
|
61
|
-
item "http://id774.net/images/link_3.JPG"
|
|
62
|
-
item "http://id774.net/images/link_4.png"
|
|
63
|
-
item "http://id774.net/images/link_5.jpeg"
|
|
64
|
-
item "http://id774.net/images/link_6.PNG"
|
|
65
|
-
item nil
|
|
66
|
-
item "http://id774.net/images/link_8.gif"
|
|
67
|
-
item "http://id774.net/images/link_9.GIF"
|
|
68
|
-
item "http://id774.net/images/link_10.tiff"
|
|
69
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
instance.run.should have(1).feed
|
|
75
|
-
lambda {
|
|
76
|
-
instance.run.should have(0).feed
|
|
77
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "should be considered the case of duplicated links" do
|
|
81
|
-
@db_filename = "test_permalink.db"
|
|
82
|
-
db_cleate(@db_filename)
|
|
83
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
84
|
-
AutomaticSpec.generate_pipeline {
|
|
85
|
-
feed {
|
|
86
|
-
item "http://id774.net/images/link_1.jpg"
|
|
87
|
-
item "http://id774.net/images/link_1.jpg"
|
|
88
|
-
item "http://id774.net/images/link_3.JPG"
|
|
89
|
-
item "http://id774.net/images/link_4.png"
|
|
90
|
-
item "http://id774.net/images/link_5.jpeg"
|
|
91
|
-
item "http://id774.net/images/link_6.PNG"
|
|
92
|
-
item nil
|
|
93
|
-
item "http://id774.net/images/link_8.gif"
|
|
94
|
-
item "http://id774.net/images/link_9.GIF"
|
|
95
|
-
item "http://id774.net/images/link_10.tiff"
|
|
96
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
instance.run.should have(1).feed
|
|
102
|
-
lambda {
|
|
103
|
-
instance.run.should have(0).feed
|
|
104
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
it "No feed should be generated when there is same feed." do
|
|
108
|
-
@db_filename = "test_permalink.db"
|
|
109
|
-
db_cleate(@db_filename)
|
|
110
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
111
|
-
AutomaticSpec.generate_pipeline {
|
|
112
|
-
feed {
|
|
113
|
-
item "http://id774.net/images/link_1.jpg"
|
|
114
|
-
item "http://id774.net/images/link_1.jpg"
|
|
115
|
-
item "http://id774.net/images/link_3.JPG"
|
|
116
|
-
item "http://id774.net/images/link_4.png"
|
|
117
|
-
item "http://id774.net/images/link_5.jpeg"
|
|
118
|
-
item "http://id774.net/images/link_6.PNG"
|
|
119
|
-
item nil
|
|
120
|
-
item "http://id774.net/images/link_8.gif"
|
|
121
|
-
item "http://id774.net/images/link_9.GIF"
|
|
122
|
-
item "http://id774.net/images/link_10.tiff"
|
|
123
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
instance.run.should have(1).feed
|
|
129
|
-
lambda {
|
|
130
|
-
instance.run.should have(0).feed
|
|
131
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
132
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
133
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
134
|
-
AutomaticSpec.generate_pipeline {
|
|
135
|
-
feed {
|
|
136
|
-
item "http://id774.net/images/link_1.jpg"
|
|
137
|
-
item "http://id774.net/images/link_1.jpg"
|
|
138
|
-
item "http://id774.net/images/link_3.JPG"
|
|
139
|
-
item "http://id774.net/images/link_4.png"
|
|
140
|
-
item "http://id774.net/images/link_5.jpeg"
|
|
141
|
-
item "http://id774.net/images/link_6.PNG"
|
|
142
|
-
item nil
|
|
143
|
-
item "http://id774.net/images/link_8.gif"
|
|
144
|
-
item "http://id774.net/images/link_9.GIF"
|
|
145
|
-
item "http://id774.net/images/link_10.tiff"
|
|
146
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
instance.run.should have(0).feed
|
|
152
|
-
lambda {
|
|
153
|
-
instance.run.should have(0).feed
|
|
154
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
it "Only new feed should be generated when there is new feed." do
|
|
158
|
-
@db_filename = "test_permalink.db"
|
|
159
|
-
db_cleate(@db_filename)
|
|
160
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
161
|
-
AutomaticSpec.generate_pipeline {
|
|
162
|
-
feed {
|
|
163
|
-
item "http://id774.net/images/link_1.jpg"
|
|
164
|
-
item "http://id774.net/images/link_1.jpg"
|
|
165
|
-
item "http://id774.net/images/link_3.JPG"
|
|
166
|
-
item "http://id774.net/images/link_4.png"
|
|
167
|
-
item "http://id774.net/images/link_5.jpeg"
|
|
168
|
-
item "http://id774.net/images/link_6.PNG"
|
|
169
|
-
item nil
|
|
170
|
-
item "http://id774.net/images/link_8.gif"
|
|
171
|
-
item "http://id774.net/images/link_9.GIF"
|
|
172
|
-
item "http://id774.net/images/link_10.tiff"
|
|
173
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
instance.run.should have(1).feed
|
|
179
|
-
lambda {
|
|
180
|
-
instance.run.should have(0).feed
|
|
181
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
182
|
-
Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
|
|
183
|
-
instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
|
|
184
|
-
AutomaticSpec.generate_pipeline {
|
|
185
|
-
feed {
|
|
186
|
-
item "http://id774.net/images/link_1.jpg"
|
|
187
|
-
item "http://id774.net/images/link_1.jpg"
|
|
188
|
-
item "http://id774.net/images/link_3.JPG"
|
|
189
|
-
item "http://id774.net/images/link_4_2.png"
|
|
190
|
-
item "http://id774.net/images/link_5_2.jpeg"
|
|
191
|
-
item "http://id774.net/images/link_6.PNG"
|
|
192
|
-
item nil
|
|
193
|
-
item "http://id774.net/images/link_8.gif"
|
|
194
|
-
item "http://id774.net/images/link_9.GIF"
|
|
195
|
-
item "http://id774.net/images/link_10.tiff"
|
|
196
|
-
item "http://id774.net/images/link_11.TIFF"
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
instance.run.should have(1).feed
|
|
202
|
-
lambda {
|
|
203
|
-
instance.run.should have(0).feed
|
|
204
|
-
}.should change(Automatic::Plugin::Permalink, :count).by(0)
|
|
205
|
-
end
|
|
206
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Subscription::ChanToru
|
|
3
|
-
# Author:: soramugi <http://soramugi.net>
|
|
4
|
-
# Created:: Jun 28, 2013
|
|
5
|
-
# Updated:: Jun 28, 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 'subscription/chan_toru'
|
|
12
|
-
|
|
13
|
-
def chan_toru(config = {}, pipeline = [])
|
|
14
|
-
Automatic::Plugin::SubscriptionChanToru.new(config,pipeline)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'Automatic::Plugin::SubscriptionChanToru' do
|
|
18
|
-
context 'when feed is empty' do
|
|
19
|
-
describe 'attestation error' do
|
|
20
|
-
subject { chan_toru }
|
|
21
|
-
before do
|
|
22
|
-
subject.should_receive(:g_guide_pipeline).times.and_return([])
|
|
23
|
-
end
|
|
24
|
-
its(:run) { should be_empty }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe 'interval & retry was used error' do
|
|
28
|
-
config = {'interval' => 1, 'retry' => 1}
|
|
29
|
-
subject { chan_toru(config) }
|
|
30
|
-
before do
|
|
31
|
-
subject.
|
|
32
|
-
should_receive(:g_guide_pipeline).
|
|
33
|
-
exactly(2).
|
|
34
|
-
times.and_return('')
|
|
35
|
-
end
|
|
36
|
-
its(:run) { should be_empty }
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
context 'when feed' do
|
|
41
|
-
describe 'config keyword' do
|
|
42
|
-
subject { chan_toru }
|
|
43
|
-
before do
|
|
44
|
-
pipeline = AutomaticSpec.generate_pipeline {
|
|
45
|
-
feed {
|
|
46
|
-
item "http://soramugi.net/images/hugehuge"
|
|
47
|
-
item "http://tv.so-net.ne.jp/schedule/500333201307052330.action?from=rss"
|
|
48
|
-
}}
|
|
49
|
-
subject.
|
|
50
|
-
should_receive(:g_guide_pipeline).
|
|
51
|
-
times.and_return(pipeline)
|
|
52
|
-
end
|
|
53
|
-
its(:run) { should have(1).feed }
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|