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.
Files changed (172) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +635 -83
  3. data/VERSION +1 -1
  4. data/automatic.gemspec +109 -248
  5. data/bin/automatic +20 -139
  6. data/config/feed2console.yml +10 -4
  7. data/config/feed2markdown.yml +41 -0
  8. data/doc/AI_TUTORIAL.md +518 -0
  9. data/doc/BASIC_DESIGN.md +516 -0
  10. data/doc/COPYING.LESSER +165 -0
  11. data/doc/DEPLOYMENT.md +824 -0
  12. data/doc/LICENSE.md +14 -0
  13. data/doc/PLUGINS.md +1875 -0
  14. data/doc/PLUGIN_DEVELOPMENT.md +86 -0
  15. data/doc/POLICY.md +857 -0
  16. data/doc/QUICKSTART.md +256 -0
  17. data/doc/RELEASING.md +381 -0
  18. data/doc/REQUIREMENTS.md +526 -0
  19. data/doc/VERSIONS +208 -0
  20. data/lib/automatic/cli.rb +248 -0
  21. data/lib/automatic/environment.rb +31 -5
  22. data/lib/automatic/feed_maker.rb +10 -9
  23. data/lib/automatic/feed_parser.rb +51 -35
  24. data/lib/automatic/http.rb +107 -0
  25. data/lib/automatic/log.rb +49 -18
  26. data/lib/automatic/opml.rb +3 -1
  27. data/lib/automatic/pipeline.rb +63 -32
  28. data/lib/automatic/recipe.rb +56 -17
  29. data/lib/automatic/version.rb +14 -1
  30. data/lib/automatic.rb +78 -20
  31. data/plugins/custom_feed/svn_log.rb +73 -32
  32. data/plugins/custom_feed/web.rb +348 -0
  33. data/plugins/filter/absolute_uri.rb +43 -27
  34. data/plugins/filter/accept.rb +38 -45
  35. data/plugins/filter/claude.rb +217 -0
  36. data/plugins/filter/clear.rb +12 -8
  37. data/plugins/filter/description_link.rb +49 -51
  38. data/plugins/filter/full_feed.rb +158 -52
  39. data/plugins/filter/gemini.rb +216 -0
  40. data/plugins/filter/github_feed.rb +38 -26
  41. data/plugins/filter/ignore.rb +33 -44
  42. data/plugins/filter/image.rb +36 -25
  43. data/plugins/filter/image_source.rb +58 -52
  44. data/plugins/filter/join.rb +107 -0
  45. data/plugins/filter/one.rb +19 -26
  46. data/plugins/filter/open_ai.rb +198 -0
  47. data/plugins/filter/rand.rb +16 -17
  48. data/plugins/filter/sakura_ai.rb +205 -0
  49. data/plugins/filter/sanitize.rb +29 -34
  50. data/plugins/filter/sort.rb +20 -27
  51. data/plugins/filter/tumblr_resize.rb +31 -23
  52. data/plugins/notify/ikachan.rb +86 -48
  53. data/plugins/provide/fluentd.rb +43 -24
  54. data/plugins/publish/amazon_s3.rb +73 -40
  55. data/plugins/publish/console.rb +19 -16
  56. data/plugins/publish/console_link.rb +20 -17
  57. data/plugins/publish/eject.rb +48 -26
  58. data/plugins/publish/fluentd.rb +50 -30
  59. data/plugins/publish/hatena_bookmark.rb +88 -71
  60. data/plugins/publish/instapaper.rb +69 -59
  61. data/plugins/publish/markdown.rb +278 -0
  62. data/plugins/publish/memcached.rb +35 -29
  63. data/plugins/store/database.rb +50 -48
  64. data/plugins/store/digest.rb +212 -0
  65. data/plugins/store/file.rb +99 -68
  66. data/plugins/store/full_text.rb +32 -25
  67. data/plugins/store/permalink.rb +18 -22
  68. data/plugins/subscription/feed.rb +34 -21
  69. data/plugins/subscription/link.rb +31 -32
  70. data/plugins/subscription/text.rb +32 -46
  71. data/plugins/subscription/tumblr.rb +55 -44
  72. data/plugins/subscription/xml.rb +40 -36
  73. metadata +108 -321
  74. data/Gemfile +0 -38
  75. data/Rakefile +0 -59
  76. data/doc/ChangeLog +0 -303
  77. data/doc/PLUGINS +0 -750
  78. data/doc/PLUGINS.ja +0 -753
  79. data/doc/README +0 -511
  80. data/doc/README.ja +0 -519
  81. data/plugins/filter/google_news.rb +0 -50
  82. data/plugins/publish/google_calendar.rb +0 -84
  83. data/plugins/publish/hipchat.rb +0 -46
  84. data/plugins/publish/pocket.rb +0 -45
  85. data/plugins/publish/twitter.rb +0 -58
  86. data/plugins/subscription/chan_toru.rb +0 -57
  87. data/plugins/subscription/g_guide.rb +0 -57
  88. data/plugins/subscription/pocket.rb +0 -51
  89. data/plugins/subscription/twitter.rb +0 -69
  90. data/plugins/subscription/twitter_search.rb +0 -50
  91. data/plugins/subscription/weather.rb +0 -33
  92. data/script/build +0 -84
  93. data/spec/fixtures/sampleFeeds.tsv +0 -1
  94. data/spec/fixtures/sampleFeeds2.tsv +0 -2
  95. data/spec/fixtures/sampleRecipe.yml +0 -24
  96. data/spec/lib/automatic/log_spec.rb +0 -32
  97. data/spec/lib/automatic/pipeline_spec.rb +0 -68
  98. data/spec/lib/automatic/recipe_spec.rb +0 -40
  99. data/spec/lib/automatic_spec.rb +0 -99
  100. data/spec/plugins/custom_feed/svn_log_spec.rb +0 -31
  101. data/spec/plugins/filter/absolute_uri_spec.rb +0 -61
  102. data/spec/plugins/filter/accept_spec.rb +0 -331
  103. data/spec/plugins/filter/clear_spec.rb +0 -49
  104. data/spec/plugins/filter/description_link_spec.rb +0 -138
  105. data/spec/plugins/filter/full_feed_spec.rb +0 -129
  106. data/spec/plugins/filter/github_feed_spec.rb +0 -55
  107. data/spec/plugins/filter/google_news_spec.rb +0 -69
  108. data/spec/plugins/filter/ignore_spec.rb +0 -328
  109. data/spec/plugins/filter/image_source_spec.rb +0 -89
  110. data/spec/plugins/filter/image_spec.rb +0 -65
  111. data/spec/plugins/filter/one_spec.rb +0 -71
  112. data/spec/plugins/filter/rand_spec.rb +0 -52
  113. data/spec/plugins/filter/sanitize_spec.rb +0 -153
  114. data/spec/plugins/filter/sort_spec.rb +0 -189
  115. data/spec/plugins/filter/tumblr_resize_spec.rb +0 -109
  116. data/spec/plugins/notify/ikachan_spec.rb +0 -58
  117. data/spec/plugins/provide/fluentd_spec.rb +0 -49
  118. data/spec/plugins/publish/amazon_s3_spec.rb +0 -40
  119. data/spec/plugins/publish/console_spec.rb +0 -30
  120. data/spec/plugins/publish/eject_spec.rb +0 -40
  121. data/spec/plugins/publish/fluentd_spec.rb +0 -40
  122. data/spec/plugins/publish/google_calendar_spec.rb +0 -83
  123. data/spec/plugins/publish/hatena_bookmark_spec.rb +0 -134
  124. data/spec/plugins/publish/hipchat_spec.rb +0 -69
  125. data/spec/plugins/publish/instapaper_spec.rb +0 -82
  126. data/spec/plugins/publish/memcached_spec.rb +0 -63
  127. data/spec/plugins/publish/pocket_spec.rb +0 -51
  128. data/spec/plugins/publish/twitter_spec.rb +0 -73
  129. data/spec/plugins/store/file_spec.rb +0 -58
  130. data/spec/plugins/store/full_text_spec.rb +0 -152
  131. data/spec/plugins/store/permalink_spec.rb +0 -206
  132. data/spec/plugins/subscription/chan_toru_spec.rb +0 -56
  133. data/spec/plugins/subscription/feed_spec.rb +0 -71
  134. data/spec/plugins/subscription/g_guide_spec.rb +0 -82
  135. data/spec/plugins/subscription/link_spec.rb +0 -72
  136. data/spec/plugins/subscription/pocket_spec.rb +0 -57
  137. data/spec/plugins/subscription/text_spec.rb +0 -84
  138. data/spec/plugins/subscription/tumblr_spec.rb +0 -74
  139. data/spec/plugins/subscription/twitter_search_spec.rb +0 -57
  140. data/spec/plugins/subscription/twitter_spec.rb +0 -73
  141. data/spec/plugins/subscription/weather_spec.rb +0 -44
  142. data/spec/plugins/subscription/xml_spec.rb +0 -84
  143. data/spec/spec_helper.rb +0 -106
  144. data/spec/user_dir/plugins/store/mock.rb +0 -16
  145. data/test/fixtures/sampleOPML.xml +0 -11
  146. data/test/integration/test_absoluteurl.yml +0 -25
  147. data/test/integration/test_activerecord.yml +0 -24
  148. data/test/integration/test_add_pocket.yml +0 -26
  149. data/test/integration/test_chan_toru.yml +0 -21
  150. data/test/integration/test_descriptionlink.yml +0 -21
  151. data/test/integration/test_fluentd.yml +0 -22
  152. data/test/integration/test_fulltext.yml +0 -30
  153. data/test/integration/test_google_news.yml +0 -21
  154. data/test/integration/test_googlealert.yml +0 -21
  155. data/test/integration/test_hatenabookmark.yml +0 -30
  156. data/test/integration/test_ignore.yml +0 -25
  157. data/test/integration/test_ignore2.yml +0 -22
  158. data/test/integration/test_image2local.yml +0 -33
  159. data/test/integration/test_instapaper.yml +0 -26
  160. data/test/integration/test_link2local.yml +0 -34
  161. data/test/integration/test_one.yml +0 -23
  162. data/test/integration/test_pocket.yml +0 -22
  163. data/test/integration/test_rand.yml +0 -21
  164. data/test/integration/test_sanitize.yml +0 -23
  165. data/test/integration/test_sort.yml +0 -36
  166. data/test/integration/test_svnlog.yml +0 -15
  167. data/test/integration/test_text2feed.yml +0 -36
  168. data/test/integration/test_tumblr2local.yml +0 -43
  169. data/test/integration/test_twitter_search.yml +0 -22
  170. data/test/integration/test_weather.yml +0 -19
  171. data/test/integration/test_xml2fluentd.yml +0 -21
  172. data/vendor/.gitkeep +0 -0
@@ -1,129 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Filter::FullFeed
3
- # Author:: 774 <http://id774.net>
4
- # Created:: Jan 24, 2013
5
- # Updated:: May 23, 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 'filter/full_feed'
12
-
13
- describe Automatic::Plugin::FilterFullFeed do
14
- context "It should be matched by siteinfo" do
15
- subject {
16
- Automatic::Plugin::FilterFullFeed.new(
17
- {
18
- 'siteinfo' => "items_all.json"
19
- },
20
- AutomaticSpec.generate_pipeline {
21
- feed {
22
- item "http://matome.naver.jp/odai/2129948007339738701/2129948085139809603", "hoge",
23
- "fuga",
24
- "Mon, 07 Mar 2011 15:54:11 +0900"
25
- }})}
26
-
27
- describe "#run" do
28
- its(:run) { should have(1).feeds }
29
-
30
- specify {
31
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
32
- should == "http://matome.naver.jp/odai/2129948007339738701/2129948085139809603"
33
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
34
- should == "fuga"
35
-
36
- subject.run
37
-
38
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
39
- should == "http://matome.naver.jp/odai/2129948007339738701/2129948085139809603"
40
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
41
- should match(/このまとめを見る/)
42
- }
43
- end
44
- end
45
-
46
- context "It should be not matched by siteinfo" do
47
- subject {
48
- Automatic::Plugin::FilterFullFeed.new(
49
- {
50
- 'siteinfo' => "items_all.json"
51
- },
52
- AutomaticSpec.generate_pipeline {
53
- feed {
54
- item "http://id774.net", "aaaaaa",
55
- "bbbbbb",
56
- "Mon, 07 Mar 2011 15:54:11 +0900"
57
- }})}
58
-
59
- describe "#run" do
60
- its(:run) { should have(1).feeds }
61
-
62
- specify {
63
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
64
- should == "http://id774.net"
65
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
66
- should == "bbbbbb"
67
-
68
- subject.run
69
-
70
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
71
- should == "http://id774.net"
72
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
73
- should == "bbbbbb"
74
- }
75
- end
76
- end
77
-
78
- context "It should be not matched by siteinfo with local dir" do
79
- subject {
80
- Automatic::Plugin::FilterFullFeed.new(
81
- {
82
- 'siteinfo' => "items_all.json"
83
- },
84
- AutomaticSpec.generate_pipeline {
85
- feed {
86
- item "http://id774.net", "cccc",
87
- "ddddd",
88
- "Mon, 07 Mar 2011 15:54:11 +0900"
89
- }})}
90
-
91
- describe "#run" do
92
- def cleanup_dir
93
- root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))
94
- dir = (File.expand_path('~/.automatic/assets/siteinfo'))
95
- if File.directory?(dir)
96
- Automatic::Log.puts(:info, "Removing #{dir}")
97
- FileUtils.rm_r(dir)
98
- end
99
- return dir, root_dir
100
- end
101
-
102
- before do
103
- dir, root_dir = cleanup_dir
104
- FileUtils.mkdir_p(dir)
105
- FileUtils.cp_r(root_dir + '/assets/siteinfo/items_all.json', dir)
106
- end
107
-
108
- its(:run) { should have(1).feeds }
109
-
110
- specify {
111
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
112
- should == "http://id774.net"
113
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
114
- should == "ddddd"
115
-
116
- subject.run
117
-
118
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
119
- should == "http://id774.net"
120
- subject.instance_variable_get(:@pipeline)[0].items[0].description.
121
- should == "ddddd"
122
- }
123
-
124
- after do
125
- cleanup_dir
126
- end
127
- end
128
- end
129
- end
@@ -1,55 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Filter::GithubFeed
3
- # Author:: Kohei Hasegawa <http://github.com/banyan>
4
- # 774 <http://id774.net>
5
- # Created:: Jun 6, 2013
6
- # Updated:: Feb 21, 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 'filter/github_feed'
13
-
14
- describe Automatic::Plugin::FilterGithubFeed do
15
- context "with description with filename of tumblr should be renamed 500 to 1280" do
16
- subject {
17
- described_class.new(
18
- {},
19
- AutomaticSpec.generate_pipeline {
20
- feed {
21
- 2.times do |i|
22
- @channel.items << Hashie::Mash.new(
23
- :title => { :content => "title#{i}" },
24
- :id => { :content => i.to_s },
25
- :content => { :content => "description#{i}" }
26
- )
27
- end
28
- }
29
- }
30
- )
31
- }
32
-
33
- describe "#run" do
34
- its(:run) { should have(1).feeds }
35
-
36
- specify {
37
- subject.run
38
-
39
- subject.instance_variable_get(:@return_feeds)[0].items[0].link
40
- .should == '1'
41
- subject.instance_variable_get(:@return_feeds)[0].items[0].title
42
- .should == 'title1'
43
- subject.instance_variable_get(:@return_feeds)[0].items[0].description
44
- .should == 'description1'
45
-
46
- subject.instance_variable_get(:@return_feeds)[0].items[1].link
47
- .should == '0'
48
- subject.instance_variable_get(:@return_feeds)[0].items[1].title
49
- .should == 'title0'
50
- subject.instance_variable_get(:@return_feeds)[0].items[1].description
51
- .should == 'description0'
52
- }
53
- end
54
- end
55
- end
@@ -1,69 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Filter::GoogleNews
3
- # Author:: 774 <http://id774.net>
4
- # Created:: Oct 12, 2014
5
- # Updated:: Oct 12, 2014
6
- # Copyright:: Copyright (c) 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 'filter/google_news'
12
-
13
- describe Automatic::Plugin::FilterGoogleNews do
14
-
15
- context "It should be not rewrite link other urls" do
16
-
17
- subject {
18
- Automatic::Plugin::FilterGoogleNews.new(
19
- {},
20
- AutomaticSpec.generate_pipeline {
21
- feed {
22
- item "http://test1.id774.net",
23
- "dummy title",
24
- "aaa bbb ccc http://test2.id774.net ddd eee",
25
- "Mon, 07 Mar 2011 15:54:11 +0900"
26
- }
27
- }
28
- )
29
- }
30
-
31
- describe "#run" do
32
- its(:run) { should have(1).feeds }
33
-
34
- specify {
35
- subject.run
36
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
37
- should == "http://test1.id774.net"
38
- }
39
- end
40
- end
41
-
42
- context "It should be rewrite link for google news urls" do
43
-
44
- subject {
45
- Automatic::Plugin::FilterGoogleNews.new(
46
- {},
47
- AutomaticSpec.generate_pipeline {
48
- feed {
49
- item "http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNGhIFo1illQ6jFyVGPZtfkttFaJYQ&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52779138313507&ei=Pts3VLDAD4X7kgWO9oGIBg&url=http://www.yomiuri.co.jp/world/20141010-OYT1T50090.html",
50
- "dummy title",
51
- "aaa bbb ccc http://test2.id774.net ddd eee",
52
- "Mon, 07 Mar 2011 15:54:11 +0900"
53
- }
54
- }
55
- )
56
- }
57
-
58
- describe "#run" do
59
- its(:run) { should have(1).feeds }
60
-
61
- specify {
62
- subject.run
63
- subject.instance_variable_get(:@pipeline)[0].items[0].link.
64
- should == "http://www.yomiuri.co.jp/world/20141010-OYT1T50090.html"
65
- }
66
- end
67
- end
68
-
69
- end
@@ -1,328 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Filter::Ignore
3
- # Author:: 774 <http://id774.net>
4
- # Updated:: Jan 19, 2013
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 'filter/ignore'
11
-
12
- describe Automatic::Plugin::FilterIgnore do
13
-
14
- context "with exclusion by title" do
15
- subject {
16
- Automatic::Plugin::FilterIgnore.new({
17
- 'title' => [""],
18
- },
19
- AutomaticSpec.generate_pipeline {
20
- feed { item "http://github.com", "foo" }
21
- feed { item "http://google.com", "hi" }
22
- })
23
- }
24
-
25
- describe "#run" do
26
- its(:run) { should have(0).feeds }
27
- end
28
- end
29
-
30
- context "with exclusion by title" do
31
- subject {
32
- Automatic::Plugin::FilterIgnore.new({
33
- 'title' => ["foo"],
34
- },
35
- AutomaticSpec.generate_pipeline {
36
- feed { item "http://github.com", "foo" }
37
- feed { item "http://google.com", "hi" }
38
- })
39
- }
40
-
41
- describe "#run" do
42
- its(:run) { should have(1).feeds }
43
- end
44
- end
45
-
46
- context "with exclusion by title" do
47
- subject {
48
- Automatic::Plugin::FilterIgnore.new({
49
- 'title' => ["o"],
50
- },
51
- AutomaticSpec.generate_pipeline {
52
- feed { item "http://github.com", "foo" }
53
- feed { item "http://google.com", "hi" }
54
- })
55
- }
56
-
57
- describe "#run" do
58
- its(:run) { should have(1).feeds }
59
- end
60
- end
61
-
62
- context "with exclusion by links" do
63
- subject {
64
- Automatic::Plugin::FilterIgnore.new({
65
- 'link' => ["comment"],
66
- },
67
- AutomaticSpec.generate_pipeline {
68
- feed { item "http://github.com" }
69
- feed { item "http://google.com" }
70
- })
71
- }
72
-
73
- describe "#run" do
74
- its(:run) { should have(2).feeds }
75
- end
76
- end
77
-
78
- context "with exclusion by links" do
79
- subject {
80
- Automatic::Plugin::FilterIgnore.new({
81
- 'link' => ["comment"],
82
- },
83
- AutomaticSpec.generate_pipeline {
84
- feed { item "http://github.com" }
85
- feed { item "http://google.com/comment" }
86
- })
87
- }
88
-
89
- describe "#run" do
90
- its(:run) { should have(1).feeds }
91
- end
92
- end
93
-
94
- context "with exclusion by links" do
95
- subject {
96
- Automatic::Plugin::FilterIgnore.new({
97
- 'link' => ["hoge"],
98
- },
99
- AutomaticSpec.generate_pipeline {
100
- feed { item "http://github.com" }
101
- feed { item "http://google.com" }
102
- })
103
- }
104
-
105
- describe "#run" do
106
- its(:run) { should have(2).feeds }
107
- end
108
- end
109
-
110
- context "with exclusion by links" do
111
- subject {
112
- Automatic::Plugin::FilterIgnore.new({
113
- 'link' => ["hoge"],
114
- },
115
- AutomaticSpec.generate_pipeline {
116
- feed { item "http://github.com/hoge" }
117
- feed { item "http://google.com" }
118
- })
119
- }
120
-
121
- describe "#run" do
122
- its(:run) { should have(1).feeds }
123
- end
124
- end
125
-
126
- context "with exclusion by links" do
127
- subject {
128
- Automatic::Plugin::FilterIgnore.new({
129
- 'link' => ["github"],
130
- },
131
- AutomaticSpec.generate_pipeline {
132
- feed { item "http://github.com" }
133
- feed { item "http://google.com" }
134
- })
135
- }
136
-
137
- describe "#run" do
138
- its(:run) { should have(1).feeds }
139
- end
140
- end
141
-
142
- context "with exclusion by links" do
143
- subject {
144
- Automatic::Plugin::FilterIgnore.new({
145
- 'link' => [""],
146
- },
147
- AutomaticSpec.generate_pipeline {
148
- feed { item "http://github.com" }
149
- feed { item "http://google.com" }
150
- })
151
- }
152
-
153
- describe "#run" do
154
- its(:run) { should have(0).feeds }
155
- end
156
- end
157
-
158
- context "with exclusion by description" do
159
- subject {
160
- Automatic::Plugin::FilterIgnore.new({
161
- 'description' => ["comment"],
162
- },
163
- AutomaticSpec.generate_pipeline {
164
- feed { item "http://github.com" }
165
- feed { item "http://google.com" }
166
- })
167
- }
168
-
169
- describe "#run" do
170
- its(:run) { should have(2).feeds }
171
- end
172
- end
173
-
174
- context "with exclusion by description" do
175
- subject {
176
- Automatic::Plugin::FilterIgnore.new({
177
- 'description' => [""],
178
- },
179
- AutomaticSpec.generate_pipeline {
180
- feed { item "http://github.com" }
181
- feed { item "http://google.com" }
182
- })
183
- }
184
-
185
- describe "#run" do
186
- its(:run) { should have(0).feeds }
187
- end
188
- end
189
-
190
- context "with exclusion by description" do
191
- subject {
192
- Automatic::Plugin::FilterIgnore.new({
193
- 'description' => ["bbb"],
194
- },
195
- AutomaticSpec.generate_pipeline {
196
- # url, title, description, pubDate, author, source, enclosure
197
- feed {
198
- item "http://hogefuga.com", "",
199
- "aaabbbccc"
200
- }
201
- feed {
202
- item "http://aaabbbccc.com", "",
203
- "hogefugahoge"
204
- }
205
- feed {
206
- item "http://aaabbbccc.com", "",
207
- "aaaccc"
208
- }
209
- feed {
210
- item "http://aaaccc.com", "",
211
- "aaabbbccc"
212
- }
213
- }
214
- )}
215
-
216
- describe "#run" do
217
- its(:run) { should have(2).feeds }
218
- end
219
- end
220
-
221
- context "with exclusion by description" do
222
- subject {
223
- Automatic::Plugin::FilterIgnore.new({
224
- 'description' => ["aaaa"],
225
- },
226
- AutomaticSpec.generate_pipeline {
227
- feed {
228
- item "http://hogefuga.com", "",
229
- "aaaabbbccc"
230
- }
231
- feed {
232
- item "http://aaaabbbccc.com", "",
233
- "hogefugahoge"
234
- }
235
- feed {
236
- item "http://aaabbbccc.com", "",
237
- "aaaaaaaaaacccdd"
238
- }
239
- feed {
240
- item "http://aaaaccc.com", "",
241
- "aabbbccc"
242
- }
243
- feed {
244
- item "http://aaaaccc.com", "",
245
- "aabbbcccdd"
246
- }
247
- }
248
- )}
249
-
250
- describe "#run" do
251
- its(:run) { should have(3).feeds }
252
- end
253
- end
254
-
255
- context "with item base exclusion by links" do
256
- subject {
257
- Automatic::Plugin::FilterIgnore.new({
258
- 'link' => ["dddd"],
259
- },
260
- AutomaticSpec.generate_pipeline {
261
- feed {
262
- item "http://hogefuga.com", "",
263
- "aaaabbbccc"
264
- item "http://hogefuga.com", "",
265
- "aaaabbbcccdddd"
266
- }
267
- feed {
268
- item "http://aaaabbbccc.com", "",
269
- "hogefugahoge"
270
- }
271
- feed {
272
- item "http://aaabbbcccdddd.com", "",
273
- "aaaaaaaaaacccdd"
274
- }
275
- feed {
276
- item "http://aaaaccc.com", "",
277
- "aabbbccc"
278
- item "http://aabbcccdddd.com", "",
279
- "aabbbcccddd"
280
- }
281
- feed {
282
- item "http://cccdddd.com", "",
283
- "aabbbcccdd"
284
- }
285
- }
286
- )}
287
-
288
- describe "#run" do
289
- its(:run) { should have(3).feeds }
290
- end
291
- end
292
-
293
- context "with item base exclusion by description" do
294
- subject {
295
- Automatic::Plugin::FilterIgnore.new({
296
- 'description' => ["aaaa"],
297
- },
298
- AutomaticSpec.generate_pipeline {
299
- feed {
300
- item "http://hogefuga.com", "",
301
- "aaaabbbccc"
302
- }
303
- feed {
304
- item "http://aaaabbbccc.com", "",
305
- "hogefugahoge"
306
- }
307
- feed {
308
- item "http://aaabbbccc.com", "",
309
- "aaaaaaaaaacccdd"
310
- }
311
- feed {
312
- item "http://aaccc.com", "",
313
- "aaaabbbccc"
314
- item "http://aabbccc.com", "",
315
- "aabbbccc"
316
- }
317
- feed {
318
- item "http://cccddd.com", "",
319
- "aabbbcccdd"
320
- }
321
- }
322
- )}
323
-
324
- describe "#run" do
325
- its(:run) { should have(3).feeds }
326
- end
327
- end
328
- end
@@ -1,89 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Filter::ImageSource
3
- # Author:: kzgs
4
- # 774 <http://id774.net>
5
- # Created:: Mar 1, 2012
6
- # Updated:: Feb 21, 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 'filter/image_source'
13
-
14
- describe Automatic::Plugin::FilterImageSource do
15
- context "with description with image tag" do
16
- subject {
17
- Automatic::Plugin::FilterImageSource.new({},
18
- AutomaticSpec.generate_pipeline {
19
- feed {
20
- item "http://tumblr.com", "",
21
- "<img src=\"http://27.media.tumblr.com/tumblr_lzrubkfPlt1qb8vzto1_500.png\">"
22
- }})}
23
-
24
- describe "#run" do
25
- its(:run) { should have(1).feeds }
26
- specify {
27
- subject.run
28
- subject.instance_variable_get(:@return_feeds)[0].items[0].link.
29
- should == "http://27.media.tumblr.com/tumblr_lzrubkfPlt1qb8vzto1_500.png"
30
- }
31
- end
32
- end
33
- end
34
-
35
- describe Automatic::Plugin::FilterImageSource do
36
- context "with description with image tag" do
37
- subject {
38
- Automatic::Plugin::FilterImageSource.new({},
39
- AutomaticSpec.generate_pipeline {
40
- feed {
41
- item "http://tumblr.com", "",
42
- "<img src=\"http://24.media.tumblr.com/tumblr_m07wttnIdy1qzoj1jo1_400.jpg\">"
43
- }})}
44
-
45
- describe "#run" do
46
- its(:run) { should have(1).feeds }
47
- specify {
48
- subject.run
49
- subject.instance_variable_get(:@return_feeds)[0].items[0].link.
50
- should == "http://24.media.tumblr.com/tumblr_m07wttnIdy1qzoj1jo1_400.jpg"
51
- }
52
- end
53
- end
54
- end
55
-
56
- describe Automatic::Plugin::FilterImageSource do
57
- context "with link to tag image" do
58
- subject {
59
- Automatic::Plugin::FilterImageSource.new({},
60
- AutomaticSpec.generate_pipeline {
61
- feed {
62
- item "http://tumblr.com", "",
63
- ""
64
- }})}
65
-
66
- describe "#run" do
67
- before do
68
- subject.stub(:rewrite_link).and_return(['http://huge.png'])
69
- end
70
-
71
- its(:run) { should have(1).feeds }
72
- specify {
73
- subject.run
74
- subject.instance_variable_get(:@return_feeds)[0].items[0].link.
75
- should == 'http://huge.png'
76
- }
77
- end
78
-
79
- describe "#imgs" do
80
- before do
81
- open = Hashie::Mash.new
82
- open.read = '<img src="http://a.png"><br /><img src="http://b.png">'
83
- subject.stub(:open).and_return(open)
84
- end
85
-
86
- its(:run) { subject.run[0].items.length.should == 2 }
87
- end
88
- end
89
- end