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,45 +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:: Jan 15, 2014
6
- # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
- # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
-
9
- module Automatic::Plugin
10
- class PublishPocket
11
- require 'pocket'
12
-
13
- def initialize(config, pipeline=[])
14
- @config = config
15
- @pipeline = pipeline
16
- Pocket.configure do |c|
17
- c.consumer_key = @config['consumer_key']
18
- c.access_token = @config['access_token']
19
- end
20
- @client = Pocket.client
21
- end
22
-
23
- def run
24
- @pipeline.each {|feeds|
25
- unless feeds.nil?
26
- feeds.items.each {|feed|
27
- retries = 0
28
- retry_max = @config['retry'].to_i || 0
29
- begin
30
- @client.add(:url => feed.link)
31
- Automatic::Log.puts("info", "add: #{feed.link}")
32
- rescue
33
- retries += 1
34
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to pocket.")
35
- sleep ||= @config['interval'].to_i
36
- retry if retries <= retry_max
37
- end
38
- sleep ||= @config['interval'].to_i
39
- }
40
- end
41
- }
42
- @pipeline
43
- end
44
- end
45
- end
@@ -1,58 +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:: May 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
- module Automatic::Plugin
10
- class PublishTwitter
11
- require 'twitter'
12
-
13
- def initialize(config, pipeline=[])
14
- @config = config
15
- @pipeline = pipeline
16
-
17
- Twitter.configure do |conf|
18
- conf.consumer_key = @config['consumer_key']
19
- conf.consumer_secret = @config['consumer_secret']
20
- conf.oauth_token = @config['oauth_token']
21
- conf.oauth_token_secret = @config['oauth_token_secret']
22
- end
23
- @twitter = Twitter
24
-
25
- if @config['tweet_tmp'] == nil
26
- @tweet_tmp = '{title} {link}'
27
- else
28
- @tweet_tmp = @config['tweet_tmp']
29
- end
30
-
31
- end
32
-
33
- def run
34
- @pipeline.each {|feeds|
35
- unless feeds.nil?
36
- feeds.items.each {|feed|
37
- Automatic::Log.puts("info", "Publish Tweet: #{feed.link}")
38
- retries = 0
39
- retry_max = @config['retry'].to_i || 0
40
- begin
41
- tweet = @tweet_tmp.gsub(/\{(.+?)\}/) do |text|
42
- feed.__send__($1)
43
- end
44
- @twitter.update(tweet)
45
- rescue
46
- retries += 1
47
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to twitter.")
48
- sleep ||= @config['interval'].to_i
49
- retry if retries <= retry_max
50
- end
51
- sleep ||= @config['interval'].to_i
52
- }
53
- end
54
- }
55
- @pipeline
56
- end
57
- end
58
- end
@@ -1,57 +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:: Jan 15, 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__) + '/g_guide')
10
-
11
- module Automatic::Plugin
12
- class SubscriptionChanToru
13
-
14
- def initialize(config, pipeline=[])
15
- @config = config
16
- @pipeline = pipeline
17
- end
18
-
19
- def g_guide_pipeline
20
- SubscriptionGGuide.new(@config, @pipeline).run
21
- end
22
-
23
- def run
24
- retries = 0
25
- retry_max = @config['retry'].to_i || 0
26
- begin
27
- pipeline = g_guide_pipeline
28
- pipeline.each {|feeds|
29
- feeds.items.each {|feed|
30
- feed = link_change(feed)
31
- }
32
- }
33
- @pipeline = pipeline
34
- rescue
35
- retries += 1
36
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
37
- sleep ||= @config['interval'].to_i
38
- retry if retries <= retry_max
39
- end
40
-
41
- @pipeline
42
- end
43
-
44
- def link_change(feed)
45
- feed.link.gsub(/([0-9]+)/) do |pid|
46
- if pid != ''
47
- feed.link = "https://tv.so-net.ne.jp/chan-toru/intent" +
48
- "?cat=1&area=23&pid=#{pid}&from=tw"
49
- else
50
- feed.link = nil
51
- end
52
- end
53
- feed
54
- end
55
-
56
- end
57
- end
@@ -1,57 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::GGuide
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: Jun 28, 2013
6
- # Updated:: Oct 29, 2014
7
- # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
8
- # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
-
10
- module Automatic::Plugin
11
- class SubscriptionGGuide
12
- G_GUIDE_RSS = 'http://tv.so-net.ne.jp/rss/schedulesBySearch.action?'
13
-
14
- def initialize(config, pipeline=[])
15
- @config = config
16
- @pipeline = pipeline
17
- unless @config['keyword'].nil? || @config['keyword'].index(',').nil?
18
- @keywords = @config['keyword'].split(',')
19
- else
20
- @keywords = [@config['keyword']]
21
- end
22
- end
23
-
24
- def run
25
- retries = 0
26
- retry_max = @config['retry'].to_i || 0
27
- begin
28
- @keywords.each {|keyword|
29
- @pipeline << Automatic::FeedParser.get_url(feed_url keyword)
30
- }
31
- rescue
32
- retries += 1
33
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
34
- sleep ||= @config['interval'].to_i
35
- retry if retries <= retry_max
36
- end
37
- @pipeline
38
- end
39
-
40
- def feed_url keyword = nil
41
- feed = G_GUIDE_RSS
42
- unless keyword.nil?
43
- feed += "condition.keyword=#{keyword}&"
44
- end
45
- feed += station_param
46
- URI::Parser.new.escape(feed)
47
- end
48
-
49
- def station_param
50
- station = 0
51
- unless @config['station'].nil?
52
- station = '1' if @config['station'] == '地上波'
53
- end
54
- "stationPlatformId=#{station}&"
55
- end
56
- end
57
- end
@@ -1,51 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::Pocket
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: May 21, 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
- module Automatic::Plugin
11
- class SubscriptionPocket
12
- require 'pocket'
13
-
14
- def initialize(config, pipeline=[])
15
- @config = config
16
- @pipeline = pipeline
17
- Pocket.configure do |c|
18
- c.consumer_key = @config['consumer_key']
19
- c.access_token = @config['access_token']
20
- end
21
- @client = Pocket.client
22
- end
23
-
24
- def run
25
- retries = 0
26
- retry_max = @config['retry'].to_i || 0
27
- begin
28
- return_feeds = generate_feed(@client.retrieve(@config['optional']))
29
- @pipeline << Automatic::FeedMaker.create_pipeline(return_feeds)
30
- rescue
31
- retries += 1
32
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
33
- sleep ||= @config['interval'].to_i
34
- retry if retries <= retry_max
35
- end
36
- @pipeline
37
- end
38
-
39
- def generate_feed(retrieve)
40
- return_feeds = []
41
- retrieve['list'].each {|key,list|
42
- hashie = Hashie::Mash.new
43
- hashie.title = list['given_title']
44
- hashie.link = list['given_url']
45
- hashie.description = list['excerpt']
46
- return_feeds << hashie
47
- }
48
- return_feeds
49
- end
50
- end
51
- end
@@ -1,69 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::Twitter
3
- # Author:: 774 <http://id774.net>
4
- # Created:: Sep 9, 2012
5
- # Updated:: Jan 15, 2014
6
- # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
- # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
-
9
- module Automatic::Plugin
10
- class SubscriptionTwitter
11
- require 'open-uri'
12
- require 'nokogiri'
13
- require 'rss'
14
-
15
- def initialize(config, pipeline=[])
16
- @config = config
17
- @pipeline = pipeline
18
- end
19
-
20
- def run
21
- @return_feeds = []
22
- @config['urls'].each {|url|
23
- retries = 0
24
- retry_max = @config['retry'].to_i || 0
25
- begin
26
- create_rss(url)
27
- rescue
28
- retries += 1
29
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
30
- sleep ||= @config['interval'].to_i
31
- retry if retries <= retry_max
32
- end
33
- }
34
- @return_feeds
35
- end
36
-
37
- private
38
-
39
- def create_rss(url)
40
- Automatic::Log.puts("info", "Parsing Twitter: #{url}")
41
- html = open(url).read
42
- unless html.nil?
43
- rss = RSS::Maker.make("2.0") {|maker|
44
- xss = maker.xml_stylesheets.new_xml_stylesheet
45
- xss.href = "http://twitter.com"
46
- maker.channel.about = "http://twitter.com/index.rdf"
47
- maker.channel.title = "Twitter"
48
- maker.channel.description = "Twitter"
49
- maker.channel.link = "http://twitter.com/"
50
- maker.items.do_sort = true
51
- doc = Nokogiri::HTML(html)
52
- doc.xpath("/html/body/div").search('[@class="content"]').each {|content|
53
- item = maker.items.new_item
54
- item.title = content.search('[@class="username js-action-profile-name"]').text.to_s
55
- content.search('[@class="tweet-timestamp js-permalink js-nav"]').each {|node|
56
- item.link = "http://twitter.com" + node['href'].to_s
57
- }
58
- content.search('[@class="_timestamp js-short-timestamp js-relative-timestamp"]').each {|node|
59
- item.date = Time.at(node['data-time'].to_i)
60
- }
61
- item.description = content.search('[@class="js-tweet-text"]').text.to_s
62
- }
63
- }
64
- sleep ||= @config['interval'].to_i
65
- @return_feeds << rss
66
- end
67
- end
68
- end
69
- end
@@ -1,50 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::TwitterSearch
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: May 30, 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
- module Automatic::Plugin
11
- class SubscriptionTwitterSearch
12
- require 'twitter'
13
-
14
- def initialize(config, pipeline=[])
15
- @config = config
16
- @pipeline = pipeline
17
- @client = Twitter::Client.new(
18
- :consumer_key => @config['consumer_key'],
19
- :consumer_secret => @config['consumer_secret'],
20
- :oauth_token => @config['oauth_token'],
21
- :oauth_token_secret => @config['oauth_token_secret']
22
- )
23
- end
24
-
25
- def run
26
- @pipeline = []
27
- retries = 0
28
- retry_max = @config['retry'].to_i || 0
29
- begin
30
- return_feeds = []
31
- @client.search(@config['search'],@config['opt']).results.each do |status|
32
- hashie = Hashie::Mash.new
33
- hashie.title = 'Twitter Search'
34
- hashie.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}"
35
- hashie.description = status.text
36
- hashie.author = status.user['screen_name']
37
- hashie.date = status.created_at
38
- return_feeds << hashie
39
- end
40
- @pipeline << Automatic::FeedMaker.create_pipeline(return_feeds)
41
- rescue
42
- retries += 1
43
- Automatic::Log.puts("error", "ErrorCount: #{retries}")
44
- sleep ||= @config['interval'].to_i
45
- retry if retries <= retry_max
46
- end
47
- @pipeline
48
- end
49
- end
50
- end
@@ -1,33 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::Weather
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: May 12, 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
- module Automatic::Plugin
11
- class SubscriptionWeather
12
- require 'weather_hacker'
13
-
14
- def initialize(config, pipeline=[])
15
- @config = config
16
- @pipeline = pipeline
17
- @weather = WeatherHacker.new(@config['zipcode'])
18
- @day = 'today'
19
- @day = @config['day'] unless @config['day'].nil?
20
- end
21
-
22
- def run
23
- weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil?
24
- if weather != nil
25
- hashie = Hashie::Mash.new
26
- hashie.title = weather
27
- hashie.link = 'http://weather.dummy.' + @day
28
- @pipeline << Automatic::FeedMaker.create_pipeline([hashie])
29
- end
30
- @pipeline
31
- end
32
- end
33
- end
data/script/build DELETED
@@ -1,84 +0,0 @@
1
- #!/bin/sh
2
- #
3
- ########################################################################
4
- # Integration Build Script
5
- # $1 = all (Run integration tests)
6
- #
7
- # Maintainer: id774 <idnanashi@gmail.com>
8
- #
9
- # v1.5 6/28,2013
10
- # Always using latest gems.
11
- # v1.4 5/13,2013
12
- # Fix bundler environment.
13
- # v1.3 2/26,2013
14
- # Remove script/bootstrap.
15
- # v1.2 6/16,2012
16
- # Add all option for integration tests.
17
- # v1.1 6/14,2012
18
- # Correspond to unscaffold subcommand.
19
- # v1.0 3/16,2012
20
- # First.
21
- ########################################################################
22
-
23
- kickstart() {
24
- export RACK_ROOT="."
25
- export RACK_ENV="test"
26
- #export DATABASE_URL="$RACK_ROOT/db"
27
- ruby -v
28
- test_subcommand log info started.
29
- }
30
-
31
- exec_rspec() {
32
- $RACK_ROOT/bin/automatic -v
33
- #bundle install --path vendor/gems
34
- bundle update
35
- bundle exec rake simplecov
36
- }
37
-
38
- run_test() {
39
- while [ $# -gt 0 ]
40
- do
41
- bundle exec $RACK_ROOT/bin/automatic -c $1
42
- test_subcommand log info $?
43
- shift
44
- done
45
- }
46
-
47
- load_tests() {
48
- for YAML_FILE in "$RACK_ROOT/test/integration/test_*.yml"
49
- do
50
- run_test $YAML_FILE
51
- done
52
- unset YAML_FILE
53
- }
54
-
55
- test_subcommand() {
56
- $RACK_ROOT/bin/automatic $*
57
- }
58
-
59
- test_scaffold() {
60
- test_subcommand scaffold
61
- test_subcommand unscaffold
62
- }
63
-
64
- added_tests() {
65
- test -f $HOME/.automatic || test_scaffold
66
- test_subcommand autodiscovery http://blog.id774.net/blogs/
67
- test_subcommand opmlparser "$RACK_ROOT/test/fixtures/sampleOPML.xml"
68
- test_subcommand feedparser http://blog.id774.net/blogs/feed/ > /dev/null
69
- test_subcommand log info finished.
70
- }
71
-
72
- integration() {
73
- load_tests
74
- added_tests
75
- }
76
-
77
- main() {
78
- kickstart
79
- exec_rspec
80
- test -n "$1" && integration
81
- }
82
-
83
- set -ex
84
- main $*
@@ -1 +0,0 @@
1
- testTitle http://dummy.from.file testDescription testAuthor testComments
@@ -1,2 +0,0 @@
1
- testTitle1 http://dummy.from.file1 testDescription1 testComments1
2
- testTitle2 http://dummy.from.file2 testDescription2 testAuthor2
@@ -1,24 +0,0 @@
1
- global:
2
- timezone: Asia/Tokyo
3
- cache:
4
- base: /tmp
5
- log:
6
- level: none
7
-
8
- plugins:
9
- - module: SubscriptionFeed
10
- config:
11
- feeds:
12
- - http://blog.id774.net/post/feed/
13
-
14
- - module: FilterIgnore
15
- config:
16
- link:
17
- - hoge
18
-
19
- - module: StorePermalink
20
- config:
21
- db: test_permalink.db
22
-
23
- #- module: PublishConsole
24
-
@@ -1,32 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Auaotmatic::Log
3
- # Author:: soramugi
4
- # 774 <http://id774.net>
5
- # Created:: May 19, 2013
6
- # Updated:: Oct 09, 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.join(File.dirname(__FILE__) ,'../../spec_helper'))
11
- require 'automatic'
12
- require 'automatic/log'
13
-
14
- describe Automatic::Log do
15
- context "with a puts" do
16
- ['info', 'warn', 'error'].each {|level|
17
- its (level) {
18
- subject.level(level)
19
- subject.puts(level, 'log spec').should_not == nil
20
- }
21
- }
22
- end
23
-
24
- context "with a not puts" do
25
- ['warn', 'error', 'none'].each {|level|
26
- its (level) {
27
- subject.level(level)
28
- subject.puts('info', 'log spec').should == nil
29
- }
30
- }
31
- end
32
- end
@@ -1,68 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Pipeline
3
- # Author:: ainame
4
- # 774 <http://id774.net>
5
- # Created:: Mar 10, 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.join(File.dirname(__FILE__) ,'../../spec_helper'))
11
- require 'automatic'
12
- require 'automatic/pipeline'
13
-
14
- TEST_MODULES = ["SubscriptionFeed", "FilterIgnore"]
15
-
16
- describe Automatic::Pipeline do
17
- describe "in default dir" do
18
- before do
19
- Automatic.root_dir = APP_ROOT
20
- Automatic.user_dir = nil
21
- end
22
-
23
- describe "#load_plugin" do
24
- it "raise no plugin error" do
25
- lambda{
26
- Automatic::Pipeline.load_plugin "FooBar"
27
- }.should raise_exception(Automatic::NoPluginError,
28
- /unknown plugin named FooBar/)
29
- end
30
-
31
- it "correctly load module" do
32
- TEST_MODULES.each do |mod|
33
- Automatic::Pipeline.load_plugin mod.to_s
34
- Automatic::Plugin.const_get(mod).class.should == Class
35
- end
36
- end
37
- end
38
-
39
- describe "#run" do
40
- it "run a recipe with FilterIgnore module" do
41
- plugin = double("plugin")
42
- plugin.should_receive(:module).and_return("FilterIgnore")
43
- plugin.should_receive(:config)
44
- recipe = double("recipe")
45
- recipe.should_receive(:each_plugin).and_yield(plugin)
46
- Automatic::Pipeline.run(recipe).should == []
47
- end
48
- end
49
- end
50
-
51
- describe "in user dir" do
52
- before do
53
- Automatic.root_dir = APP_ROOT
54
- Automatic.user_dir = File.join(APP_ROOT, "spec/user_dir")
55
- end
56
-
57
- describe "#load_plugin" do
58
- it "correctly load module" do
59
- # StoreMock is the mock class that it return pipeline.
60
- mock = "StoreMock"
61
- Automatic::Pipeline.load_plugin mock
62
- klass = Automatic::Plugin.const_get(mock)
63
- klass.class.should == Class
64
- klass.new(nil, ["mock"]).run.should == "mock"
65
- end
66
- end
67
- end
68
- end
@@ -1,40 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Auaotmatic::Recipe
3
- # Author:: 774 <http://id774.net>
4
- # Created:: Jun 14, 2012
5
- # Updated:: Jun 14, 2012
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.join(File.dirname(__FILE__) ,'../../spec_helper'))
10
- require 'automatic'
11
- require 'automatic/recipe'
12
-
13
- TEST_RECIPE = File.expand_path(File.join(APP_ROOT, "spec",
14
- 'fixtures', 'sampleRecipe.yml'))
15
-
16
- describe Automatic::Recipe do
17
- describe "with recipe" do
18
- before do
19
- Automatic.root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../../"))
20
- Automatic.user_dir = nil
21
- end
22
-
23
- context "with a normal recipe" do
24
- subject {
25
- recipe = Automatic::Recipe.new(TEST_RECIPE)
26
- recipe.each_plugin{recipe}
27
- }
28
- let(:expected) { [{"module"=>"SubscriptionFeed",
29
- "config"=>{"feeds"=>["http://blog.id774.net/post/feed/"]}},
30
- {"module"=>"FilterIgnore", "config"=>{"link"=>["hoge"]}},
31
- {"module"=>"StorePermalink", "config"=>{"db"=>"test_permalink.db"}}]
32
- }
33
-
34
- it "correctly load recipe" do
35
- expect(subject).to eq expected
36
- end
37
- end
38
-
39
- end
40
- end