automatic 12.10.0 → 13.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 12.10.0
1
+ 13.1.0
data/automatic.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "automatic"
8
- s.version = "12.10.0"
8
+ s.version = "13.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["id774"]
12
- s.date = "2012-10-16"
12
+ s.date = "2013-01-08"
13
13
  s.description = "Ruby General Automation Framework"
14
14
  s.email = "idnanashi@gmail.com"
15
15
  s.executables = ["automatic", "automatic-config"]
data/bin/automatic-config CHANGED
@@ -4,7 +4,7 @@
4
4
  # Author:: kzgs
5
5
  # 774 <http://id774.net>
6
6
  # Created:: Mar 11, 2012
7
- # Updated:: Jun 17, 2012
7
+ # Updated:: Dec 20, 2012
8
8
  # Copyright:: kzgs Copyright (c) 2012
9
9
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
10
10
 
@@ -62,7 +62,7 @@ subparsers = {
62
62
  'feedparser' => lambda { |argv|
63
63
  require 'automatic/feed_parser'
64
64
  url = argv.shift || abort_with_usage("feedparser", "<url>")
65
- rss_results = Automatic::FeedParser.get_rss(url)
65
+ rss_results = Automatic::FeedParser.get(url)
66
66
  pp rss_results
67
67
  },
68
68
  'inspect' => lambda { |argv|
@@ -70,7 +70,7 @@ subparsers = {
70
70
  url = argv.shift || abort_with_usage("inspect", "<url>")
71
71
  feeds = Feedbag.find(url)
72
72
  pp feeds
73
- rss_results = Automatic::FeedParser.get_rss(feeds.pop)
73
+ rss_results = Automatic::FeedParser.get(feeds.pop)
74
74
  pp rss_results
75
75
  },
76
76
  'opmlparser' => lambda { |argv|
data/doc/AUTHORS CHANGED
@@ -4,3 +4,4 @@ daic-h
4
4
  ainame
5
5
  banyan
6
6
  hsbt
7
+ soramugi
data/doc/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ === 13.1.0 / 2013-01-08
2
+
3
+ * Fix interval bugs.
4
+
5
+ * Improvement timing of logging (But still the way).
6
+
7
+ * Only new feed return feeds.
8
+
9
+ * Refactoring.
10
+
11
+
1
12
  === 12.10.0 / 2012-10-16
2
13
 
3
14
  * Added new plug-in.
data/doc/PLUGINS CHANGED
@@ -32,6 +32,7 @@ SubscriptionLink
32
32
  urls:
33
33
  - URL
34
34
  - URL ...
35
+ interval: INTERVAL_FOR_SCRAPING (in seconds.)
35
36
 
36
37
 
37
38
  SubscriptionTwitter
@@ -48,6 +49,7 @@ SubscriptionTwitter
48
49
  urls:
49
50
  - URL
50
51
  - URL ...
52
+ interval: INTERVAL_FOR_SCRAPING (in seconds.)
51
53
 
52
54
 
53
55
  SubscriptionTumblr
@@ -66,6 +68,7 @@ SubscriptionTumblr
66
68
  - URL
67
69
  - URL ...
68
70
  pages: PAGES
71
+ interval: INTERVAL_FOR_SCRAPING (in seconds.)
69
72
 
70
73
 
71
74
  FilterReverse
data/doc/PLUGINS.ja CHANGED
@@ -32,6 +32,7 @@ SubscriptionLink
32
32
  urls:
33
33
  - URL
34
34
  - URL ...
35
+ interval: スクレイピングの間隔 (秒数, 省略可)
35
36
 
36
37
 
37
38
  SubscriptionTwitter
@@ -48,6 +49,7 @@ SubscriptionTwitter
48
49
  urls:
49
50
  - URL
50
51
  - URL ...
52
+ interval: スクレイピングの間隔 (秒数, 省略可)
51
53
 
52
54
 
53
55
  SubscriptionTumblr
@@ -66,6 +68,7 @@ SubscriptionTumblr
66
68
  - URL
67
69
  - URL ...
68
70
  pages: PAGES
71
+ interval: スクレイピングの間隔 (秒数, 省略可)
69
72
 
70
73
 
71
74
  FilterReverse
data/lib/automatic.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 18, 2012
5
- # Updated:: Oct 16, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -13,7 +13,7 @@ module Automatic
13
13
  require 'automatic/log'
14
14
  require 'automatic/feed_parser'
15
15
 
16
- VERSION = "12.10.0"
16
+ VERSION = "13.1.0"
17
17
  USER_DIR = "/.automatic"
18
18
 
19
19
  class << self
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::FeedParser
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 19, 2012
5
- # Updated:: Mar 11, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -10,10 +10,12 @@ module Automatic
10
10
  module FeedParser
11
11
  require 'rss'
12
12
  require 'uri'
13
+ require 'nokogiri'
13
14
 
14
- def self.get_rss(url)
15
+ def self.get(url)
15
16
  begin
16
17
  unless url.nil?
18
+ Automatic::Log.puts("info", "Parsing: #{url}")
17
19
  feed = URI.parse(url).normalize
18
20
  open(feed) {|http|
19
21
  response = http.read
@@ -24,5 +26,56 @@ module Automatic
24
26
  raise e
25
27
  end
26
28
  end
29
+
30
+ def self.create(feeds = [])
31
+ RSS::Maker.make("2.0") {|maker|
32
+ xss = maker.xml_stylesheets.new_xml_stylesheet
33
+ maker.channel.title = "Automatic Ruby"
34
+ maker.channel.description = "Automatic Ruby"
35
+ maker.channel.link = "https://github.com/id774/automaticruby"
36
+ maker.items.do_sort = true
37
+
38
+ unless feeds.nil?
39
+ feeds.each {|feed|
40
+ unless feed.link.nil?
41
+ Automatic::Log.puts("info", "Creating: #{feed.link}")
42
+ item = maker.items.new_item
43
+ item.title = feed.title
44
+ item.link = feed.link
45
+ begin
46
+ item.description = feed.description
47
+ item.author = feed.author
48
+ item.comments = feed.comments
49
+ item.date = feed.pubDate || Time.now
50
+ rescue NoMethodError
51
+ Automatic::Log.puts("warn", "Undefined field detected in feed.")
52
+ end
53
+ end
54
+ }
55
+ end
56
+ }
57
+ end
58
+
59
+ def self.parse(html)
60
+ RSS::Maker.make("2.0") {|maker|
61
+ xss = maker.xml_stylesheets.new_xml_stylesheet
62
+ maker.channel.title = "Automatic Ruby"
63
+ maker.channel.description = "Automatic Ruby"
64
+ maker.channel.link = "https://github.com/id774/automaticruby"
65
+ maker.items.do_sort = true
66
+
67
+ doc = Nokogiri::HTML(html)
68
+ (doc/:a).each {|link|
69
+ unless link[:href].nil?
70
+ item = maker.items.new_item
71
+ item.title = "Automatic Ruby"
72
+ item.link = link[:href]
73
+ item.date = Time.now
74
+ item.description = ""
75
+ end
76
+ }
77
+ }
78
+ end
79
+
27
80
  end
28
81
  end
@@ -75,7 +75,7 @@ module Automatic::Plugin
75
75
  feeds.items.each {|feed|
76
76
  Automatic::Log.puts("info", %Q(Ikachan: [#{feed.link}] sending with params #{ikachan.params.to_s}...))
77
77
  ikachan.post(feed.link, feed.title)
78
- sleep @config['interval'].to_i
78
+ sleep @config['interval'].to_i unless @config['interval'].nil?
79
79
  }
80
80
  end
81
81
  }
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Publish::Googlecalendar
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 24, 2012
5
- # Updated:: Feb 24, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -74,7 +74,7 @@ module Automatic::Plugin
74
74
  unless feeds.nil?
75
75
  feeds.items.each {|feed|
76
76
  @gc.add('今日 ' + feed.title)
77
- sleep @config['interval'].to_i
77
+ sleep @config['interval'].to_i unless @config['interval'].nil?
78
78
  }
79
79
  end
80
80
  }
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Publish::HatenaBookmark
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 22, 2012
5
- # Updated:: Mar 12, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -89,7 +89,7 @@ module Automatic::Plugin
89
89
  feeds.items.each {|feed|
90
90
  Automatic::Log.puts("info", "Bookmarking: #{feed.link}")
91
91
  hb.post(feed.link, nil)
92
- sleep @config['interval'].to_i
92
+ sleep @config['interval'].to_i unless @config['interval'].nil?
93
93
  }
94
94
  end
95
95
  }
@@ -2,8 +2,9 @@
2
2
  # Name:: Automatic::Plugin::Store::Database
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
+ # soramugi <http://soramugi.net>
5
6
  # Created:: Feb 27, 2012
6
- # Updated:: Sep 18, 2012
7
+ # Updated:: Dec 20, 2012
7
8
  # Copyright:: kzgs Copyright (c) 2012
8
9
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
10
 
@@ -15,18 +16,18 @@ module Automatic::Plugin
15
16
  prepare_database
16
17
  existing_records = model_class.find(:all)
17
18
  @return_feeds = []
18
- @pipeline.each { |feeds|
19
+ @pipeline.each {|feeds|
19
20
  unless feeds.nil?
20
- new_feed = false
21
- feeds.items.each { |feed|
21
+ new_feeds = []
22
+ feeds.items.each {|feed|
22
23
  unless feed.link.nil?
23
- unless existing_records.detect { |b| b.try(unique_key) == feed.link }
24
+ unless existing_records.detect {|b| b.try(unique_key) == feed.link }
24
25
  yield(feed)
25
- new_feed = true
26
+ new_feeds << feed
26
27
  end
27
28
  end
28
29
  }
29
- @return_feeds << feeds if new_feed
30
+ @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0
30
31
  end
31
32
  }
32
33
  @return_feeds
@@ -35,8 +36,8 @@ module Automatic::Plugin
35
36
  private
36
37
 
37
38
  def create_table
38
- ActiveRecord::Migration.create_table(model_class.table_name) { |t|
39
- column_definition.each_pair { |column_name, column_type|
39
+ ActiveRecord::Migration.create_table(model_class.table_name) {|t|
40
+ column_definition.each_pair {|column_name, column_type|
40
41
  t.column column_name, column_type
41
42
  }
42
43
  }
@@ -40,6 +40,7 @@ module Automatic::Plugin
40
40
 
41
41
  def run
42
42
  for_each_new_feed { |feed|
43
+ Automatic::Log.puts("info", "Saving: #{feed.link}")
43
44
  begin
44
45
  Blog.create(
45
46
  :title => feed.title,
@@ -47,7 +48,6 @@ module Automatic::Plugin
47
48
  :description => feed.description,
48
49
  :content => feed.content_encoded,
49
50
  :created_at => Time.now.strftime("%Y/%m/%d %X"))
50
- Automatic::Log.puts("info", "Saving: #{feed.link}")
51
51
  rescue
52
52
  Automatic::Log.puts("warn", "Skip feed due to fault in save.")
53
53
  end
@@ -3,7 +3,7 @@
3
3
  # Name:: Automatic::Plugin::Store::TargetLink
4
4
  # Author:: 774 <http://id774.net>
5
5
  # Created:: Feb 28, 2012
6
- # Updated:: Mar 1, 2012
6
+ # Updated:: Jan 8, 2013
7
7
  # Copyright:: 774 Copyright (c) 2012
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
@@ -30,14 +30,14 @@ module Automatic::Plugin
30
30
  @pipeline.each {|feeds|
31
31
  unless feeds.nil?
32
32
  feeds.items.each {|feed|
33
- begin
34
- unless feed.link.nil?
35
- Automatic::Log.puts("info", "Get: #{feed.link}")
33
+ unless feed.link.nil?
34
+ Automatic::Log.puts("info", "Downloading: #{feed.link}")
35
+ begin
36
36
  wget(feed.link)
37
- sleep @config['interval'].to_i
37
+ sleep @config['interval'].to_i unless @config['interval'].nil?
38
+ rescue
39
+ Automatic::Log.puts("error", "Error found during file download.")
38
40
  end
39
- rescue
40
- Automatic::Log.puts("error", "Error found during file download.")
41
41
  end
42
42
  }
43
43
  end
@@ -16,8 +16,7 @@ module Automatic::Plugin
16
16
  def run
17
17
  @config['feeds'].each {|feed|
18
18
  begin
19
- Automatic::Log.puts("info", "Parsing: #{feed}")
20
- rss = Automatic::FeedParser.get_rss(feed)
19
+ rss = Automatic::FeedParser.get(feed)
21
20
  @pipeline << rss
22
21
  rescue
23
22
  Automatic::Log.puts("error", "Fault in parsing: #{feed}")
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Link
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 18, 2012
5
- # Updated:: Oct 16, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -21,25 +21,8 @@ module Automatic::Plugin
21
21
  Automatic::Log.puts("info", "Parsing: #{url}")
22
22
  html = open(url).read
23
23
  unless html.nil?
24
- rss = RSS::Maker.make("2.0") {|maker|
25
- xss = maker.xml_stylesheets.new_xml_stylesheet
26
- xss.href = "http://www.rssboard.org/rss-specification"
27
- maker.channel.about = "http://feeds.rssboard.org/rssboard"
28
- maker.channel.title = "Automatic Ruby"
29
- maker.channel.description = "Automatic Ruby"
30
- maker.channel.link = "http://www.rssboard.org/rss-specification"
31
- maker.items.do_sort = true
32
- doc = Nokogiri::HTML(html)
33
- (doc/:a).each {|link|
34
- unless link[:href].nil?
35
- item = maker.items.new_item
36
- item.title = "Automatic Ruby"
37
- item.link = link[:href]
38
- item.date = Time.now
39
- item.description = "Automatic::Plugin::Subscription::Link"
40
- end
41
- }
42
- }
24
+ rss = Automatic::FeedParser.parse(html)
25
+ sleep @config['interval'].to_i unless @config['interval'].nil?
43
26
  @return_feeds << rss
44
27
  end
45
28
  end
@@ -2,15 +2,13 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Tumblr
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Oct 16, 2012
5
- # Updated:: Oct 16, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
10
10
  class SubscriptionTumblr
11
11
  require 'open-uri'
12
- require 'nokogiri'
13
- require 'rss'
14
12
 
15
13
  def initialize(config, pipeline=[])
16
14
  @config = config
@@ -21,25 +19,8 @@ module Automatic::Plugin
21
19
  Automatic::Log.puts("info", "Parsing: #{url}")
22
20
  html = open(url).read
23
21
  unless html.nil?
24
- rss = RSS::Maker.make("2.0") {|maker|
25
- xss = maker.xml_stylesheets.new_xml_stylesheet
26
- xss.href = "http://www.rssboard.org/rss-specification"
27
- maker.channel.about = "http://feeds.rssboard.org/rssboard"
28
- maker.channel.title = "Automatic Ruby"
29
- maker.channel.description = "Automatic Ruby"
30
- maker.channel.link = "http://www.rssboard.org/rss-specification"
31
- maker.items.do_sort = true
32
- doc = Nokogiri::HTML(html)
33
- (doc/:a).each {|link|
34
- unless link[:href].nil?
35
- item = maker.items.new_item
36
- item.title = "Automatic Ruby"
37
- item.link = link[:href]
38
- item.date = Time.now
39
- item.description = "Automatic::Plugin::Subscription::Link"
40
- end
41
- }
42
- }
22
+ rss = Automatic::FeedParser.parse(html)
23
+ sleep @config['interval'].to_i unless @config['interval'].nil?
43
24
  @return_feeds << rss
44
25
  end
45
26
  end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Twitter
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 9, 2012
5
- # Updated:: Oct 16, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -42,6 +42,7 @@ module Automatic::Plugin
42
42
  item.description = content.search('[@class="js-tweet-text"]').text.to_s
43
43
  }
44
44
  }
45
+ sleep @config['interval'].to_i unless @config['interval'].nil?
45
46
  @return_feeds << rss
46
47
  end
47
48
  end
@@ -3,7 +3,7 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 9, 2012
6
- # Updated:: Oct 16, 2012
6
+ # Updated:: Jan 8, 2013
7
7
  # Copyright:: kzgs Copyright (c) 2012
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
@@ -26,7 +26,7 @@ describe Automatic do
26
26
 
27
27
  describe "#version" do
28
28
  specify {
29
- Automatic.const_get(:VERSION).should == "12.10.0"
29
+ Automatic.const_get(:VERSION).should == "13.1.0"
30
30
  }
31
31
  end
32
32
 
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::CustomFeed::SVNFLog
3
3
  # Author:: kzgs
4
4
  # Created:: Feb 29, 2012
5
- # Updated:: Mar 3, 2012
5
+ # Updated:: Nov 3, 2012
6
6
  # Copyright:: kzgs Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -15,7 +15,7 @@ describe Automatic::Plugin::CustomFeedSVNLog do
15
15
  subject {
16
16
  Automatic::Plugin::CustomFeedSVNLog.new(
17
17
  {
18
- 'target' => 'http://redmine.rubyforge.org/svn',
18
+ 'target' => 'http://svn.apache.org/repos/asf/',
19
19
  'fetch_items' => 2
20
20
  })
21
21
  }
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Store::Permalink
3
3
  # Author:: 774 <http://id774.net>
4
- # Updated:: Sep 18, 2012
4
+ # Updated:: Dec 17, 2012
5
5
  # Copyright:: 774 Copyright (c) 2012
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
@@ -11,14 +11,11 @@ require 'store/permalink'
11
11
  require 'pathname'
12
12
 
13
13
  describe Automatic::Plugin::StorePermalink do
14
- before do
14
+ it "should store 1 record for the new link" do
15
15
  @db_filename = "test_permalink.db"
16
16
  db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
17
17
  db_path.delete if db_path.exist?
18
18
  Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
19
- end
20
-
21
- it "should store 1 record for the new link" do
22
19
  instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
23
20
  AutomaticSpec.generate_pipeline {
24
21
  feed { item "http://github.com" }
@@ -30,6 +27,10 @@ describe Automatic::Plugin::StorePermalink do
30
27
  end
31
28
 
32
29
  it "should not store record for the existent link" do
30
+ @db_filename = "test_permalink.db"
31
+ db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
32
+ db_path.delete if db_path.exist?
33
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
33
34
  instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
34
35
  AutomaticSpec.generate_pipeline {
35
36
  feed { item "http://github.com" }
@@ -43,6 +44,10 @@ describe Automatic::Plugin::StorePermalink do
43
44
  end
44
45
 
45
46
  it "should be considered the case of the feed link nil" do
47
+ @db_filename = "test_permalink.db"
48
+ db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
49
+ db_path.delete if db_path.exist?
50
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
46
51
  instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
47
52
  AutomaticSpec.generate_pipeline {
48
53
  feed {
@@ -68,6 +73,39 @@ describe Automatic::Plugin::StorePermalink do
68
73
  end
69
74
 
70
75
  it "should be considered the case of duplicated links" do
76
+ @db_filename = "test_permalink.db"
77
+ db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
78
+ db_path.delete if db_path.exist?
79
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
80
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
81
+ AutomaticSpec.generate_pipeline {
82
+ feed {
83
+ item "http://id774.net/images/link_1.jpg"
84
+ item "http://id774.net/images/link_1.jpg"
85
+ item "http://id774.net/images/link_3.JPG"
86
+ item "http://id774.net/images/link_4.png"
87
+ item "http://id774.net/images/link_5.jpeg"
88
+ item "http://id774.net/images/link_6.PNG"
89
+ item nil
90
+ item "http://id774.net/images/link_8.gif"
91
+ item "http://id774.net/images/link_9.GIF"
92
+ item "http://id774.net/images/link_10.tiff"
93
+ item "http://id774.net/images/link_11.TIFF"
94
+ }
95
+ }
96
+ )
97
+
98
+ instance.run.should have(1).feed
99
+ lambda {
100
+ instance.run.should have(0).feed
101
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
102
+ end
103
+
104
+ it "No feed should be generated when there is same feed." do
105
+ @db_filename = "test_permalink.db"
106
+ db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
107
+ db_path.delete if db_path.exist?
108
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
71
109
  instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
72
110
  AutomaticSpec.generate_pipeline {
73
111
  feed {
@@ -86,6 +124,81 @@ describe Automatic::Plugin::StorePermalink do
86
124
  }
87
125
  )
88
126
 
127
+ instance.run.should have(1).feed
128
+ lambda {
129
+ instance.run.should have(0).feed
130
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
131
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
132
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
133
+ AutomaticSpec.generate_pipeline {
134
+ feed {
135
+ item "http://id774.net/images/link_1.jpg"
136
+ item "http://id774.net/images/link_1.jpg"
137
+ item "http://id774.net/images/link_3.JPG"
138
+ item "http://id774.net/images/link_4.png"
139
+ item "http://id774.net/images/link_5.jpeg"
140
+ item "http://id774.net/images/link_6.PNG"
141
+ item nil
142
+ item "http://id774.net/images/link_8.gif"
143
+ item "http://id774.net/images/link_9.GIF"
144
+ item "http://id774.net/images/link_10.tiff"
145
+ item "http://id774.net/images/link_11.TIFF"
146
+ }
147
+ }
148
+ )
149
+
150
+ instance.run.should have(0).feed
151
+ lambda {
152
+ instance.run.should have(0).feed
153
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
154
+ end
155
+
156
+ it "Only new feed should be generated when there is new feed." do
157
+ @db_filename = "test_permalink.db"
158
+ db_path = Pathname(AutomaticSpec.db_dir).cleanpath+"#{@db_filename}"
159
+ db_path.delete if db_path.exist?
160
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
161
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
162
+ AutomaticSpec.generate_pipeline {
163
+ feed {
164
+ item "http://id774.net/images/link_1.jpg"
165
+ item "http://id774.net/images/link_1.jpg"
166
+ item "http://id774.net/images/link_3.JPG"
167
+ item "http://id774.net/images/link_4.png"
168
+ item "http://id774.net/images/link_5.jpeg"
169
+ item "http://id774.net/images/link_6.PNG"
170
+ item nil
171
+ item "http://id774.net/images/link_8.gif"
172
+ item "http://id774.net/images/link_9.GIF"
173
+ item "http://id774.net/images/link_10.tiff"
174
+ item "http://id774.net/images/link_11.TIFF"
175
+ }
176
+ }
177
+ )
178
+
179
+ instance.run.should have(1).feed
180
+ lambda {
181
+ instance.run.should have(0).feed
182
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
183
+ Automatic::Plugin::StorePermalink.new({"db" => @db_filename}).run
184
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
185
+ AutomaticSpec.generate_pipeline {
186
+ feed {
187
+ item "http://id774.net/images/link_1.jpg"
188
+ item "http://id774.net/images/link_1.jpg"
189
+ item "http://id774.net/images/link_3.JPG"
190
+ item "http://id774.net/images/link_4_2.png"
191
+ item "http://id774.net/images/link_5_2.jpeg"
192
+ item "http://id774.net/images/link_6.PNG"
193
+ item nil
194
+ item "http://id774.net/images/link_8.gif"
195
+ item "http://id774.net/images/link_9.GIF"
196
+ item "http://id774.net/images/link_10.tiff"
197
+ item "http://id774.net/images/link_11.TIFF"
198
+ }
199
+ }
200
+ )
201
+
89
202
  instance.run.should have(1).feed
90
203
  lambda {
91
204
  instance.run.should have(0).feed
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Link
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 18, 2012
5
- # Updated:: Sep 18, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -34,7 +34,8 @@ describe Automatic::Plugin::SubscriptionLink do
34
34
  subject {
35
35
  Automatic::Plugin::SubscriptionLink.new(
36
36
  { 'urls' => [
37
- "http://id774.net"]
37
+ "http://id774.net"],
38
+ 'interval' => 5
38
39
  }
39
40
  )
40
41
  }
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Tumblr
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Oct 16, 2012
5
- # Updated:: Oct 16, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -47,11 +47,12 @@ describe Automatic::Plugin::SubscriptionTumblr do
47
47
  Automatic::Plugin::SubscriptionTumblr.new(
48
48
  { 'urls' => [
49
49
  "http://reblog.id774.net"],
50
- 'pages' => 10
50
+ 'pages' => 3,
51
+ 'interval' => 5
51
52
  }
52
53
  )
53
54
  }
54
55
 
55
- its(:run) { should have(10).item }
56
+ its(:run) { should have(3).item }
56
57
  end
57
58
  end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Twitter
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 10, 2012
5
- # Updated:: Sep 10, 2012
5
+ # Updated:: Jan 8, 2013
6
6
  # Copyright:: 774 Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -34,7 +34,8 @@ describe Automatic::Plugin::SubscriptionTwitter do
34
34
  subject {
35
35
  Automatic::Plugin::SubscriptionTwitter.new(
36
36
  { 'urls' => [
37
- "http://id774.net/test/twitter/favorites.html"]
37
+ "http://id774.net/test/twitter/favorites.html"],
38
+ 'interval' => 5
38
39
  }
39
40
  )
40
41
  }
@@ -8,7 +8,7 @@ global:
8
8
  plugins:
9
9
  - module: CustomFeedSVNLog
10
10
  config:
11
- target: http://redmine.rubyforge.org/svn
11
+ target: http://svn.apache.org/repos/asf/
12
12
  fetch_items: 2
13
13
 
14
14
  #- module: PublishConsole
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.10.0
4
+ version: 13.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-16 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3