automatic 13.6.0 → 13.7.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.
@@ -1,66 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::GoogleReaderStar
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: Feb 10, 2013
6
- # Updated:: Jun 28, 2013
7
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
- # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
-
10
- module Automatic::Plugin
11
- class SubscriptionGoogleReaderStar
12
- require 'open-uri'
13
- require 'nokogiri'
14
- require 'rss'
15
-
16
- def initialize(config, pipeline=[])
17
- @config = config
18
- @pipeline = pipeline
19
- end
20
-
21
- def run
22
- @return_feeds = []
23
- @config['feeds'].each {|feed|
24
- retries = 0
25
- begin
26
- Automatic::Log.puts("info", "Parsing: #{feed}")
27
- @return_feeds << self.parse(Automatic::FeedParser.get(feed).items)
28
- rescue
29
- retries += 1
30
- Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}")
31
- sleep @config['interval'].to_i unless @config['interval'].nil?
32
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
33
- end
34
- }
35
- @return_feeds
36
- end
37
-
38
- def parse(feeds = [])
39
- RSS::Maker.make("2.0") {|maker|
40
- maker.xml_stylesheets.new_xml_stylesheet
41
- maker.channel.title = "Automatic Ruby"
42
- maker.channel.description = "Automatic Ruby"
43
- maker.channel.link = "https://github.com/automaticruby/automaticruby"
44
- maker.items.do_sort = true
45
-
46
- unless feeds.nil?
47
- feeds.each {|feed|
48
- unless feed.link.href.nil?
49
- Automatic::Log.puts("info", "Feed: #{feed.link.href}")
50
- item = maker.items.new_item
51
- item.title = feed.title.content # google reader feed
52
- item.link = feed.link.href # google reader feed
53
- begin
54
- item.description = feed.content
55
- item.date = feed.dc_date || Time.now
56
- rescue NoMethodError
57
- Automatic::Log.puts("warn", "Undefined field detected in feed.")
58
- end
59
- end
60
- }
61
- end
62
- }
63
- end
64
-
65
- end
66
- end
@@ -1,74 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::GoogleReaderStar
3
- # Author:: soramugi <http://soramugi.net>
4
- # 774 <http://id774.net>
5
- # Created:: Feb 10, 2013
6
- # Updated:: Feb 17, 2013
7
- # Copyright:: Copyright (c) 2012-2013 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 'subscription/google_reader_star'
13
-
14
- describe Automatic::Plugin::SubscriptionGoogleReaderStar do
15
- context "with empty feeds" do
16
- subject {
17
- Automatic::Plugin::SubscriptionGoogleReaderStar.new(
18
- { 'feeds' => [] }
19
- )
20
- }
21
-
22
- its(:run) { should be_empty }
23
- end
24
-
25
- context "with feeds whose invalid URL" do
26
- subject {
27
- Automatic::Plugin::SubscriptionGoogleReaderStar.new(
28
- { 'feeds' => ["invalid_url"] }
29
- )
30
- }
31
-
32
- its(:run) { should be_empty }
33
- end
34
-
35
- context "with feeds whose valid URL" do
36
- subject {
37
- Automatic::Plugin::SubscriptionGoogleReaderStar.new(
38
- { 'feeds' => [
39
- "http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred"]
40
- }
41
- )
42
- }
43
-
44
- its(:run) { should have(1).feed }
45
- end
46
-
47
- context "with retry to feeds whose valid URL" do
48
- subject {
49
- Automatic::Plugin::SubscriptionGoogleReaderStar.new(
50
- { 'feeds' => [
51
- "http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred"],
52
- 'retry' => 3,
53
- 'interval' => 5
54
- }
55
- )
56
- }
57
-
58
- its(:run) { should have(1).feed }
59
- end
60
-
61
- context "with retry to feeds whose invalid URL" do
62
- subject {
63
- Automatic::Plugin::SubscriptionGoogleReaderStar.new(
64
- { 'feeds' => ["invalid_url"],
65
- 'retry' => 1,
66
- 'interval' => 1
67
- }
68
- )
69
- }
70
-
71
- its(:run) { should be_empty }
72
- end
73
-
74
- end
@@ -1,32 +0,0 @@
1
- global:
2
- timezone: Asia/Tokyo
3
- cache:
4
- base: /tmp
5
- log:
6
- level: info
7
-
8
- plugins:
9
- - module: SubscriptionGoogleReaderStar
10
- config:
11
- feeds:
12
- - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred
13
-
14
- - module: SubscriptionGoogleReaderStar
15
- config:
16
- feeds:
17
- - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred
18
- internal: 1
19
-
20
- - module: SubscriptionGoogleReaderStar
21
- config:
22
- feeds:
23
- - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred
24
- internal: 5
25
- retry: 5
26
-
27
- - module: StorePermalink
28
- config:
29
- db: test_googlestar.db
30
-
31
- #- module: PublishConsole
32
-