automatic 13.2.0 → 13.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/README.md +15 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/automatic.gemspec +3 -5
- data/bin/automatic +104 -15
- data/doc/ChangeLog +9 -0
- data/doc/PLUGINS +4 -1
- data/doc/PLUGINS.ja +4 -1
- data/doc/README +27 -31
- data/doc/README.ja +24 -28
- data/lib/automatic/feed_parser.rb +1 -1
- data/lib/automatic.rb +3 -3
- data/plugins/filter/absolute_uri.rb +11 -10
- data/plugins/filter/full_feed.rb +16 -14
- data/plugins/filter/ignore.rb +18 -16
- data/plugins/filter/image.rb +14 -18
- data/plugins/filter/image_source.rb +11 -10
- data/plugins/filter/tumblr_resize.rb +11 -10
- data/plugins/notify/ikachan.rb +4 -4
- data/plugins/publish/google_calendar.rb +1 -1
- data/plugins/publish/hatena_bookmark.rb +15 -4
- data/plugins/publish/instapaper.rb +12 -3
- data/plugins/store/target_link.rb +1 -1
- data/plugins/subscription/feed.rb +1 -1
- data/plugins/subscription/google_reader_star.rb +9 -6
- data/plugins/subscription/link.rb +13 -12
- data/plugins/subscription/tumblr.rb +13 -12
- data/plugins/subscription/twitter.rb +19 -18
- data/script/build +14 -12
- data/spec/lib/automatic_spec.rb +3 -3
- data/spec/plugins/filter/full_feed_spec.rb +88 -5
- data/spec/plugins/filter/ignore_spec.rb +2 -1
- data/spec/plugins/filter/sort_spec.rb +1 -1
- data/spec/plugins/publish/hatena_bookmark_spec.rb +63 -1
- data/spec/plugins/publish/instapaper_spec.rb +18 -6
- data/spec/plugins/store/target_link_spec.rb +3 -3
- data/spec/plugins/subscription/feed_spec.rb +1 -1
- data/spec/plugins/subscription/google_reader_star_spec.rb +30 -1
- data/spec/plugins/subscription/link_spec.rb +1 -1
- data/spec/plugins/subscription/tumblr_spec.rb +1 -1
- data/spec/plugins/subscription/twitter_spec.rb +1 -1
- data/spec/spec_helper.rb +13 -3
- data/test/integration/test_googlestar.yml +13 -0
- metadata +2 -5
- data/bin/automatic-config +0 -111
- data/script/bootstrap +0 -117
data/plugins/filter/ignore.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Filter::Ignore
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 22, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -13,6 +13,22 @@ module Automatic::Plugin
|
|
13
13
|
@pipeline = pipeline
|
14
14
|
end
|
15
15
|
|
16
|
+
def run
|
17
|
+
@return_feeds = []
|
18
|
+
@pipeline.each {|feeds|
|
19
|
+
new_feeds = []
|
20
|
+
unless feeds.nil?
|
21
|
+
feeds.items.each {|items|
|
22
|
+
new_feeds << items if exclude(items) == false
|
23
|
+
}
|
24
|
+
end
|
25
|
+
@return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0
|
26
|
+
}
|
27
|
+
@return_feeds
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
16
32
|
def exclude(items)
|
17
33
|
detection = false
|
18
34
|
unless @config['link'].nil?
|
@@ -33,19 +49,5 @@ module Automatic::Plugin
|
|
33
49
|
end
|
34
50
|
detection
|
35
51
|
end
|
36
|
-
|
37
|
-
def run
|
38
|
-
@return_feeds = []
|
39
|
-
@pipeline.each {|feeds|
|
40
|
-
new_feeds = []
|
41
|
-
unless feeds.nil?
|
42
|
-
feeds.items.each {|items|
|
43
|
-
new_feeds << items if exclude(items) == false
|
44
|
-
}
|
45
|
-
end
|
46
|
-
@return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0
|
47
|
-
}
|
48
|
-
@return_feeds
|
49
|
-
end
|
50
52
|
end
|
51
53
|
end
|
data/plugins/filter/image.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Filter::Image
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Sep 18, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -20,27 +20,23 @@ module Automatic::Plugin
|
|
20
20
|
return_feed_items = []
|
21
21
|
unless feeds.nil?
|
22
22
|
feeds.items.each {|feed|
|
23
|
-
unless feed.link.nil?
|
24
|
-
image_link = nil
|
25
|
-
feed.link.scan(/(.*?\.jp.*g$)/i) { |matched|
|
26
|
-
image_link = matched.join(" ")
|
27
|
-
}
|
28
|
-
feed.link.scan(/(.*?\.png$)/i) { |matched|
|
29
|
-
image_link = matched.join(" ")
|
30
|
-
}
|
31
|
-
feed.link.scan(/(.*?\.gif$)/i) { |matched|
|
32
|
-
image_link = matched.join(" ")
|
33
|
-
}
|
34
|
-
feed.link.scan(/(.*?\.tiff$)/i) { |matched|
|
35
|
-
image_link = matched.join(" ")
|
36
|
-
}
|
37
|
-
feed.link = image_link
|
38
|
-
end
|
23
|
+
feed.link = image?(feed.link) unless feed.link.nil?
|
39
24
|
}
|
40
25
|
@return_feeds << feeds
|
41
26
|
end
|
42
27
|
}
|
43
28
|
@return_feeds
|
44
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def image?(link)
|
33
|
+
case link
|
34
|
+
when /\.jpe?g\Z/i then link
|
35
|
+
when /\.gif\Z/i then link
|
36
|
+
when /\.png\Z/i then link
|
37
|
+
when /\.tiff\Z/i then link
|
38
|
+
else nil
|
39
|
+
end
|
40
|
+
end
|
45
41
|
end
|
46
42
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Filter::ImageSource
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 28, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -16,14 +16,6 @@ module Automatic::Plugin
|
|
16
16
|
@pipeline = pipeline
|
17
17
|
end
|
18
18
|
|
19
|
-
def rewrite_link(string)
|
20
|
-
array = Array.new
|
21
|
-
string.scan(/<img src="(.*?)"/) { |matched|
|
22
|
-
array = array | matched
|
23
|
-
}
|
24
|
-
array
|
25
|
-
end
|
26
|
-
|
27
19
|
def run
|
28
20
|
@return_feeds = []
|
29
21
|
@pipeline.each {|feeds|
|
@@ -42,5 +34,14 @@ module Automatic::Plugin
|
|
42
34
|
}
|
43
35
|
@return_feeds
|
44
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def rewrite_link(string)
|
40
|
+
array = Array.new
|
41
|
+
string.scan(/<img src="(.*?)"/) { |matched|
|
42
|
+
array = array | matched
|
43
|
+
}
|
44
|
+
array
|
45
|
+
end
|
45
46
|
end
|
46
47
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Filter::TumblrResize
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 28, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -14,14 +14,6 @@ module Automatic::Plugin
|
|
14
14
|
@pipeline = pipeline
|
15
15
|
end
|
16
16
|
|
17
|
-
def resize(string)
|
18
|
-
string = string.gsub("_75sq\.", "_1280\.")
|
19
|
-
string = string.gsub("_100\.", "_1280\.")
|
20
|
-
string = string.gsub("_250\.", "_1280\.")
|
21
|
-
string = string.gsub("_400\.", "_1280\.")
|
22
|
-
string = string.gsub("_500\.", "_1280\.")
|
23
|
-
end
|
24
|
-
|
25
17
|
def run
|
26
18
|
@return_feeds = []
|
27
19
|
@pipeline.each {|feeds|
|
@@ -35,5 +27,14 @@ module Automatic::Plugin
|
|
35
27
|
}
|
36
28
|
@return_feeds
|
37
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def resize(string)
|
33
|
+
string = string.gsub("_75sq\.", "_1280\.")
|
34
|
+
string = string.gsub("_100\.", "_1280\.")
|
35
|
+
string = string.gsub("_250\.", "_1280\.")
|
36
|
+
string = string.gsub("_400\.", "_1280\.")
|
37
|
+
string = string.gsub("_500\.", "_1280\.")
|
38
|
+
end
|
38
39
|
end
|
39
40
|
end
|
data/plugins/notify/ikachan.rb
CHANGED
@@ -20,10 +20,6 @@ module Automatic::Plugin
|
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
-
def endpoint_url
|
24
|
-
"#{@params['url']}:#{@params['port']}/#{@params['command']}"
|
25
|
-
end
|
26
|
-
|
27
23
|
def post(link, title = "")
|
28
24
|
message = build_message(link, title)
|
29
25
|
uri = URI.parse(endpoint_url)
|
@@ -45,6 +41,10 @@ module Automatic::Plugin
|
|
45
41
|
|
46
42
|
private
|
47
43
|
|
44
|
+
def endpoint_url
|
45
|
+
"#{@params['url']}:#{@params['port']}/#{@params['command']}"
|
46
|
+
end
|
47
|
+
|
48
48
|
def build_message(link, title)
|
49
49
|
message = ""
|
50
50
|
message += "#{title.to_s} - " unless title.blank?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 24, 2012
|
5
5
|
# Updated:: Jan 8, 2013
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Publish::HatenaBookmark
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 22, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Mar 7, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -49,6 +49,7 @@ module Automatic::Plugin
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def post(b_url, b_comment)
|
52
|
+
Automatic::Log.puts("info", "Bookmarking: #{b_url}")
|
52
53
|
url = "http://b.hatena.ne.jp/atom/post"
|
53
54
|
header = wsse(@user["hatena_id"], @user["password"])
|
54
55
|
uri = URI.parse(url)
|
@@ -87,13 +88,23 @@ module Automatic::Plugin
|
|
87
88
|
@pipeline.each {|feeds|
|
88
89
|
unless feeds.nil?
|
89
90
|
feeds.items.each {|feed|
|
90
|
-
|
91
|
-
hb.post(feed.link, nil)
|
91
|
+
hb.post(rewrite(feed.link), nil)
|
92
92
|
sleep @config['interval'].to_i unless @config['interval'].nil?
|
93
93
|
}
|
94
94
|
end
|
95
95
|
}
|
96
96
|
@pipeline
|
97
97
|
end
|
98
|
+
|
99
|
+
private
|
100
|
+
def rewrite(string)
|
101
|
+
if /^https?:\/\/.*$/ =~ string
|
102
|
+
return string
|
103
|
+
elsif /^\/\/.*$/ =~ string
|
104
|
+
return "http:" + string
|
105
|
+
else
|
106
|
+
return "http://" + string
|
107
|
+
end
|
108
|
+
end
|
98
109
|
end
|
99
110
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Name:: Automatic::Plugin::Publish::Instapaper
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
4
|
-
#
|
5
|
-
#
|
4
|
+
# 774 <http://id774.net>
|
5
|
+
# Created:: Feb 9, 2013
|
6
|
+
# Updated:: Mar 23, 2013
|
6
7
|
# Copyright:: soramugi Copyright (c) 2013
|
7
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
9
|
|
@@ -66,7 +67,15 @@ module Automatic::Plugin
|
|
66
67
|
unless feeds.nil?
|
67
68
|
feeds.items.each {|feed|
|
68
69
|
Automatic::Log.puts("info", "add: #{feed.link}")
|
69
|
-
|
70
|
+
retries = 0
|
71
|
+
begin
|
72
|
+
instapaper.add(feed.link, feed.title, feed.description)
|
73
|
+
rescue
|
74
|
+
retries += 1
|
75
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to instapaper.")
|
76
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
77
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
78
|
+
end
|
70
79
|
sleep @config['interval'].to_i unless @config['interval'].nil?
|
71
80
|
}
|
72
81
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Author:: 774 <http://id774.net>
|
5
5
|
# Created:: Feb 28, 2012
|
6
6
|
# Updated:: Feb 9, 2013
|
7
|
-
# Copyright:: 774 Copyright (c) 2012
|
7
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
9
|
|
10
10
|
require 'open-uri'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Feb 22, 2012
|
5
5
|
# Updated:: Feb 8, 2013
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Name:: Automatic::Plugin::Subscription::GoogleReaderStar
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# 774 <http://id774.net>
|
4
5
|
# Created:: Feb 10, 2013
|
5
|
-
# Updated:: Feb
|
6
|
+
# Updated:: Feb 17, 2013
|
6
7
|
# Copyright:: soramugi Copyright (c) 2013
|
7
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
9
|
|
@@ -20,11 +21,15 @@ module Automatic::Plugin
|
|
20
21
|
def run
|
21
22
|
@return_feeds = []
|
22
23
|
@config['feeds'].each {|feed|
|
24
|
+
retries = 0
|
23
25
|
begin
|
24
26
|
Automatic::Log.puts("info", "Parsing: #{feed}")
|
25
27
|
@return_feeds << self.parse(Automatic::FeedParser.get(feed).items)
|
26
28
|
rescue
|
27
|
-
|
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?
|
28
33
|
end
|
29
34
|
}
|
30
35
|
@return_feeds
|
@@ -46,10 +51,8 @@ module Automatic::Plugin
|
|
46
51
|
item.title = feed.title.content # google reader feed
|
47
52
|
item.link = feed.link.href # google reader feed
|
48
53
|
begin
|
49
|
-
item.description = feed.
|
50
|
-
item.
|
51
|
-
item.comments = feed.comments
|
52
|
-
item.date = feed.pubDate || Time.now
|
54
|
+
item.description = feed.content
|
55
|
+
item.date = feed.dc_date || Time.now
|
53
56
|
rescue NoMethodError
|
54
57
|
Automatic::Log.puts("warn", "Undefined field detected in feed.")
|
55
58
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Subscription::Link
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Sep 18, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -17,16 +17,6 @@ module Automatic::Plugin
|
|
17
17
|
@pipeline = pipeline
|
18
18
|
end
|
19
19
|
|
20
|
-
def create_rss(url)
|
21
|
-
Automatic::Log.puts("info", "Parsing: #{url}")
|
22
|
-
html = open(url).read
|
23
|
-
unless html.nil?
|
24
|
-
rss = Automatic::FeedParser.parse(html)
|
25
|
-
sleep @config['interval'].to_i unless @config['interval'].nil?
|
26
|
-
@return_feeds << rss
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
20
|
def run
|
31
21
|
@return_feeds = []
|
32
22
|
@config['urls'].each {|url|
|
@@ -42,5 +32,16 @@ module Automatic::Plugin
|
|
42
32
|
}
|
43
33
|
@return_feeds
|
44
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def create_rss(url)
|
38
|
+
Automatic::Log.puts("info", "Parsing: #{url}")
|
39
|
+
html = open(url).read
|
40
|
+
unless html.nil?
|
41
|
+
rss = Automatic::FeedParser.parse(html)
|
42
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
43
|
+
@return_feeds << rss
|
44
|
+
end
|
45
|
+
end
|
45
46
|
end
|
46
47
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Subscription::Tumblr
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Oct 16, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -15,16 +15,6 @@ module Automatic::Plugin
|
|
15
15
|
@pipeline = pipeline
|
16
16
|
end
|
17
17
|
|
18
|
-
def create_rss(url)
|
19
|
-
Automatic::Log.puts("info", "Parsing: #{url}")
|
20
|
-
html = open(url).read
|
21
|
-
unless html.nil?
|
22
|
-
rss = Automatic::FeedParser.parse(html)
|
23
|
-
sleep @config['interval'].to_i unless @config['interval'].nil?
|
24
|
-
@return_feeds << rss
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
18
|
def run
|
29
19
|
@return_feeds = []
|
30
20
|
@config['urls'].each {|url|
|
@@ -48,5 +38,16 @@ module Automatic::Plugin
|
|
48
38
|
}
|
49
39
|
@return_feeds
|
50
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def create_rss(url)
|
44
|
+
Automatic::Log.puts("info", "Parsing: #{url}")
|
45
|
+
html = open(url).read
|
46
|
+
unless html.nil?
|
47
|
+
rss = Automatic::FeedParser.parse(html)
|
48
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
49
|
+
@return_feeds << rss
|
50
|
+
end
|
51
|
+
end
|
51
52
|
end
|
52
53
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# Name:: Automatic::Plugin::Subscription::Twitter
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Sep 9, 2012
|
5
|
-
# Updated::
|
6
|
-
# Copyright:: 774 Copyright (c) 2012
|
5
|
+
# Updated:: Apr 5, 2013
|
6
|
+
# Copyright:: 774 Copyright (c) 2012-2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Automatic::Plugin
|
@@ -17,6 +17,23 @@ module Automatic::Plugin
|
|
17
17
|
@pipeline = pipeline
|
18
18
|
end
|
19
19
|
|
20
|
+
def run
|
21
|
+
@return_feeds = []
|
22
|
+
@config['urls'].each {|url|
|
23
|
+
retries = 0
|
24
|
+
begin
|
25
|
+
create_rss(url)
|
26
|
+
rescue
|
27
|
+
retries += 1
|
28
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
|
29
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
30
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
31
|
+
end
|
32
|
+
}
|
33
|
+
@return_feeds
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
20
37
|
def create_rss(url)
|
21
38
|
Automatic::Log.puts("info", "Parsing: #{url}")
|
22
39
|
html = open(url).read
|
@@ -46,21 +63,5 @@ module Automatic::Plugin
|
|
46
63
|
@return_feeds << rss
|
47
64
|
end
|
48
65
|
end
|
49
|
-
|
50
|
-
def run
|
51
|
-
@return_feeds = []
|
52
|
-
@config['urls'].each {|url|
|
53
|
-
retries = 0
|
54
|
-
begin
|
55
|
-
create_rss(url)
|
56
|
-
rescue
|
57
|
-
retries += 1
|
58
|
-
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
|
59
|
-
sleep @config['interval'].to_i unless @config['interval'].nil?
|
60
|
-
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
61
|
-
end
|
62
|
-
}
|
63
|
-
@return_feeds
|
64
|
-
end
|
65
66
|
end
|
66
67
|
end
|
data/script/build
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
#
|
7
7
|
# Maintainer: id774 <idnanashi@gmail.com>
|
8
8
|
#
|
9
|
+
# v1.3 2/26,2013
|
10
|
+
# Remove script/bootstrap.
|
9
11
|
# v1.2 6/16,2012
|
10
12
|
# Add all option for integration tests.
|
11
13
|
# v1.1 6/14,2012
|
@@ -19,20 +21,20 @@ kickstart() {
|
|
19
21
|
export RACK_ENV="test"
|
20
22
|
export DATABASE_URL="$RACK_ROOT/db"
|
21
23
|
ruby -v
|
22
|
-
|
24
|
+
test_subcommand log info started.
|
23
25
|
}
|
24
26
|
|
25
27
|
exec_rspec() {
|
26
28
|
$RACK_ROOT/bin/automatic -v
|
27
|
-
|
28
|
-
bundle exec
|
29
|
+
bundle install --path vendor/gems
|
30
|
+
bundle exec rake simplecov
|
29
31
|
}
|
30
32
|
|
31
33
|
run_test() {
|
32
34
|
while [ $# -gt 0 ]
|
33
35
|
do
|
34
36
|
$RACK_ROOT/bin/automatic -c $1
|
35
|
-
|
37
|
+
test_subcommand log info $?
|
36
38
|
shift
|
37
39
|
done
|
38
40
|
}
|
@@ -45,21 +47,21 @@ load_tests() {
|
|
45
47
|
unset YAML_FILE
|
46
48
|
}
|
47
49
|
|
48
|
-
|
49
|
-
$RACK_ROOT/bin/automatic
|
50
|
+
test_subcommand() {
|
51
|
+
$RACK_ROOT/bin/automatic $*
|
50
52
|
}
|
51
53
|
|
52
54
|
test_scaffold() {
|
53
|
-
|
54
|
-
|
55
|
+
test_subcommand scaffold
|
56
|
+
test_subcommand unscaffold
|
55
57
|
}
|
56
58
|
|
57
59
|
added_tests() {
|
58
60
|
test -f $HOME/.automatic || test_scaffold
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
test_subcommand autodiscovery http://blog.id774.net/blogs/
|
62
|
+
test_subcommand opmlparser "$RACK_ROOT/test/fixtures/sampleOPML.xml"
|
63
|
+
test_subcommand feedparser http://blog.id774.net/blogs/feed/ > /dev/null
|
64
|
+
test_subcommand log info finished.
|
63
65
|
}
|
64
66
|
|
65
67
|
integration() {
|
data/spec/lib/automatic_spec.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# Author:: kzgs
|
4
4
|
# 774 <http://id774.net>
|
5
5
|
# Created:: Mar 9, 2012
|
6
|
-
# Updated::
|
7
|
-
# Copyright:: kzgs Copyright (c) 2012
|
6
|
+
# Updated:: Apr 10, 2013
|
7
|
+
# Copyright:: kzgs Copyright (c) 2012-2013
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
9
|
|
10
10
|
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
|
@@ -26,7 +26,7 @@ describe Automatic do
|
|
26
26
|
|
27
27
|
describe "#version" do
|
28
28
|
specify {
|
29
|
-
Automatic.const_get(:VERSION).should == "13.
|
29
|
+
Automatic.const_get(:VERSION).should == "13.4.1"
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|