From f4c471b9236438a7fd6ef63c31b7a178a61b7627 Mon Sep 17 00:00:00 2001 From: soramugi Date: Sun, 9 Jun 2013 01:55:16 +0900 Subject: [PATCH 001/188] Add plugin publish-eject --- doc/PLUGINS | 14 ++++++++++ doc/PLUGINS.ja | 14 ++++++++++ plugins/publish/eject.rb | 43 ++++++++++++++++++++++++++++++ spec/plugins/publish/eject_spec.rb | 31 +++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 plugins/publish/eject.rb create mode 100644 spec/plugins/publish/eject_spec.rb diff --git a/doc/PLUGINS b/doc/PLUGINS index 045548d..81a64a6 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -445,6 +445,20 @@ PublishGoogleCalendar interval: INTERVAL +PublishEject +-------------- +[Path] + /plugins/publish/eject.rb + +[Abstract] + eject by the feed link count. + +[Syntax] + - module: PublishEject + config: + interval: INTERVAL + + NotifyIkachan ------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index c514f5d..f0f2633 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -445,6 +445,20 @@ PublishGoogleCalendar interval: 複数の予定の投稿間隔 (秒) +PublishEject +-------------- +[パス] + /plugins/publish/eject.rb + +[概要] + Feedのリンク個数分だけeject + +[レシピ記法] + - module: PublishEject + config: + interval: 複数の予定の投稿間隔 (秒) + + NotifyIkachan ------------- [パス] diff --git a/plugins/publish/eject.rb b/plugins/publish/eject.rb new file mode 100644 index 0000000..12601b4 --- /dev/null +++ b/plugins/publish/eject.rb @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Eject +# Author:: soramugi +# Created:: Jun 9, 2013 +# Updated:: Jun 9, 2013 +# Copyright:: soramugi Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class PublishEject + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + @pipeline.each { |feeds| + unless feeds.nil? + feeds.items.each { |feed| + unless feed.link.nil? + `#{eject_cmd}` + Automatic::Log.puts('info', "Eject: #{feed.link}") + + interval = 3 + interval = @config['interval'].to_i unless @config['interval'].nil? + sleep interval + end + } + end + } + @pipeline + end + + def eject_cmd + if `type -P eject` != '' # linux + 'eject ; eject -t' + elsif `type -P drutil` != '' # mac + 'drutil tray eject ; drutil tray close' + end + end + end +end diff --git a/spec/plugins/publish/eject_spec.rb b/spec/plugins/publish/eject_spec.rb new file mode 100644 index 0000000..a659524 --- /dev/null +++ b/spec/plugins/publish/eject_spec.rb @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Eject +# Author:: soramugi +# Created:: Jun 9, 2013 +# Updated:: Jun 9, 2013 +# Copyright:: soramugi Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'publish/eject' + +describe Automatic::Plugin::PublishEject do + before do + @pipeline = AutomaticSpec.generate_pipeline { + feed { item "http://github.com" }} + end + + subject { + Automatic::Plugin::PublishEject.new({'interval' => 0}, @pipeline) + } + + it "should eject of feeds" do + subject.stub(:eject_cmd).and_return('echo') + subject.run.should have(1).items + end + + it "should eject_cmd" do + subject.eject_cmd.should_not == '' + end +end From 138bae653603ed00a10bd497ed61e6ddf11b0344 Mon Sep 17 00:00:00 2001 From: soramugi Date: Sun, 9 Jun 2013 09:15:50 +0900 Subject: [PATCH 002/188] Document plugin twitter_search --- doc/PLUGINS | 21 +++++++++++++++++++++ doc/PLUGINS.ja | 21 +++++++++++++++++++++ test/integration/test_twitter_search.yml | 21 +++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 test/integration/test_twitter_search.yml diff --git a/doc/PLUGINS b/doc/PLUGINS index 0d92393..f827988 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -94,6 +94,27 @@ SubscriptionTwitter retry: RETRY_COUNT +SubscriptionTwitterSearch +------------------- +[Path] + /plugins/subscription/twitter_search.rb + +[Abstract] + The search results of a twitter are acquired. + +[Syntax] + - module: SubscriptionTwitterSearch + config: + search: search word + opt: option + consumer_key: 'your_consumer_key' + consumer_secret: 'your_consumer_secret' + oauth_token: 'your_oauth_token' + oauth_token_secret: 'your_oauth_token_secret' + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + SubscriptionText ---------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 6390c4e..f4862aa 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -94,6 +94,27 @@ SubscriptionTwitter retry: エラー時のリトライ回数 (回数, 省略時 0) +SubscriptionTwitterSearch +------------------- +[Path] + /plugins/subscription/twitter_search.rb + +[Abstract] + Twitterの検索結果を取得 + +[Syntax] + - module: SubscriptionTwitterSearch + config: + search: 検索ワード + opt: 検索時に使用するオプション + consumer_key: 'your_consumer_key' + consumer_secret: 'your_consumer_secret' + oauth_token: 'your_oauth_token' + oauth_token_secret: 'your_oauth_token_secret' + interval: スクレイピングの間隔 (秒数, 省略可) + retry: エラー時のリトライ回数 (回数, 省略時 0) + + SubscriptionWeather ------------------- [パス] diff --git a/test/integration/test_twitter_search.yml b/test/integration/test_twitter_search.yml new file mode 100644 index 0000000..e77c1c6 --- /dev/null +++ b/test/integration/test_twitter_search.yml @@ -0,0 +1,21 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: none + +plugins: + - module: SubscriptionTwitterSearch + config: + consumer_key: 'consumer_key' + consumer_secret: 'consumer_secret' + oauth_token: 'oauth_token' + oauth_token_secret: 'oauth_token_secret' + search: 'ruby' + + - module: StorePermalink + config: + db: test_twitter_search.db + + #- module: PublishConsole From e4eef079a00784c7eb1ba595e50b9ea5cc3f2a27 Mon Sep 17 00:00:00 2001 From: soramugi Date: Sun, 16 Jun 2013 00:13:54 +0900 Subject: [PATCH 003/188] there is no conf setup --- plugins/publish/eject.rb | 5 ++--- spec/plugins/publish/eject_spec.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/publish/eject.rb b/plugins/publish/eject.rb index 12601b4..df40220 100644 --- a/plugins/publish/eject.rb +++ b/plugins/publish/eject.rb @@ -22,9 +22,8 @@ def run `#{eject_cmd}` Automatic::Log.puts('info', "Eject: #{feed.link}") - interval = 3 - interval = @config['interval'].to_i unless @config['interval'].nil? - sleep interval + interval = @config['interval'].to_i unless @config['interval'].nil? unless @config.nil? + sleep 3 if interval.nil? end } end diff --git a/spec/plugins/publish/eject_spec.rb b/spec/plugins/publish/eject_spec.rb index a659524..5e30223 100644 --- a/spec/plugins/publish/eject_spec.rb +++ b/spec/plugins/publish/eject_spec.rb @@ -16,6 +16,15 @@ feed { item "http://github.com" }} end + subject { + Automatic::Plugin::PublishEject.new({}, @pipeline) + } + + it "should eject of feeds" do + subject.stub(:eject_cmd).and_return('echo') + subject.run.should have(1).items + end + subject { Automatic::Plugin::PublishEject.new({'interval' => 0}, @pipeline) } From 87dd01c609ae0562f618ae8f9f37e3e09d50c9a2 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 18 Jun 2013 17:43:30 +0900 Subject: [PATCH 004/188] 311 Fix docs --- doc/PLUGINS | 46 ++++++++++++++++++------------------- doc/PLUGINS.ja | 62 +++++++++++++++++++++++++------------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index ea145dc..d03fefb 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -95,7 +95,7 @@ SubscriptionTwitter SubscriptionTwitterSearch -------------------- +------------------------- [Path] /plugins/subscription/twitter_search.rb @@ -115,6 +115,23 @@ SubscriptionTwitterSearch retry: RETRY_COUNT +SubscriptionWeather +------------------- +[Path] + /plugins/subscription/weather.rb + +[Abstract] + Subscribe weather (using gem weather_hacker) by zipcode. + +[Syntax] + - module: SubscriptionWeather + config: + zipcode: ZIPCODE (ex. 166-0003) + day: DAY (ex. 'today', 'tomorrow') + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + SubscriptionText ---------------- [Path] @@ -139,25 +156,8 @@ SubscriptionText url: 'url' -SubscriptionWeather -------------------- -[Path] - /plugins/subscription/weather.rb - -[Abstract] - Subscribe weather (using gem weather_hacker) by zipcode. - -[Syntax] - - module: SubscriptionWeather - config: - zipcode: ZIPCODE (ex. 166-0003) - day: DAY (ex. 'today', 'tomorrow') - interval: INTERVAL_FOR_SCRAPING (in seconds.) - retry: RETRY_COUNT - - SubscriptionPocket ----------------- +------------------ [Path] /plugins/subscription/pocket.rb @@ -310,7 +310,7 @@ FilterAbsoluteURI FilterTumblrResize --------------------- +------------------ [Path] /plugins/filter/tumblr_resize.rb @@ -427,7 +427,7 @@ PublishTwitter PublishPocket ------------------ +------------- [Path] /plugins/publish/pocket.rb @@ -486,7 +486,7 @@ PublishGoogleCalendar PublishEject --------------- +------------ [Path] /plugins/publish/eject.rb @@ -500,7 +500,7 @@ PublishEject PublishHipchat ---------------------- +-------------- [Path] /plugins/publish/hipchat.rb diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 90496b1..77925c1 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -157,7 +157,7 @@ SubscriptionText SubscriptionPocket ----------------- +------------------ [パス] /plugins/subscription/pocket.rb @@ -270,60 +270,60 @@ FilterFullFeed siteinfo: siteinfo ファイル名 -FilterAbsoluteURI ------------------ +FilterOne +--------- [パス] - /plugins/filter/absolute_uri.rb + /plugins/filter/one.rb [概要] - リンクの相対パスを絶対パスに書き換える + アイテムをフィードから 1 件だけ取り出す [レシピ記法] - - module: FilterAbsoluteURI + - module: FilterOne config: - url: http://targethost.com/ + pick: last (省略時は先頭から) -FilterTumblrResize --------------------- +FilterRand +---------- [パス] - /plugins/filter/tumblr_resize.rb + /plugins/filter/rand.rb [概要] - パーマリンクを Tumblr の最大サイズ - (High Res) に書き換える - -[前提] - パーマリンクが画像リンクに書き換え済であること + フィードの順番をランダムにする [レシピ記法] - - module: FilterTumblrResize + - module: FilterRand -FilterOne ---------- +FilterAbsoluteURI +----------------- [パス] - /plugins/filter/one.rb + /plugins/filter/absolute_uri.rb [概要] - アイテムをフィードから 1 件だけ取り出す + リンクの相対パスを絶対パスに書き換える [レシピ記法] - - module: FilterOne + - module: FilterAbsoluteURI config: - pick: last (省略時は先頭から) + url: http://targethost.com/ -FilterRand ----------- +FilterTumblrResize +-------------------- [パス] - /plugins/filter/rand.rb + /plugins/filter/tumblr_resize.rb [概要] - フィードの順番をランダムにする + パーマリンクを Tumblr の最大サイズ + (High Res) に書き換える + +[前提] + パーマリンクが画像リンクに書き換え済であること [レシピ記法] - - module: FilterRand + - module: FilterTumblrResize StorePermalink @@ -359,7 +359,7 @@ StoreFullText StoreTargetLink --------------- +--------------- [パス] /plugins/store/target_link.rb @@ -375,7 +375,7 @@ StoreTargetLink PublishConsole ------------- +-------------- [パス] /plugins/publish/console.rb @@ -486,7 +486,7 @@ PublishGoogleCalendar PublishEject --------------- +------------ [パス] /plugins/publish/eject.rb @@ -500,7 +500,7 @@ PublishEject PublishHipchat ---------------------- +-------------- [パス] /plugins/publish/hipchat.rb From 6c25ced2dc601f8f9c05188f49daff306310210e Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Jun 2013 09:54:57 +0900 Subject: [PATCH 005/188] 311 Fix docs --- doc/PLUGINS.ja | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 77925c1..ca9d737 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -95,7 +95,7 @@ SubscriptionTwitter SubscriptionTwitterSearch -------------------- +------------------------- [Path] /plugins/subscription/twitter_search.rb @@ -256,20 +256,6 @@ FilterImageSource - module: FilterImageSource -FilterFullFeed --------------- -[パス] - /plugins/filter/full_feed.rb - -[概要] - フィードの全文を取得する - -[レシピ記法] - - module: FilterFeed - config: - siteinfo: siteinfo ファイル名 - - FilterOne --------- [パス] @@ -296,6 +282,20 @@ FilterRand - module: FilterRand +FilterFullFeed +-------------- +[パス] + /plugins/filter/full_feed.rb + +[概要] + フィードの全文を取得する + +[レシピ記法] + - module: FilterFeed + config: + siteinfo: siteinfo ファイル名 + + FilterAbsoluteURI ----------------- [パス] @@ -311,7 +311,7 @@ FilterAbsoluteURI FilterTumblrResize --------------------- +------------------ [パス] /plugins/filter/tumblr_resize.rb @@ -427,7 +427,7 @@ PublishTwitter PublishPocket ------------------ +------------- [パス] /plugins/publish/pocket.rb From 114d9413416a6dac9bc2e2482a6d4ee359795949 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 20 Jun 2013 16:56:33 +0900 Subject: [PATCH 006/188] Add Filter::Sanitize --- plugins/filter/sanitize.rb | 41 +++++++++ spec/plugins/filter/sanitize_spec.rb | 128 +++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 plugins/filter/sanitize.rb create mode 100644 spec/plugins/filter/sanitize_spec.rb diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb new file mode 100644 index 0000000..162a9df --- /dev/null +++ b/plugins/filter/sanitize.rb @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::Sanitize +# Author:: 774 +# Created:: Jun 20, 2013 +# Updated:: Jun 20, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class FilterSanitize + require 'sanitize' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + case @config['mode'] + when "basic" + @mode = Sanitize::Config::BASIC + when "relaxed" + @mode = Sanitize::Config::RELAXED + else + @mode = Sanitize::Config::RESTRICTED + end + end + + def run + @return_feeds = [] + @pipeline.each {|feeds| + return_feed_items = [] + unless feeds.nil? + feeds.items.each {|feed| + feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? + } + @return_feeds << feeds + end + } + @return_feeds + end + + end +end diff --git a/spec/plugins/filter/sanitize_spec.rb b/spec/plugins/filter/sanitize_spec.rb new file mode 100644 index 0000000..921c557 --- /dev/null +++ b/spec/plugins/filter/sanitize_spec.rb @@ -0,0 +1,128 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::Sanitize +# Author:: 774 +# Created:: Jun 20, 2013 +# Updated:: Jun 20, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'filter/sanitize' + +describe Automatic::Plugin::FilterSanitize do + context "It should be sanitized" do + subject { + Automatic::Plugin::FilterSanitize.new( + {}, + AutomaticSpec.generate_pipeline { + feed { + item "http://testsite.org", "hoge", + "fuga", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@return_feeds)[0].items. + count.should == 1 + subject.instance_variable_get(:@return_feeds)[0].items[0].description. + should == 'fuga' + } + end + end + + context "It should not be sanitized in basic mode" do + subject { + Automatic::Plugin::FilterSanitize.new( + { + 'mode' => "basic" + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://testsite.org", "hoge", + "fuga", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@return_feeds)[0].items. + count.should == 1 + subject.instance_variable_get(:@return_feeds)[0].items[0].description. + should == 'fuga' + } + end + end + + context "It should not be sanitized in restricted mode" do + subject { + Automatic::Plugin::FilterSanitize.new( + { + 'mode' => "restricted" + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://testsite.org", "hoge", + "fuga", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@return_feeds)[0].items. + count.should == 1 + subject.instance_variable_get(:@return_feeds)[0].items[0].description. + should == 'fuga' + } + end + end + + context "It should not be sanitized in relaxed mode" do + subject { + Automatic::Plugin::FilterSanitize.new( + { + 'mode' => "relaxed" + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://testsite.org", "hoge", + "fuga", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@return_feeds)[0].items. + count.should == 1 + subject.instance_variable_get(:@return_feeds)[0].items[0].description. + should == 'fuga' + } + end + end + +end From 71c091338093fc58a624e8490ffcbd82f1fbea5b Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 20 Jun 2013 17:01:20 +0900 Subject: [PATCH 007/188] Docs for Filter::Sanitize --- doc/PLUGINS | 16 ++++++++++++++++ doc/PLUGINS.ja | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index d03fefb..c92c1dc 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -281,6 +281,22 @@ FilterRand - module: FilterRand +FilterSanitize +-------------- +[Path] + /plugins/filter/sanitize.rb + +[Abstract] + Strip the html tags. + Reference: https://github.com/rgrove/sanitize + +[Syntax] + - module: FilterSanitize + config: + mode: basic or relaxed or restricted + (default: restricted) + + FilterFullFeed -------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index ca9d737..58e60c5 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -282,6 +282,22 @@ FilterRand - module: FilterRand +FilterSanitize +-------------- +[パス] + /plugins/filter/sanitize.rb + +[概要] + HTML タグを除去する + 参照 https://github.com/rgrove/sanitize + +[レシピ記法] + - module: FilterSanitize + config: + mode: basic or relaxed or restricted + (デフォルト restricted) + + FilterFullFeed -------------- [パス] From 076836b8e5e913176a90a7ab3e1a091948a4cb06 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 20 Jun 2013 17:15:56 +0900 Subject: [PATCH 008/188] Add gems, integration tests --- Gemfile | 1 + test/integration/test_sanitize.yml | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/integration/test_sanitize.yml diff --git a/Gemfile b/Gemfile index 3b512e9..2df8d37 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ gem 'gcalapi' gem 'xml-simple' gem 'feedbag' gem 'nokogiri' +gem 'sanitize' gem 'twitter' gem 'weather_hacker' gem 'pocket-ruby' diff --git a/test/integration/test_sanitize.yml b/test/integration/test_sanitize.yml new file mode 100644 index 0000000..afbad30 --- /dev/null +++ b/test/integration/test_sanitize.yml @@ -0,0 +1,22 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionFeed + config: + feeds: + - http://blog.id774.net/post/feed/ + + - module: FilterSanitize + config: + mode: restricted + + - module: StoreFullText + config: + db: test_sanitize.db + + # - module: PublishConsole From 28293c50f6712e24ef4c8f0179c81f4f23a808e6 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 10:19:34 +0900 Subject: [PATCH 009/188] 312 Fix typo --- doc/PLUGINS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index c92c1dc..a787a68 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -266,7 +266,7 @@ FilterOne [Syntax] - module: FilterOne config: - pick: last (If none, pick the first item.) + pick: last (If none, pick the first item.) FilterRand From e1fce54badd87c877379707851c9027f699dbdd9 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:15:22 +0900 Subject: [PATCH 010/188] Add Publish::Fluentd --- Gemfile | 3 +- plugins/publish/fluentd.rb | 43 ++++++++++++++++++++++++++++ spec/plugins/publish/fluentd_spec.rb | 39 +++++++++++++++++++++++++ test/integration/test_fluentd.yml | 20 +++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 plugins/publish/fluentd.rb create mode 100644 spec/plugins/publish/fluentd_spec.rb create mode 100644 test/integration/test_fluentd.yml diff --git a/Gemfile b/Gemfile index 2df8d37..7d2ded5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20130523 +# Version:20130621 source "http://rubygems.org" source "http://gems.github.com" @@ -17,6 +17,7 @@ gem 'twitter' gem 'weather_hacker' gem 'pocket-ruby' gem 'hipchat' +gem 'fluent-logger' group :test do gem 'rspec' diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb new file mode 100644 index 0000000..10eb5e8 --- /dev/null +++ b/plugins/publish/fluentd.rb @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Fluentd +# Author:: 774 +# Created:: Jun 21, 2013 +# Updated:: Jun 21, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class PublishFluentd + require 'fluent-logger' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + @fluentd = Fluent::Logger + Fluent::Logger::FluentLogger.open(nil, + host = @config['host'], + port = @config['port']) + @pipeline.each {|feeds| + unless feeds.nil? + feeds.items.each {|feed| + begin + Fluent::Logger.post(@config['tag'], { + :title => feed.title, + :link => feed.link, + :description => feed.description, + :content => feed.content_encoded, + :created_at => Time.now.strftime("%Y/%m/%d %X") + }) + rescue + Automatic::Log.puts("warn", "Skip feed due to fault in save.") + end + } + end + } + @pipeline + end + end +end diff --git a/spec/plugins/publish/fluentd_spec.rb b/spec/plugins/publish/fluentd_spec.rb new file mode 100644 index 0000000..e558ae9 --- /dev/null +++ b/spec/plugins/publish/fluentd_spec.rb @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Fluentd +# Author:: 774 +# Created:: Jun 21, 2013 +# Updated:: Jun 21, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'publish/fluentd' + +describe Automatic::Plugin::PublishFluentd do + context 'when feed' do + describe 'should forward the feeds' do + subject { + Automatic::Plugin::PublishFluentd.new( + { + 'host' => "localhost", + 'port' => "9999", + 'tag' => "debug.forward" + }, + AutomaticSpec.generate_pipeline{ + feed { + item "http://github.com", "hoge", + "fuga" + } + } + ) + } + + its (:run) { + fluentd = mock("fluentd") + subject.run.should have(1).feed + } + end + + end +end diff --git a/test/integration/test_fluentd.yml b/test/integration/test_fluentd.yml new file mode 100644 index 0000000..31ba51f --- /dev/null +++ b/test/integration/test_fluentd.yml @@ -0,0 +1,20 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionFeed + config: + feeds: + - http://blog.id774.net/post/feed/ + + - module: PublishFluentd + config: + host: localhost + port: 3001 + tag: automatic.feed + + # - module: PublishConsole From cb962150b7a40a5486365a90f19a56b7783e9667 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:24:16 +0900 Subject: [PATCH 011/188] Docs for Publish::Fluentd --- doc/PLUGINS | 25 +++++++++++++++++++++++++ doc/PLUGINS.ja | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index a787a68..56e9dd7 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -402,6 +402,31 @@ PublishConsole - module: PublishConsole +PublishFluentd +-------------- +[Path] + /plugins/publish/fluentd.rb + +[Abstract] + Output to fluentd with fluent-logger. + +[Description] + This plugin outputs feed to fluentd. + Following fluentd config example. + + + type forward + port 9999 + + +[Syntax] + - module: PublishFluentd + config: + host: HOSTNAME + port: PORT_NUMBER + tag: TAGS (example: automatic.feed) + + PublishHatenaBookmark --------------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 58e60c5..ade162c 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -402,6 +402,31 @@ PublishConsole - module: PublishConsole +PublishFluentd +-------------- +[パス] + /plugins/publish/fluentd.rb + +[概要] + fluentd にフィードを出力する + +[説明] + このプラグインは fluentd にフィードを出力する + 受け手側では以下のように fluentd を設定し起動しておく + + + type forward + port 9999 + + +[レシピ記法] + - module: PublishFluentd + config: + host: ホスト名 + port: ポート番号 + tag: タグ (例 automatic.feed) + + PublishHatenaBookmark --------------------- [パス] From 39efe08042a09687b1f9339e9e5b7d0be96e75a0 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:32:18 +0900 Subject: [PATCH 012/188] 313 Fix typo --- doc/PLUGINS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index 56e9dd7..57683bf 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -440,7 +440,7 @@ PublishHatenaBookmark Hatena Bookmark API. [Syntax] - - Modu - module: PublishHatenaBookmark + - module: PublishHatenaBookmark config: username: HATENA_ID passowrd: PASSWORD From e02a67f12431e2bd0bb6c7772016aa78cd7ba4b5 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:34:13 +0900 Subject: [PATCH 013/188] 314 Refactoring --- plugins/publish/fluentd.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index 10eb5e8..51eb9c8 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -16,7 +16,6 @@ def initialize(config, pipeline=[]) end def run - @fluentd = Fluent::Logger Fluent::Logger::FluentLogger.open(nil, host = @config['host'], port = @config['port']) From ad9b850f22680f1c8628bb3e678ec772657d6d25 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:35:01 +0900 Subject: [PATCH 014/188] 315 Fix typo --- plugins/publish/fluentd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index 51eb9c8..e249202 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -31,7 +31,7 @@ def run :created_at => Time.now.strftime("%Y/%m/%d %X") }) rescue - Automatic::Log.puts("warn", "Skip feed due to fault in save.") + Automatic::Log.puts("warn", "Skip feed due to fault in forward.") end } end From e5c916f8f31ec8668f40a0b3872b9135a52bf80b Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Jun 2013 15:35:56 +0900 Subject: [PATCH 015/188] 316 Fix typo --- test/integration/test_fluentd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/test_fluentd.yml b/test/integration/test_fluentd.yml index 31ba51f..3fa25e7 100644 --- a/test/integration/test_fluentd.yml +++ b/test/integration/test_fluentd.yml @@ -14,7 +14,7 @@ plugins: - module: PublishFluentd config: host: localhost - port: 3001 + port: 9999 tag: automatic.feed # - module: PublishConsole From d5bb94de6b89af37aaeb14989e2ad67ba0396cd0 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 23 Jun 2013 15:32:36 +0900 Subject: [PATCH 016/188] 317 Quick fix for Filter::FullFeed --- plugins/filter/full_feed.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/filter/full_feed.rb b/plugins/filter/full_feed.rb index 3b7ad17..623cb7d 100644 --- a/plugins/filter/full_feed.rb +++ b/plugins/filter/full_feed.rb @@ -3,7 +3,7 @@ # Author:: progd # 774 # Created:: Apr 29, 2012 -# Updated:: Apr 5, 2013 +# Updated:: Jun 23, 2013 # Copyright:: progd # 774 Copyright (c) 2012-2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -38,7 +38,7 @@ def run def get_siteinfo Automatic::Log.puts(:info, "Loading siteinfo from #{@config['siteinfo']}") - siteinfo = JSON.load(open(File.join(assets_dir, @config['siteinfo'])).read) + siteinfo = JSON.load(open(File.join(assets_dir, @config['siteinfo'])).read.force_encoding("UTF-8")) siteinfo.select! { |info| SITEINFO_TYPES.include? (info['data']['type']) } siteinfo.sort! { |a, b| atype, btype = a['data']['type'], b['data']['type'] From 10a8e7ac6535bbb61b99cb2a285522f7f1ff89f0 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 23 Jun 2013 17:03:14 +0900 Subject: [PATCH 017/188] 318 Append changelog --- doc/ChangeLog | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 40388fc..e1f77f0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,19 @@ +=== 13.6.0 / 2013-06-xx + +* Added new plugins. + + * Subscription::Pocket + * Subscription::TwitterSearch + * Filter::Accept + * Filter::Sanitize + * Filter::GithubFeed + * Publish::ConsoleLink + * Publish::Hipchat + * Publish::Fluentd + +* And other Improvements, bug fixes. + + === 13.5.0 / 2013-05-18 * Added new plugins. From ca6ea435e71a375b023f422047107cc2d9423d9e Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 23 Jun 2013 17:08:44 +0900 Subject: [PATCH 018/188] 319 Append readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f3038b..af7d2ea 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,9 @@ This naming convention is to mimic Ubuntu. Developers ---------- -See doc/AUTHORS. +See doc/AUTHORS or following link. + ++ https://github.com/automaticruby?tab=members Author From 4d8bf1496125d2b1943092b6c90c6b3f477b9767 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 23 Jun 2013 21:39:14 +0900 Subject: [PATCH 019/188] 320 Fix sanitize plugin bugs --- plugins/filter/sanitize.rb | 13 +++++++++++-- spec/plugins/filter/sanitize_spec.rb | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index 162a9df..ba88abd 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::Sanitize # Author:: 774 # Created:: Jun 20, 2013 -# Updated:: Jun 20, 2013 +# Updated:: Jun 23, 2013 # Copyright:: 774 Copyright (c) 2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -23,13 +23,22 @@ def initialize(config, pipeline=[]) end end + def sanitize(feed) + begin + feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? + return feed + rescue + return feed + end + end + def run @return_feeds = [] @pipeline.each {|feeds| return_feed_items = [] unless feeds.nil? feeds.items.each {|feed| - feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? + feed = sanitize(feed) } @return_feeds << feeds end diff --git a/spec/plugins/filter/sanitize_spec.rb b/spec/plugins/filter/sanitize_spec.rb index 921c557..b39a380 100644 --- a/spec/plugins/filter/sanitize_spec.rb +++ b/spec/plugins/filter/sanitize_spec.rb @@ -125,4 +125,29 @@ end end + context "It should be sanitized" do + subject { + Automatic::Plugin::FilterSanitize.new( + {}, + AutomaticSpec.generate_pipeline { + feed { + item "http://testsite.org", "hoge" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@return_feeds)[0].items. + count.should == 1 + subject.instance_variable_get(:@return_feeds)[0].items[0].description. + should == '' + } + end + end + end From 5b8e49858ce395884233ea72633ca49d855e78c9 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 24 Jun 2013 13:19:47 +0900 Subject: [PATCH 020/188] 321 Fix messages of Filter::Sanitize --- plugins/filter/sanitize.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index ba88abd..932d096 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::Sanitize # Author:: 774 # Created:: Jun 20, 2013 -# Updated:: Jun 23, 2013 +# Updated:: Jun 24, 2013 # Copyright:: 774 Copyright (c) 2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -28,6 +28,7 @@ def sanitize(feed) feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? return feed rescue + Automatic::Log.puts("warn", "Undefined field detected in feed.") return feed end end From 88626c300801962a7aabcdbfdbb2f0f1bddd75db Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Jun 2013 09:16:34 +0900 Subject: [PATCH 021/188] 322 Refactoring Publish::Fluentd --- plugins/publish/fluentd.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index e249202..1c1ee12 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Publish::Fluentd # Author:: 774 # Created:: Jun 21, 2013 -# Updated:: Jun 21, 2013 +# Updated:: Jun 25, 2013 # Copyright:: 774 Copyright (c) 2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,17 +13,17 @@ class PublishFluentd def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + @fluentd = Fluent::Logger::FluentLogger.open(nil, + host = @config['host'], + port = @config['port']) end def run - Fluent::Logger::FluentLogger.open(nil, - host = @config['host'], - port = @config['port']) @pipeline.each {|feeds| unless feeds.nil? feeds.items.each {|feed| begin - Fluent::Logger.post(@config['tag'], { + @fluentd.post(@config['tag'], { :title => feed.title, :link => feed.link, :description => feed.description, From 5a79461f137327b2bc3304f4d8d13f442fa25ee0 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Jun 2013 10:14:05 +0900 Subject: [PATCH 022/188] 323 Add plugin Publish::Memcached --- Gemfile | 3 +- doc/PLUGINS | 16 +++++++ doc/PLUGINS.ja | 16 +++++++ plugins/publish/memcached.rb | 44 ++++++++++++++++++ spec/plugins/publish/memcached_spec.rb | 63 ++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 plugins/publish/memcached.rb create mode 100644 spec/plugins/publish/memcached_spec.rb diff --git a/Gemfile b/Gemfile index 7d2ded5..bb455fa 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20130621 +# Version:20130625 source "http://rubygems.org" source "http://gems.github.com" @@ -18,6 +18,7 @@ gem 'weather_hacker' gem 'pocket-ruby' gem 'hipchat' gem 'fluent-logger' +gem 'dalli' group :test do gem 'rspec' diff --git a/doc/PLUGINS b/doc/PLUGINS index 57683bf..f4c97d2 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -427,6 +427,22 @@ PublishFluentd tag: TAGS (example: automatic.feed) +PublishMemcached +---------------- +[Path] + /plugins/publish/memcached.rb + +[Abstract] + Output feeds converted hash to memcached with dalli. + +[Syntax] + - module: PublishMemcached + config: + host: HOSTNAME + port: PORT_NUMBER + key: KEY + + PublishHatenaBookmark --------------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index ade162c..f82df97 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -427,6 +427,22 @@ PublishFluentd tag: タグ (例 automatic.feed) +PublishMemcached +---------------- +[パス] + /plugins/publish/memcached.rb + +[概要] + フィードをハッシュに変換して memcached に出力する + +[レシピ記法] + - module: PublishMemcached + config: + host: ホスト名 + port: ポート番号 + key: 出力するキーの名称 + + PublishHatenaBookmark --------------------- [パス] diff --git a/plugins/publish/memcached.rb b/plugins/publish/memcached.rb new file mode 100644 index 0000000..d18af03 --- /dev/null +++ b/plugins/publish/memcached.rb @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Memcached +# Author:: 774 +# Created:: Jun 25, 2013 +# Updated:: Jun 25, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class PublishMemcached + require 'dalli' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + @cache = Dalli::Client.new( + @config['host'] + ":" + + @config['port']) + end + + def run + hash = {} + @pipeline.each {|feeds| + unless feeds.nil? + feeds.items.each {|feed| + hash[feed.link] = + { + :title => feed.title, + :description => feed.description, + :content => feed.content_encoded, + :created_at => Time.now.strftime("%Y/%m/%d %X") + } + } + end + } + begin + @cache.set(@config['key'], hash) + rescue + Automatic::Log.puts("warn", "Skip feed due to fault in put to memcached.") + end + @pipeline + end + end +end diff --git a/spec/plugins/publish/memcached_spec.rb b/spec/plugins/publish/memcached_spec.rb new file mode 100644 index 0000000..998aa99 --- /dev/null +++ b/spec/plugins/publish/memcached_spec.rb @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::Memcached +# Author:: 774 +# Created:: Jun 25, 2013 +# Updated:: Jun 25, 2013 +# Copyright:: 774 Copyright (c) 2013 +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'publish/memcached' + +describe Automatic::Plugin::PublishMemcached do + context 'when feed' do + describe 'should put the feeds to memcached' do + subject { + Automatic::Plugin::PublishMemcached.new( + { + 'host' => "localhost", + 'port' => "11211", + 'key' => "rspec" + }, + AutomaticSpec.generate_pipeline{ + feed { + item "http://blog.id774.net/post/2012/01/30/18/", "ブログをはじめた", + "なぜいまブログなのか + + いままでインターネット全体に公開するブログとして、はてなダイアリーを利用してきた。それ以外のある程度まとまった文章は Facebook に書いてきた。それはそれで良かったのだけど、いろいろと思うところもあり、このたび新しくブログをはじめることにした。 + + はてなダイアリーはシンタックスハイライト (プログラミング言語の色付けのこと) が充実していたので利用していた。しかし最近登場した CoffeeScript や Haml のような新しい言語には対応していない。新しくはてなブログというのも始まったが、ダイアリー以上にシンタックスハイライトが使えないようだ。 + + そこで、今後インターネット上で文章を書いていくにあたりどうするか考えた。" + item "http://blog.id774.net/post/2012/01/30/38/", "Twitter Viewer つくった", + "Twitter を閲覧するための Web アプリをつくった。 + + Twitter Viewer + + やっていることは至ってシンプルで RDB にためた発言をブラウザに表示させているだけである。内容は Rails の Scaffold ほとんどそのまま。 CSS はサイトローカルな Bootstrap を読み込んでいる。簡単なアプリだが、ブラウザにいちど表示させてしまえば電波が入らない地下鉄などでもゆっくり読めるので、モバイル環境で大量の発言をざっとチェックしたいときなどに使えて意外と実用的である。発言のクロールは別途おこなう必要がある。この例では Termtter の ActiveRecord プラグインを利用している。" + item "http://blog.id774.net/post/2012/01/30/48/", "PC-98 とエミュレータ", + "Facebook には少し書いたのだが、今年に入ってから 90 年代に使っていた PC-98 と呼ばれる PC を発掘したので起動した。もう 15 年前後も経っているというのに正常に利用することができて感動してしまった。あの ThinkPad ですら数年ほど電源を入れないで放置しておくと起動しないことが多いのに、さすが発売当初 40 〜 50 万円程もした高級マシンである。そんなわけで今回は PC-98 の話。 + + PC-98 のソフトを使う + 当時のソフトウェアを利用するためには以下のものが必要だ。 + 1. PC-98 エミュレータ + 2. MS-DOS (オペレーティングシステム) + 3. 動作させる対象のソフトウェア" + } + feed { + item "http://d.hatena.ne.jp/Naruhodius/20120130/1327862031", "ブログを移転しました", + "いままでこの「はてなダイアリー」にブログを書いてきましたが、以下のアドレスにブログを移転することにしました。このブログはもう更新されません。以下の新しいブログを購読してください。" + } + } + ) + } + + its (:run) { + fluentd = mock("memcached") + subject.run.should have(2).feed + } + end + + end +end From 29779d3ee24a9324be874186fc382000961c9649 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Jun 2013 10:19:21 +0900 Subject: [PATCH 023/188] 323 Add plugin Publish::Memcached --- doc/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index e1f77f0..5178923 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -9,6 +9,7 @@ * Filter::GithubFeed * Publish::ConsoleLink * Publish::Hipchat + * Publish::Memcached * Publish::Fluentd * And other Improvements, bug fixes. From d27718015ae6dadabe6213afe7176c8280320450 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Jun 2013 15:06:57 +0900 Subject: [PATCH 024/188] 324 Refactoring --- plugins/filter/sanitize.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index 932d096..b17c265 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -23,16 +23,6 @@ def initialize(config, pipeline=[]) end end - def sanitize(feed) - begin - feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? - return feed - rescue - Automatic::Log.puts("warn", "Undefined field detected in feed.") - return feed - end - end - def run @return_feeds = [] @pipeline.each {|feeds| @@ -47,5 +37,15 @@ def run @return_feeds end + private + def sanitize(feed) + begin + feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? + return feed + rescue + Automatic::Log.puts("warn", "Undefined field detected in feed.") + return feed + end + end end end From 21d98292e15be2f44020a328e1a0e60f8e208445 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Jun 2013 15:06:03 +0900 Subject: [PATCH 025/188] 325 Ruby 1.8 has been outdated, update to activesupport 4.0 --- Gemfile | 6 +++--- README.md | 2 +- doc/ChangeLog | 2 ++ doc/README | 2 +- doc/README.ja | 2 +- lib/automatic/feed_parser.rb | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index bb455fa..5bbef82 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,9 @@ source "http://rubygems.org" source "http://gems.github.com" gem 'sqlite3' -gem 'activesupport', '~>3.2.13' -gem 'activerecord', '~>3.2.13' -gem 'actionmailer', '~>3.2.13' +gem 'activesupport', '~>4.0.0' +gem 'activerecord', '~>4.0.0' +gem 'actionmailer', '~>4.0.0' gem 'hashie' gem 'gcalapi' gem 'xml-simple' diff --git a/README.md b/README.md index af7d2ea..7ad38b2 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ For more info, refer to the document (doc/README). Environment ----------- -Ruby 1.8 - 2.0, see Gemfile. +Ruby 1.9 - 2.0. See Gemfile. Development diff --git a/doc/ChangeLog b/doc/ChangeLog index 5178923..88af84b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -14,6 +14,8 @@ * And other Improvements, bug fixes. +* Ruby 1.8 support was outdated. + === 13.5.0 / 2013-05-18 diff --git a/doc/README b/doc/README index 9ceb898..8b25d7b 100644 --- a/doc/README +++ b/doc/README @@ -496,7 +496,7 @@ TODO Environment =========== - Ruby 1.8 - 2.0. + Ruby 1.9 - 2.0. Depend on the packages that described in Gemfile. diff --git a/doc/README.ja b/doc/README.ja index 0a47933..b266d14 100644 --- a/doc/README.ja +++ b/doc/README.ja @@ -504,7 +504,7 @@ TODO 動作環境 ======== -Ruby 1.8 - 2.0 +Ruby 1.9 - 2.0 Gemfile に記述された gem パッケージに依存 diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 500d13e..1010bd4 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -38,7 +38,7 @@ def self.create(feeds = []) unless feeds.nil? feeds.each {|feed| unless feed.link.nil? - Automatic::Log.puts("info", "Creating: #{feed.link}") + Automatic::Log.puts("info", "Feed: #{feed.link}") item = maker.items.new_item item.title = feed.title item.link = feed.link From a7bc7192f557fc3b2a64bdbf91faa81f24ea3e18 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Jun 2013 21:26:55 +0900 Subject: [PATCH 026/188] 325 Ruby 1.8 has been outdated, update to activesupport 4.0 --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 5bbef82..3813e56 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20130625 +# Version:20130626 source "http://rubygems.org" source "http://gems.github.com" @@ -30,7 +30,7 @@ end group :development do gem "cucumber" - gem 'bundler', '~>1.3.5' - gem 'builder', '~>3.0.4' + gem 'bundler' + gem 'builder' gem "jeweler" end From f7fd5d01a14ff12c63756f2ce81629ac524d087e Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Jun 2013 22:56:53 +0900 Subject: [PATCH 027/188] 326 Quick fix gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3813e56..625846b 100644 --- a/Gemfile +++ b/Gemfile @@ -31,6 +31,6 @@ end group :development do gem "cucumber" gem 'bundler' - gem 'builder' + gem 'builder', '~>3.1.0' gem "jeweler" end From 8e977fe901283bb3716ffd2499f25f1031493340 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 00:24:19 +0900 Subject: [PATCH 028/188] 327 Make it fit for ActiveRecord 4.0 --- plugins/store/database.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/store/database.rb b/plugins/store/database.rb index cedd414..826a88c 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -4,8 +4,8 @@ # 774 # soramugi # Created:: Feb 27, 2012 -# Updated:: Dec 20, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Updated:: Jun 27, 2013 +# Copyright:: kzgs Copyright (c) 2012-2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'active_record' @@ -14,7 +14,7 @@ module Automatic::Plugin module Database def for_each_new_feed prepare_database - existing_records = model_class.find(:all) + existing_records = model_class.all @return_feeds = [] @pipeline.each {|feeds| unless feeds.nil? From fba7ac8ae04ecd32fe4241939e9a3a73250bc004 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 01:11:51 +0900 Subject: [PATCH 029/188] 328 Pending tests for activemailer 4.0 --- spec/plugins/publish/mail_spec.rb | 1 + spec/plugins/publish/smtp_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/plugins/publish/mail_spec.rb b/spec/plugins/publish/mail_spec.rb index cbcb577..d488fe7 100644 --- a/spec/plugins/publish/mail_spec.rb +++ b/spec/plugins/publish/mail_spec.rb @@ -31,6 +31,7 @@ } it "should mail to smtp server" do + pending("Waiting for ActionMailer 4.0") smtpd = SMTPServer.new({ :Port => 10025, :MailHook => lambda { |sender| sender.should == "" }, diff --git a/spec/plugins/publish/smtp_spec.rb b/spec/plugins/publish/smtp_spec.rb index 64390f6..2085cd5 100644 --- a/spec/plugins/publish/smtp_spec.rb +++ b/spec/plugins/publish/smtp_spec.rb @@ -27,6 +27,7 @@ } it "should mail to smtp server" do + pending("Waiting for ActionMailer 4.0") smtpd = SMTPServer.new({ :Port => 10025, :MailHook => lambda { |sender| sender.should == "from@example.com" }, From 0bf613b4783b887fa3b47c5bd8a2a93f5a2ec8ce Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 13:52:10 +0900 Subject: [PATCH 030/188] 329 Fix bundler version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 625846b..eb06b6c 100644 --- a/Gemfile +++ b/Gemfile @@ -30,7 +30,7 @@ end group :development do gem "cucumber" - gem 'bundler' + gem 'bundler', '~>1.3.5' gem 'builder', '~>3.1.0' gem "jeweler" end From d4efffb75107d777f0b386a9524b4a05ddac48fa Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 14:35:11 +0900 Subject: [PATCH 031/188] 330 Copyright header updated --- lib/automatic.rb | 2 +- lib/automatic/feed_parser.rb | 2 +- lib/automatic/log.rb | 2 +- lib/automatic/pipeline.rb | 2 +- lib/automatic/recipe.rb | 2 +- plugins/custom_feed/svn_log.rb | 2 +- plugins/filter/absolute_uri.rb | 2 +- plugins/filter/accept.rb | 2 +- plugins/filter/full_feed.rb | 3 +-- plugins/filter/github_feed.rb | 2 +- plugins/filter/ignore.rb | 2 +- plugins/filter/image.rb | 2 +- plugins/filter/image_source.rb | 2 +- plugins/filter/one.rb | 2 +- plugins/filter/rand.rb | 2 +- plugins/filter/sanitize.rb | 2 +- plugins/filter/sort.rb | 2 +- plugins/filter/tumblr_resize.rb | 2 +- plugins/publish/console.rb | 2 +- plugins/publish/console_link.rb | 2 +- plugins/publish/eject.rb | 2 +- plugins/publish/fluentd.rb | 2 +- plugins/publish/google_calendar.rb | 2 +- plugins/publish/hatena_bookmark.rb | 2 +- plugins/publish/hipchat.rb | 2 +- plugins/publish/instapaper.rb | 2 +- plugins/publish/mail.rb | 2 +- plugins/publish/memcached.rb | 2 +- plugins/publish/pocket.rb | 2 +- plugins/publish/smtp.rb | 2 +- plugins/publish/twitter.rb | 2 +- plugins/store/database.rb | 2 +- plugins/store/full_text.rb | 2 +- plugins/store/permalink.rb | 2 +- plugins/store/target_link.rb | 2 +- plugins/subscription/feed.rb | 2 +- plugins/subscription/google_reader_star.rb | 2 +- plugins/subscription/link.rb | 2 +- plugins/subscription/pocket.rb | 2 +- plugins/subscription/text.rb | 2 +- plugins/subscription/tumblr.rb | 2 +- plugins/subscription/twitter.rb | 2 +- plugins/subscription/twitter_search.rb | 2 +- plugins/subscription/weather.rb | 2 +- spec/lib/automatic/log_spec.rb | 2 +- spec/lib/automatic/pipeline_spec.rb | 2 +- spec/lib/automatic/recipe_spec.rb | 2 +- spec/lib/automatic_spec.rb | 2 +- spec/plugins/custom_feed/svn_log_spec.rb | 2 +- spec/plugins/filter/absolute_uri_spec.rb | 2 +- spec/plugins/filter/accept_spec.rb | 2 +- spec/plugins/filter/full_feed_spec.rb | 2 +- spec/plugins/filter/github_feed_spec.rb | 2 +- spec/plugins/filter/ignore_spec.rb | 2 +- spec/plugins/filter/image_source_spec.rb | 2 +- spec/plugins/filter/image_spec.rb | 2 +- spec/plugins/filter/one_spec.rb | 2 +- spec/plugins/filter/rand_spec.rb | 2 +- spec/plugins/filter/sanitize_spec.rb | 2 +- spec/plugins/filter/sort_spec.rb | 2 +- spec/plugins/filter/tumblr_resize_spec.rb | 2 +- spec/plugins/publish/console_spec.rb | 2 +- spec/plugins/publish/eject_spec.rb | 2 +- spec/plugins/publish/fluentd_spec.rb | 2 +- spec/plugins/publish/google_calendar_spec.rb | 2 +- spec/plugins/publish/hatena_bookmark_spec.rb | 2 +- spec/plugins/publish/hipchat_spec.rb | 2 +- spec/plugins/publish/instapaper_spec.rb | 2 +- spec/plugins/publish/mail_spec.rb | 2 +- spec/plugins/publish/memcached_spec.rb | 2 +- spec/plugins/publish/pocket_spec.rb | 2 +- spec/plugins/publish/smtp_spec.rb | 2 +- spec/plugins/publish/twitter_spec.rb | 2 +- spec/plugins/store/full_text_spec.rb | 2 +- spec/plugins/store/permalink_spec.rb | 2 +- spec/plugins/store/target_link_spec.rb | 2 +- spec/plugins/subscription/feed_spec.rb | 2 +- spec/plugins/subscription/google_reader_star_spec.rb | 2 +- spec/plugins/subscription/link_spec.rb | 2 +- spec/plugins/subscription/pocket_spec.rb | 2 +- spec/plugins/subscription/text_spec.rb | 2 +- spec/plugins/subscription/tumblr_spec.rb | 2 +- spec/plugins/subscription/twitter_search_spec.rb | 2 +- spec/plugins/subscription/twitter_spec.rb | 2 +- spec/plugins/subscription/weather_spec.rb | 2 +- 85 files changed, 85 insertions(+), 86 deletions(-) diff --git a/lib/automatic.rb b/lib/automatic.rb index bba9ee9..552ff8b 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 18, 2012 # Updated:: May 19, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 1010bd4..119b482 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 19, 2012 # Updated:: Jan 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic diff --git a/lib/automatic/log.rb b/lib/automatic/log.rb index 930072b..64a1a66 100644 --- a/lib/automatic/log.rb +++ b/lib/automatic/log.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 20, 2012 # Updated:: Mar 11, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic diff --git a/lib/automatic/pipeline.rb b/lib/automatic/pipeline.rb index c34efff..8af779c 100644 --- a/lib/automatic/pipeline.rb +++ b/lib/automatic/pipeline.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Mar 10, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'active_support/core_ext' diff --git a/lib/automatic/recipe.rb b/lib/automatic/recipe.rb index dd46ac0..bd55833 100644 --- a/lib/automatic/recipe.rb +++ b/lib/automatic/recipe.rb @@ -4,7 +4,7 @@ # 774 # Created:: Feb 18, 2012 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'hashie' diff --git a/plugins/custom_feed/svn_log.rb b/plugins/custom_feed/svn_log.rb index f1a1f94..9fb1a9f 100644 --- a/plugins/custom_feed/svn_log.rb +++ b/plugins/custom_feed/svn_log.rb @@ -3,7 +3,7 @@ # Author:: kzgs # Created:: Feb 29, 2012 # Updated:: Mar 3, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'rss/maker' diff --git a/plugins/filter/absolute_uri.rb b/plugins/filter/absolute_uri.rb index 85c9c44..267b84f 100644 --- a/plugins/filter/absolute_uri.rb +++ b/plugins/filter/absolute_uri.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 20, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/accept.rb b/plugins/filter/accept.rb index ceeff6b..ba3fe28 100644 --- a/plugins/filter/accept.rb +++ b/plugins/filter/accept.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 4, 2013 # Updated:: Jun 4, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/full_feed.rb b/plugins/filter/full_feed.rb index 623cb7d..9101864 100644 --- a/plugins/filter/full_feed.rb +++ b/plugins/filter/full_feed.rb @@ -4,8 +4,7 @@ # 774 # Created:: Apr 29, 2012 # Updated:: Jun 23, 2013 -# Copyright:: progd -# 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/github_feed.rb b/plugins/filter/github_feed.rb index d852eb7..a102182 100644 --- a/plugins/filter/github_feed.rb +++ b/plugins/filter/github_feed.rb @@ -3,7 +3,7 @@ # Author:: Kohei Hasegawa # Created:: Jun 6, 2013 # Updated:: Jun 6, 2013 -# Copyright:: Kohei Hasegawa Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/ignore.rb b/plugins/filter/ignore.rb index 6057d60..d0fa507 100644 --- a/plugins/filter/ignore.rb +++ b/plugins/filter/ignore.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/image.rb b/plugins/filter/image.rb index 5a299d9..fae0b3f 100644 --- a/plugins/filter/image.rb +++ b/plugins/filter/image.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 18, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/image_source.rb b/plugins/filter/image_source.rb index 016ec83..e291849 100644 --- a/plugins/filter/image_source.rb +++ b/plugins/filter/image_source.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 28, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/one.rb b/plugins/filter/one.rb index 4076e2f..f2b3760 100644 --- a/plugins/filter/one.rb +++ b/plugins/filter/one.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 8, 2013 # Updated:: May 8, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/rand.rb b/plugins/filter/rand.rb index ffd7e48..f0b6156 100644 --- a/plugins/filter/rand.rb +++ b/plugins/filter/rand.rb @@ -4,7 +4,7 @@ # 774 # Created:: Mar 6, 2013 # Updated:: Mar 7, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index b17c265..f9a65b9 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 20, 2013 # Updated:: Jun 24, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/sort.rb b/plugins/filter/sort.rb index 86556c1..ba65454 100644 --- a/plugins/filter/sort.rb +++ b/plugins/filter/sort.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Mar 23, 2012 # Updated:: Jan 23, 2013 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/filter/tumblr_resize.rb b/plugins/filter/tumblr_resize.rb index 278e2ca..0b1d6e4 100644 --- a/plugins/filter/tumblr_resize.rb +++ b/plugins/filter/tumblr_resize.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 28, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/console.rb b/plugins/publish/console.rb index 87dad2c..cef2ea9 100644 --- a/plugins/publish/console.rb +++ b/plugins/publish/console.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 23, 2012 # Updated:: Feb 24, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/console_link.rb b/plugins/publish/console_link.rb index 60abbf0..4876092 100644 --- a/plugins/publish/console_link.rb +++ b/plugins/publish/console_link.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 02, 2013 # Updated:: Jun 02, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/eject.rb b/plugins/publish/eject.rb index df40220..51bca70 100644 --- a/plugins/publish/eject.rb +++ b/plugins/publish/eject.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 9, 2013 # Updated:: Jun 9, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index 1c1ee12..65fd863 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 21, 2013 # Updated:: Jun 25, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/google_calendar.rb b/plugins/publish/google_calendar.rb index dca31aa..46ed9fa 100644 --- a/plugins/publish/google_calendar.rb +++ b/plugins/publish/google_calendar.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 24, 2012 # Updated:: Jan 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/hatena_bookmark.rb b/plugins/publish/hatena_bookmark.rb index ce9f80c..d9a57fe 100644 --- a/plugins/publish/hatena_bookmark.rb +++ b/plugins/publish/hatena_bookmark.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Mar 7, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/hipchat.rb b/plugins/publish/hipchat.rb index c2ee492..73205f3 100644 --- a/plugins/publish/hipchat.rb +++ b/plugins/publish/hipchat.rb @@ -3,7 +3,7 @@ # Author:: Kohei Hasegawa # Created:: Jun 6, 2013 # Updated:: Jun 6, 2013 -# Copyright:: Kohei Hasegawa Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/instapaper.rb b/plugins/publish/instapaper.rb index 142cedc..3faa296 100644 --- a/plugins/publish/instapaper.rb +++ b/plugins/publish/instapaper.rb @@ -4,7 +4,7 @@ # 774 # Created:: Feb 9, 2013 # Updated:: Mar 23, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/mail.rb b/plugins/publish/mail.rb index 5e26367..7ad96db 100644 --- a/plugins/publish/mail.rb +++ b/plugins/publish/mail.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Apr 5, 2012 # Updated:: Apr 5, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/memcached.rb b/plugins/publish/memcached.rb index d18af03..f3e41e5 100644 --- a/plugins/publish/memcached.rb +++ b/plugins/publish/memcached.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 25, 2013 # Updated:: Jun 25, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/pocket.rb b/plugins/publish/pocket.rb index ebc980c..a0ad52f 100644 --- a/plugins/publish/pocket.rb +++ b/plugins/publish/pocket.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 15, 2013 # Updated:: May 15, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/smtp.rb b/plugins/publish/smtp.rb index 300c4d9..7ba355b 100644 --- a/plugins/publish/smtp.rb +++ b/plugins/publish/smtp.rb @@ -3,7 +3,7 @@ # Author:: kzgs # Created:: Mar 17, 2012 # Updated:: Mar 17, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/twitter.rb b/plugins/publish/twitter.rb index d915485..c724702 100644 --- a/plugins/publish/twitter.rb +++ b/plugins/publish/twitter.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 5, 2013 # Updated:: May 5, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/store/database.rb b/plugins/store/database.rb index 826a88c..8b1d4fb 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -5,7 +5,7 @@ # soramugi # Created:: Feb 27, 2012 # Updated:: Jun 27, 2013 -# Copyright:: kzgs Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'active_record' diff --git a/plugins/store/full_text.rb b/plugins/store/full_text.rb index 2b4becb..b280154 100644 --- a/plugins/store/full_text.rb +++ b/plugins/store/full_text.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 26, 2012 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'plugins/store/database' diff --git a/plugins/store/permalink.rb b/plugins/store/permalink.rb index f714481..76d5e79 100644 --- a/plugins/store/permalink.rb +++ b/plugins/store/permalink.rb @@ -4,7 +4,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Sep 18, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'plugins/store/database' diff --git a/plugins/store/target_link.rb b/plugins/store/target_link.rb index 610b622..3e23116 100644 --- a/plugins/store/target_link.rb +++ b/plugins/store/target_link.rb @@ -4,7 +4,7 @@ # Author:: 774 # Created:: Feb 28, 2012 # Updated:: Feb 9, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'open-uri' diff --git a/plugins/subscription/feed.rb b/plugins/subscription/feed.rb index 752fb2a..6eb9fe2 100644 --- a/plugins/subscription/feed.rb +++ b/plugins/subscription/feed.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Feb 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/google_reader_star.rb b/plugins/subscription/google_reader_star.rb index 48d1749..7b1544e 100644 --- a/plugins/subscription/google_reader_star.rb +++ b/plugins/subscription/google_reader_star.rb @@ -4,7 +4,7 @@ # 774 # Created:: Feb 10, 2013 # Updated:: Feb 17, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index efece8c..1ea270a 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 18, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/pocket.rb b/plugins/subscription/pocket.rb index b9c9cbd..a802f86 100644 --- a/plugins/subscription/pocket.rb +++ b/plugins/subscription/pocket.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 21, 2013 # Updated:: May 21, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 9a6292b..837331b 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 6, 2013 # Updated:: May 6, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/tumblr.rb b/plugins/subscription/tumblr.rb index c1b0832..0e9179b 100644 --- a/plugins/subscription/tumblr.rb +++ b/plugins/subscription/tumblr.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Oct 16, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/twitter.rb b/plugins/subscription/twitter.rb index a330c00..3630675 100644 --- a/plugins/subscription/twitter.rb +++ b/plugins/subscription/twitter.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 9, 2012 # Updated:: Apr 5, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/twitter_search.rb b/plugins/subscription/twitter_search.rb index 6abdc08..ae0aedb 100644 --- a/plugins/subscription/twitter_search.rb +++ b/plugins/subscription/twitter_search.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 30, 2013 # Updated:: May 30, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/subscription/weather.rb b/plugins/subscription/weather.rb index 4469a0d..f3bf627 100644 --- a/plugins/subscription/weather.rb +++ b/plugins/subscription/weather.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 12, 2013 # Updated:: May 12, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/spec/lib/automatic/log_spec.rb b/spec/lib/automatic/log_spec.rb index ab34b8f..9d69716 100644 --- a/spec/lib/automatic/log_spec.rb +++ b/spec/lib/automatic/log_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 19, 2013 # Updated:: May 19, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper')) diff --git a/spec/lib/automatic/pipeline_spec.rb b/spec/lib/automatic/pipeline_spec.rb index bfd8957..cd4fd5a 100644 --- a/spec/lib/automatic/pipeline_spec.rb +++ b/spec/lib/automatic/pipeline_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Mar 10, 2012 # Updated:: Jun 16, 2012 -# Copyright:: ainame Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper')) diff --git a/spec/lib/automatic/recipe_spec.rb b/spec/lib/automatic/recipe_spec.rb index 1923da9..b77549d 100644 --- a/spec/lib/automatic/recipe_spec.rb +++ b/spec/lib/automatic/recipe_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 14, 2012 # Updated:: Jun 14, 2012 -# Copyright:: ainame Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper')) diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 0260709..7719f4b 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Mar 9, 2012 # Updated:: May 19, 2013 -# Copyright:: kzgs Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) diff --git a/spec/plugins/custom_feed/svn_log_spec.rb b/spec/plugins/custom_feed/svn_log_spec.rb index 381a70c..7d921f8 100644 --- a/spec/plugins/custom_feed/svn_log_spec.rb +++ b/spec/plugins/custom_feed/svn_log_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # Created:: Feb 29, 2012 # Updated:: Nov 3, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/absolute_uri_spec.rb b/spec/plugins/filter/absolute_uri_spec.rb index 5b06f1c..effdc53 100644 --- a/spec/plugins/filter/absolute_uri_spec.rb +++ b/spec/plugins/filter/absolute_uri_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 20, 2012 # Updated:: Sep 18, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/accept_spec.rb b/spec/plugins/filter/accept_spec.rb index bfa64dd..f767ad4 100644 --- a/spec/plugins/filter/accept_spec.rb +++ b/spec/plugins/filter/accept_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 4, 2013 # Updated:: Jun 4, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/full_feed_spec.rb b/spec/plugins/filter/full_feed_spec.rb index 9b106b3..dc1f66e 100644 --- a/spec/plugins/filter/full_feed_spec.rb +++ b/spec/plugins/filter/full_feed_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jan 24, 2013 # Updated:: May 23, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/github_feed_spec.rb b/spec/plugins/filter/github_feed_spec.rb index 517a818..61230ef 100644 --- a/spec/plugins/filter/github_feed_spec.rb +++ b/spec/plugins/filter/github_feed_spec.rb @@ -3,7 +3,7 @@ # Author:: Kohei Hasegawa # Created:: Jun 6, 2013 # Updated:: Jun 6, 2013 -# Copyright:: Kohei Hasegawa Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/ignore_spec.rb b/spec/plugins/filter/ignore_spec.rb index fbce869..5d6aacf 100644 --- a/spec/plugins/filter/ignore_spec.rb +++ b/spec/plugins/filter/ignore_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::Ignore # Author:: 774 # Updated:: Jan 19, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/image_source_spec.rb b/spec/plugins/filter/image_source_spec.rb index 35a3439..4c13dee 100644 --- a/spec/plugins/filter/image_source_spec.rb +++ b/spec/plugins/filter/image_source_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Mar 1, 2012 # Updated:: Jun 14, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/image_spec.rb b/spec/plugins/filter/image_spec.rb index 50c4f82..8c847e8 100644 --- a/spec/plugins/filter/image_spec.rb +++ b/spec/plugins/filter/image_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 18, 2012 # Updated:: Sep 18, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/one_spec.rb b/spec/plugins/filter/one_spec.rb index 62b7585..72bb9d5 100644 --- a/spec/plugins/filter/one_spec.rb +++ b/spec/plugins/filter/one_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 8, 2013 # Updated:: May 8, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/rand_spec.rb b/spec/plugins/filter/rand_spec.rb index 24273d0..1c07101 100644 --- a/spec/plugins/filter/rand_spec.rb +++ b/spec/plugins/filter/rand_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: May 6, 2013 # Updated:: Mar 7, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/sanitize_spec.rb b/spec/plugins/filter/sanitize_spec.rb index b39a380..59d4766 100644 --- a/spec/plugins/filter/sanitize_spec.rb +++ b/spec/plugins/filter/sanitize_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 20, 2013 # Updated:: Jun 20, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/sort_spec.rb b/spec/plugins/filter/sort_spec.rb index dfdbb99..9781b35 100644 --- a/spec/plugins/filter/sort_spec.rb +++ b/spec/plugins/filter/sort_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Mar 23, 2012 # Updated:: Jan 23, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/filter/tumblr_resize_spec.rb b/spec/plugins/filter/tumblr_resize_spec.rb index 1abb95d..d393908 100644 --- a/spec/plugins/filter/tumblr_resize_spec.rb +++ b/spec/plugins/filter/tumblr_resize_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::TumblrResize # Author:: 774 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/console_spec.rb b/spec/plugins/publish/console_spec.rb index 2e30e1b..c0ed5cc 100644 --- a/spec/plugins/publish/console_spec.rb +++ b/spec/plugins/publish/console_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Publish::Console # Author:: 774 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/eject_spec.rb b/spec/plugins/publish/eject_spec.rb index 5e30223..5b34301 100644 --- a/spec/plugins/publish/eject_spec.rb +++ b/spec/plugins/publish/eject_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 9, 2013 # Updated:: Jun 9, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/fluentd_spec.rb b/spec/plugins/publish/fluentd_spec.rb index e558ae9..4154762 100644 --- a/spec/plugins/publish/fluentd_spec.rb +++ b/spec/plugins/publish/fluentd_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 21, 2013 # Updated:: Jun 21, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/google_calendar_spec.rb b/spec/plugins/publish/google_calendar_spec.rb index b61718c..f53b404 100644 --- a/spec/plugins/publish/google_calendar_spec.rb +++ b/spec/plugins/publish/google_calendar_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # Created:: Feb 26, 2012 # Updated:: Mar 3, 2012 -# Copyright:: kzgs Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/hatena_bookmark_spec.rb b/spec/plugins/publish/hatena_bookmark_spec.rb index a4adf8d..08a2635 100644 --- a/spec/plugins/publish/hatena_bookmark_spec.rb +++ b/spec/plugins/publish/hatena_bookmark_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Feb 22, 2012 # Updated:: Mar 7, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/hipchat_spec.rb b/spec/plugins/publish/hipchat_spec.rb index cd98585..2710f11 100644 --- a/spec/plugins/publish/hipchat_spec.rb +++ b/spec/plugins/publish/hipchat_spec.rb @@ -3,7 +3,7 @@ # Author:: Kohei Hasegawa # Created:: Jun 5, 2013 # Updated:: Jun 5, 2013 -# Copyright:: Kohei Hasegawa Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/instapaper_spec.rb b/spec/plugins/publish/instapaper_spec.rb index 1cfa374..9d19bc3 100644 --- a/spec/plugins/publish/instapaper_spec.rb +++ b/spec/plugins/publish/instapaper_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Feb 9, 2013 # Updated:: Mar 22, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/mail_spec.rb b/spec/plugins/publish/mail_spec.rb index d488fe7..8bd3f8f 100644 --- a/spec/plugins/publish/mail_spec.rb +++ b/spec/plugins/publish/mail_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Publish::Mail # Author:: 774 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/memcached_spec.rb b/spec/plugins/publish/memcached_spec.rb index 998aa99..993f641 100644 --- a/spec/plugins/publish/memcached_spec.rb +++ b/spec/plugins/publish/memcached_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Jun 25, 2013 # Updated:: Jun 25, 2013 -# Copyright:: 774 Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/pocket_spec.rb b/spec/plugins/publish/pocket_spec.rb index 916e979..e2c855d 100644 --- a/spec/plugins/publish/pocket_spec.rb +++ b/spec/plugins/publish/pocket_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 15, 2013 # Updated:: May 15, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/smtp_spec.rb b/spec/plugins/publish/smtp_spec.rb index 2085cd5..bb2fb75 100644 --- a/spec/plugins/publish/smtp_spec.rb +++ b/spec/plugins/publish/smtp_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Publish::Mail # Author:: 774 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/publish/twitter_spec.rb b/spec/plugins/publish/twitter_spec.rb index aae6c89..64afb71 100644 --- a/spec/plugins/publish/twitter_spec.rb +++ b/spec/plugins/publish/twitter_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 5, 2013 # Updated:: May 5, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/store/full_text_spec.rb b/spec/plugins/store/full_text_spec.rb index 55c0093..62fd03a 100644 --- a/spec/plugins/store/full_text_spec.rb +++ b/spec/plugins/store/full_text_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Store::FullText # Author:: 774 # Updated:: Jun 14, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/store/permalink_spec.rb b/spec/plugins/store/permalink_spec.rb index a6dc6b2..73e8308 100644 --- a/spec/plugins/store/permalink_spec.rb +++ b/spec/plugins/store/permalink_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Store::Permalink # Author:: 774 # Updated:: Dec 17, 2012 -# Copyright:: 774 Copyright (c) 2012 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/store/target_link_spec.rb b/spec/plugins/store/target_link_spec.rb index 84811bb..3ebb0f8 100644 --- a/spec/plugins/store/target_link_spec.rb +++ b/spec/plugins/store/target_link_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Mar 4, 2012 # Updated:: May 1, 2013 -# Copyright:: kzgs Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/feed_spec.rb b/spec/plugins/subscription/feed_spec.rb index d18e2da..a0720e0 100644 --- a/spec/plugins/subscription/feed_spec.rb +++ b/spec/plugins/subscription/feed_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Feed # Author:: 774 # Updated:: Feb 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/google_reader_star_spec.rb b/spec/plugins/subscription/google_reader_star_spec.rb index 7f833b0..6af401e 100644 --- a/spec/plugins/subscription/google_reader_star_spec.rb +++ b/spec/plugins/subscription/google_reader_star_spec.rb @@ -4,7 +4,7 @@ # 774 # Created:: Feb 10, 2013 # Updated:: Feb 17, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/link_spec.rb b/spec/plugins/subscription/link_spec.rb index 202225d..bcb4568 100644 --- a/spec/plugins/subscription/link_spec.rb +++ b/spec/plugins/subscription/link_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 18, 2012 # Updated:: Feb 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/pocket_spec.rb b/spec/plugins/subscription/pocket_spec.rb index 39cdfd6..06adf15 100644 --- a/spec/plugins/subscription/pocket_spec.rb +++ b/spec/plugins/subscription/pocket_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 21, 2013 # Updated:: May 21, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/text_spec.rb b/spec/plugins/subscription/text_spec.rb index e2820d9..6e24533 100644 --- a/spec/plugins/subscription/text_spec.rb +++ b/spec/plugins/subscription/text_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 6, 2013 # Updated:: May 6, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/tumblr_spec.rb b/spec/plugins/subscription/tumblr_spec.rb index ce379d4..04454e2 100644 --- a/spec/plugins/subscription/tumblr_spec.rb +++ b/spec/plugins/subscription/tumblr_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Oct 16, 2012 # Updated:: Feb 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/twitter_search_spec.rb b/spec/plugins/subscription/twitter_search_spec.rb index dbbca8a..88b7161 100644 --- a/spec/plugins/subscription/twitter_search_spec.rb +++ b/spec/plugins/subscription/twitter_search_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 30, 2013 # Updated:: May 30, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/twitter_spec.rb b/spec/plugins/subscription/twitter_spec.rb index 3edb135..f39e812 100644 --- a/spec/plugins/subscription/twitter_spec.rb +++ b/spec/plugins/subscription/twitter_spec.rb @@ -3,7 +3,7 @@ # Author:: 774 # Created:: Sep 10, 2012 # Updated:: Feb 8, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') diff --git a/spec/plugins/subscription/weather_spec.rb b/spec/plugins/subscription/weather_spec.rb index c872eaa..10b2408 100644 --- a/spec/plugins/subscription/weather_spec.rb +++ b/spec/plugins/subscription/weather_spec.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: May 12, 2013 # Updated:: May 12, 2013 -# Copyright:: soramugi Copyright (c) 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') From 6be2191a6b61724b5037911f9c268289ae7fa306 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 14:56:49 +0900 Subject: [PATCH 032/188] 331 Mail Plugins including RC Bugs, temporary remove them --- plugins/publish/mail.rb | 64 ------------------------------- plugins/publish/smtp.rb | 48 ----------------------- spec/plugins/publish/mail_spec.rb | 54 -------------------------- spec/plugins/publish/smtp_spec.rb | 50 ------------------------ 4 files changed, 216 deletions(-) delete mode 100644 plugins/publish/mail.rb delete mode 100644 plugins/publish/smtp.rb delete mode 100644 spec/plugins/publish/mail_spec.rb delete mode 100644 spec/plugins/publish/smtp_spec.rb diff --git a/plugins/publish/mail.rb b/plugins/publish/mail.rb deleted file mode 100644 index 7ad96db..0000000 --- a/plugins/publish/mail.rb +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Publish::Mail -# Author:: 774 -# Created:: Apr 5, 2012 -# Updated:: Apr 5, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -module Automatic::Plugin - class PublishMail - require 'action_mailer' - - def initialize(config, pipeline=[]) - @config = config - @pipeline = pipeline - end - - def run - Mailer.smtp_settings = default_setting.update( - { - :port => @config["port"], - #:address => @config["address"], - #:authentication => @config["auth"], - #:user_name => @config["username"], - #:password => @config["password"], - #:domain => @config["domain"], - }) - - Mailer.raise_delivery_errors = true - @pipeline.each { |feeds| - unless feeds.nil? - feeds.items.each { |feed| - Mailer.notify(@config, feed) - } - end - } - @pipeline - end - - def default_setting - return {} - end - - class Mailer < ActionMailer::Base - def notify(option, feed) - m = mail( - :date => Time.now, - :subject => feed.title, - :to => option["mailto"], - #:cc => option["mailcc"], - #:bcc => option["mailbcc"], - :from => option["mailfrom"]) - - unless feed.content_encoded.nil? - m.body = feed.content_encoded - else - m.body = feed.description - end - - m.deliver - end - end - end -end diff --git a/plugins/publish/smtp.rb b/plugins/publish/smtp.rb deleted file mode 100644 index 7ba355b..0000000 --- a/plugins/publish/smtp.rb +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Publish::Smtp -# Author:: kzgs -# Created:: Mar 17, 2012 -# Updated:: Mar 17, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -module Automatic::Plugin - class PublishSmtp - require 'action_mailer' - - def initialize(config, pipeline=[]) - @config = config - @pipeline = pipeline - end - - def run - Mailer.smtp_settings = default_setting.update( - { - :port => @config["port"], - }) - Mailer.raise_delivery_errors = true - @pipeline.each { |feeds| - unless feeds.nil? - feeds.items.each { |feed| - Mailer.notify(@config, feed) - } - end - } - @pipeline - end - - def default_setting - return {} - end - - class Mailer < ActionMailer::Base - def notify(option, feed) - m = mail(:subject => option["subject"], - :to => option["mailto"], - :from => option["mailfrom"]) - m.body = feed.link - m.deliver - end - end - end -end diff --git a/spec/plugins/publish/mail_spec.rb b/spec/plugins/publish/mail_spec.rb deleted file mode 100644 index 8bd3f8f..0000000 --- a/spec/plugins/publish/mail_spec.rb +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Publish::Mail -# Author:: 774 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') - -require 'publish/mail' -require 'mocksmtpd' - -describe Automatic::Plugin::PublishMail do - before do - @pipeline = AutomaticSpec.generate_pipeline { - feed { item "http://github.com", - 'aaa', - 'bbb\n', - 'Mon, 30 Jan 2012 13:22:29 +0900' - } - } - end - - subject { - Automatic::Plugin::PublishMail.new({ - "port" => 25, - "mailto" => "", - "mailfrom" => "", - "subject" => "test" - }, @pipeline) - } - - it "should mail to smtp server" do - pending("Waiting for ActionMailer 4.0") - smtpd = SMTPServer.new({ - :Port => 10025, - :MailHook => lambda { |sender| sender.should == "" }, - :DataHook => lambda { |tmpf, sender, recipients| - tmpf.should include("github.com") - sender.should == "" - recipients.should == [""] - } - } - ) - Thread.start { - smtpd.start - } - loop do - break if smtpd.status == :Running - end - subject.run - smtpd.shutdown - end -end diff --git a/spec/plugins/publish/smtp_spec.rb b/spec/plugins/publish/smtp_spec.rb deleted file mode 100644 index bb2fb75..0000000 --- a/spec/plugins/publish/smtp_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Publish::Mail -# Author:: 774 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') - -require 'publish/smtp' -require 'mocksmtpd' - -describe Automatic::Plugin::PublishSmtp do - before do - @pipeline = AutomaticSpec.generate_pipeline { - feed { item "http://github.com" } - } - end - - subject { - Automatic::Plugin::PublishSmtp.new({ - "port" => 10025, - "mailto" => "to@example.com", - "mailfrom" => "from@example.com", - "subject" => "test" - }, @pipeline) - } - - it "should mail to smtp server" do - pending("Waiting for ActionMailer 4.0") - smtpd = SMTPServer.new({ - :Port => 10025, - :MailHook => lambda { |sender| sender.should == "from@example.com" }, - :DataHook => lambda { |tmpf, sender, recipients| - tmpf.should include("github.com") - sender.should == "from@example.com" - recipients.should == ["to@example.com"] - } - } - ) - Thread.start { - smtpd.start - } - loop do - break if smtpd.status == :Running - end - subject.run - smtpd.shutdown - end -end From 02d5ce3e3dc2c801c9f190e4da8c94cae607b210 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 14:59:26 +0900 Subject: [PATCH 033/188] 332 Fix builder version --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index eb06b6c..867b8b7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20130626 +# Version:20130627 source "http://rubygems.org" source "http://gems.github.com" @@ -31,6 +31,6 @@ end group :development do gem "cucumber" gem 'bundler', '~>1.3.5' - gem 'builder', '~>3.1.0' + gem 'builder', '~>3.2.0' gem "jeweler" end From 9632cea53a3a3cb3671504fa60bde8cabf36279a Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 27 Jun 2013 15:10:32 +0900 Subject: [PATCH 034/188] 333 Version bump to 13.6.0 --- VERSION | 2 +- doc/ChangeLog | 6 +++++- lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index d224e69..fc9c00c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.5.0 +13.6.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index 88af84b..7512301 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,4 @@ -=== 13.6.0 / 2013-06-xx +=== 13.6.0 / 2013-06-28 * Added new plugins. @@ -14,6 +14,10 @@ * And other Improvements, bug fixes. +* Correspond to activesupport & activerecord 4.0. + + * Mail plugins temporary removed (for actionmailer 4.0). + * Ruby 1.8 support was outdated. diff --git a/lib/automatic.rb b/lib/automatic.rb index 552ff8b..a70407f 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: May 19, 2013 +# Updated:: Jun 27, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.5.0-devel" + VERSION = "13.6.0" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 7719f4b..6f067c9 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: May 19, 2013 +# Updated:: Jun 27, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -26,7 +26,7 @@ describe "#version" do specify { - Automatic.const_get(:VERSION).should == "13.5.0-devel" + Automatic.const_get(:VERSION).should == "13.6.0" } end From 34b9742006969d49eb3cd7358353a7326110cd39 Mon Sep 17 00:00:00 2001 From: soramugi Date: Fri, 28 Jun 2013 03:25:27 +0900 Subject: [PATCH 035/188] Add plugins subscription Gguide --- plugins/subscription/g_guide.rb | 49 ++++++++++++++ spec/plugins/subscription/g_guide_spec.rb | 78 +++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 plugins/subscription/g_guide.rb create mode 100644 spec/plugins/subscription/g_guide_spec.rb diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb new file mode 100644 index 0000000..b038043 --- /dev/null +++ b/plugins/subscription/g_guide.rb @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::GGuide +# Author:: soramugi +# Created:: Jun 28, 2013 +# Updated:: Jun 28, 2013 +# Copyright:: Copyright (c) 2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class SubscriptionGGuide + G_GUIDE_RSS = 'http://tv.so-net.ne.jp/rss/schedulesBySearch.action?' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + retries = 0 + begin + @pipeline << Automatic::FeedParser.get(feed_url) + rescue + retries += 1 + Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") + sleep @config['interval'].to_i unless @config['interval'].nil? + retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + end + + @pipeline + end + + def feed_url + feed = G_GUIDE_RSS + unless @config['keyword'].nil? + feed += "condition.keyword=#{@config['keyword']}&" + end + feed += station_param + URI.encode(feed) + end + + def station_param + station = 0 + unless @config['station'].nil? + station = '1' if @config['station'] == '地上波' + end + "stationPlatformId=#{station}&" + end + end +end diff --git a/spec/plugins/subscription/g_guide_spec.rb b/spec/plugins/subscription/g_guide_spec.rb new file mode 100644 index 0000000..22d8bf7 --- /dev/null +++ b/spec/plugins/subscription/g_guide_spec.rb @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::g_guide +# Author:: soramugi +# Created:: May 21, 2013 +# Updated:: May 21, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'subscription/g_guide' + +def g_guide(config = {}, pipeline = []) + Automatic::Plugin::SubscriptionGGuide.new(config,pipeline) +end + +describe 'Automatic::Plugin::SubscriptionGGuide' do + context 'when config' do + describe 'is empty' do + subject { g_guide } + + its(:feed_url) { + should == Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + + 'stationPlatformId=0&' + } + end + describe 'keyword is anime' do + config = { 'keyword' => 'anime' } + subject { g_guide(config) } + + its(:feed_url) { + should == URI.encode( + Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + + "condition.keyword=#{config['keyword']}&" + + 'stationPlatformId=0&') + } + end + describe 'station is 地上波' do + config = { 'station' => '地上波' } + subject { g_guide(config) } + + its(:feed_url) { + should == URI.encode( + Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + + 'stationPlatformId=1&') + } + end + end + context 'when feed is empty' do + + describe 'attestation error' do + subject { g_guide } + before do + subject.should_receive(:feed_url).and_return('') + end + its(:run) { should be_empty } + end + + describe 'interval & retry was used error' do + config = {'interval' => 1, 'retry' => 1} + subject { g_guide(config) } + before do + subject.should_receive(:feed_url).exactly(2).times.and_return('') + end + its(:run) { should be_empty } + end + + end + + context 'when feed' do + describe 'config keyword' do + config = { 'keyword' => 'アニメ', 'station' => '地上波' } + subject { g_guide(config) } + its(:run) { should have(1).feed } + end + + end +end From e0b2fabfe66c57b23845099dd445ecac72b0477b Mon Sep 17 00:00:00 2001 From: soramugi Date: Fri, 28 Jun 2013 04:28:47 +0900 Subject: [PATCH 036/188] Add plugins CHAN-TORU --- plugins/subscription/chan_toru.rb | 56 +++++++++++++++++++ spec/plugins/subscription/chan_toru_spec.rb | 59 +++++++++++++++++++++ test/integration/test_chan_toru.yml | 18 +++++++ 3 files changed, 133 insertions(+) create mode 100644 plugins/subscription/chan_toru.rb create mode 100644 spec/plugins/subscription/chan_toru_spec.rb create mode 100644 test/integration/test_chan_toru.yml diff --git a/plugins/subscription/chan_toru.rb b/plugins/subscription/chan_toru.rb new file mode 100644 index 0000000..b177fab --- /dev/null +++ b/plugins/subscription/chan_toru.rb @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::ChanToru +# Author:: soramugi +# Created:: Jun 28, 2013 +# Updated:: Jun 28, 2013 +# Copyright:: Copyright (c) 2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '/g_guide') + +module Automatic::Plugin + class SubscriptionChanToru + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def g_guide_pipeline + SubscriptionGGuide.new(@config, @pipeline).run + end + + def run + retries = 0 + begin + pipeline = g_guide_pipeline + pipeline.each {|feeds| + feeds.items.each {|feed| + feed = link_change(feed) + } + } + @pipeline = pipeline + rescue + retries += 1 + Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") + sleep @config['interval'].to_i unless @config['interval'].nil? + retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + end + + @pipeline + end + + def link_change(feed) + feed.link.gsub(/([0-9]+)/) do |pid| + if pid != '' + feed.link = "https://tv.so-net.ne.jp/chan-toru/intent" + + "?cat=1&area=23&pid=#{pid}&from=tw" + else + feed.link = nil + end + end + feed + end + + end +end diff --git a/spec/plugins/subscription/chan_toru_spec.rb b/spec/plugins/subscription/chan_toru_spec.rb new file mode 100644 index 0000000..02da31a --- /dev/null +++ b/spec/plugins/subscription/chan_toru_spec.rb @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::g_guide +# Author:: soramugi +# Created:: May 21, 2013 +# Updated:: May 21, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'subscription/chan_toru' + +def chan_toru(config = {}, pipeline = []) + Automatic::Plugin::SubscriptionChanToru.new(config,pipeline) +end + +describe 'Automatic::Plugin::SubscriptionChanToru' do + context 'when feed is empty' do + + describe 'attestation error' do + subject { chan_toru } + before do + subject.should_receive(:g_guide_pipeline).times.and_return([]) + end + its(:run) { should be_empty } + end + + describe 'interval & retry was used error' do + config = {'interval' => 1, 'retry' => 1} + subject { chan_toru(config) } + before do + subject. + should_receive(:g_guide_pipeline). + exactly(2). + times.and_return('') + end + its(:run) { should be_empty } + end + + end + + context 'when feed' do + describe 'config keyword' do + subject { chan_toru } + before do + pipeline = AutomaticSpec.generate_pipeline { + feed { + item "http://soramugi.net/images/hugehuge" + item "http://tv.so-net.ne.jp/schedule/500333201307052330.action?from=rss" + }} + subject. + should_receive(:g_guide_pipeline). + times.and_return(pipeline) + end + its(:run) { should have(1).feed } + end + + end +end diff --git a/test/integration/test_chan_toru.yml b/test/integration/test_chan_toru.yml new file mode 100644 index 0000000..05703db --- /dev/null +++ b/test/integration/test_chan_toru.yml @@ -0,0 +1,18 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: none + +plugins: + - module: SubscriptionChanToru + config: + keyword: 'アニメ' + station: '地上波' + + - module: StorePermalink + config: + db: test_chan_toru.db + + #- module: PublishConsoleLink From dacc964895b1465c8851f967e7ab69d6a46470d4 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 08:43:59 +0900 Subject: [PATCH 037/188] 334 Bundle update in the CI script --- script/build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/build b/script/build index 45dd9c8..aaf7139 100755 --- a/script/build +++ b/script/build @@ -6,6 +6,8 @@ # # Maintainer: id774 # +# v1.5 6/28,2013 +# Always using latest gems. # v1.4 5/13,2013 # Fix bundler environment. # v1.3 2/26,2013 @@ -29,6 +31,7 @@ kickstart() { exec_rspec() { $RACK_ROOT/bin/automatic -v bundle install --path vendor/gems + bundle update bundle exec rake simplecov } From a2d943649b4ca4cfdd70c99de068aa591f45b99c Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 08:53:53 +0900 Subject: [PATCH 038/188] 334 Bundle update in the CI script --- script/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build b/script/build index aaf7139..951f485 100755 --- a/script/build +++ b/script/build @@ -30,8 +30,8 @@ kickstart() { exec_rspec() { $RACK_ROOT/bin/automatic -v + rm Gemfile.lock bundle install --path vendor/gems - bundle update bundle exec rake simplecov } From 577c2184ca781eb88f085a7be3e6c79e2d389781 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 09:04:17 +0900 Subject: [PATCH 039/188] 335 Fix builder version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 867b8b7..d54a312 100644 --- a/Gemfile +++ b/Gemfile @@ -31,6 +31,6 @@ end group :development do gem "cucumber" gem 'bundler', '~>1.3.5' - gem 'builder', '~>3.2.0' + gem 'builder', '~>3.1.0' gem "jeweler" end From e76c0d49929d1582b70c957ac9bac5bb32da759c Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 09:06:20 +0900 Subject: [PATCH 040/188] 336 Bundle update in the CI script --- script/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build b/script/build index 951f485..aaf7139 100755 --- a/script/build +++ b/script/build @@ -30,8 +30,8 @@ kickstart() { exec_rspec() { $RACK_ROOT/bin/automatic -v - rm Gemfile.lock bundle install --path vendor/gems + bundle update bundle exec rake simplecov } From 775990f7e5bb241a4b7812f51c963eee13df04ea Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 09:57:55 +0900 Subject: [PATCH 041/188] 337 Change log messagges --- plugins/subscription/google_reader_star.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/subscription/google_reader_star.rb b/plugins/subscription/google_reader_star.rb index 7b1544e..36f2f5c 100644 --- a/plugins/subscription/google_reader_star.rb +++ b/plugins/subscription/google_reader_star.rb @@ -3,7 +3,7 @@ # Author:: soramugi # 774 # Created:: Feb 10, 2013 -# Updated:: Feb 17, 2013 +# Updated:: Jun 28, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -46,7 +46,7 @@ def parse(feeds = []) unless feeds.nil? feeds.each {|feed| unless feed.link.href.nil? - Automatic::Log.puts("info", "Creating: #{feed.link.href}") + Automatic::Log.puts("info", "Feed: #{feed.link.href}") item = maker.items.new_item item.title = feed.title.content # google reader feed item.link = feed.link.href # google reader feed From c40ee811ad63c99f706676c62c48bfcdc59a87fa Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 10:54:01 +0900 Subject: [PATCH 042/188] 338 Fix README --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 7ad38b2..15e94fa 100644 --- a/README.md +++ b/README.md @@ -127,11 +127,7 @@ See doc/AUTHORS or following link. + https://github.com/automaticruby?tab=members - -Author ------- - -**774** +Project created by + http://id774.net + http://github.com/id774 From e6df819b4f7bf2796282abdbb66b59cfdb126b5e Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 11:26:34 +0900 Subject: [PATCH 043/188] 339 Clean up --- plugins/filter/full_feed.rb | 2 +- plugins/filter/image_source.rb | 3 ++- plugins/publish/console_link.rb | 4 ++-- plugins/publish/eject.rb | 4 ++-- plugins/store/full_text.rb | 2 +- plugins/store/target_link.rb | 2 +- spec/plugins/publish/instapaper_spec.rb | 16 +++++----------- spec/plugins/publish/pocket_spec.rb | 4 ++-- 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/plugins/filter/full_feed.rb b/plugins/filter/full_feed.rb index 9101864..c667afb 100644 --- a/plugins/filter/full_feed.rb +++ b/plugins/filter/full_feed.rb @@ -57,7 +57,7 @@ def assets_dir def fulltext(feed) return feed unless feed.link - @siteinfo.each { |info| + @siteinfo.each {|info| begin if feed.link.match(info['data']['url']) Automatic::Log.puts(:info, "Siteinfo matched: #{info['data']['url']}") diff --git a/plugins/filter/image_source.rb b/plugins/filter/image_source.rb index e291849..da3233f 100644 --- a/plugins/filter/image_source.rb +++ b/plugins/filter/image_source.rb @@ -40,9 +40,10 @@ def run end private + def rewrite_link(feed) array = Array.new - feed.description.scan(/ 5, 'retry' => 5 }, - AutomaticSpec.generate_pipeline{ + AutomaticSpec.generate_pipeline { feed { item "http://github.com" } - } - ) - } + })} it "should post the link in the feed" do instapaper = mock("instapaper") @@ -42,11 +40,9 @@ 'interval' => 1, 'retry' => 1 }, - AutomaticSpec.generate_pipeline{ + AutomaticSpec.generate_pipeline { feed { item "http://github.com" } - } - ) - } + })} its (:run) { subject.run.should have(1).feed } end @@ -60,9 +56,7 @@ 'password' => "pswd", 'interval' => 5, 'retry' => 5 - } - ) - } + })} url = "http://www.google.com" title = "automatic test" diff --git a/spec/plugins/publish/pocket_spec.rb b/spec/plugins/publish/pocket_spec.rb index e2c855d..3940408 100644 --- a/spec/plugins/publish/pocket_spec.rb +++ b/spec/plugins/publish/pocket_spec.rb @@ -19,9 +19,9 @@ 'interval' => 1, 'retry' => 1 }, - AutomaticSpec.generate_pipeline{ + AutomaticSpec.generate_pipeline { feed { item "http://github.com" } - }) } + })} it "should post the link in the feed" do client = mock("client") From 78e4a622aa5c95b598652f935f94c47ce20d23ec Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 11:32:29 +0900 Subject: [PATCH 044/188] 339 Clean up --- spec/plugins/subscription/tumblr_spec.rb | 3 ++- spec/plugins/subscription/twitter_spec.rb | 3 ++- spec/plugins/subscription/weather_spec.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/plugins/subscription/tumblr_spec.rb b/spec/plugins/subscription/tumblr_spec.rb index 04454e2..7b17c3f 100644 --- a/spec/plugins/subscription/tumblr_spec.rb +++ b/spec/plugins/subscription/tumblr_spec.rb @@ -14,7 +14,8 @@ context "with empty URLs" do subject { Automatic::Plugin::SubscriptionTumblr.new( - { 'urls' => [] }) + { 'urls' => [] } + ) } its(:run) { should be_empty } diff --git a/spec/plugins/subscription/twitter_spec.rb b/spec/plugins/subscription/twitter_spec.rb index f39e812..f43c982 100644 --- a/spec/plugins/subscription/twitter_spec.rb +++ b/spec/plugins/subscription/twitter_spec.rb @@ -14,7 +14,8 @@ context "with empty URLs" do subject { Automatic::Plugin::SubscriptionTwitter.new( - { 'urls' => [] }) + { 'urls' => [] } + ) } its(:run) { should be_empty } diff --git a/spec/plugins/subscription/weather_spec.rb b/spec/plugins/subscription/weather_spec.rb index 10b2408..b6f7f9a 100644 --- a/spec/plugins/subscription/weather_spec.rb +++ b/spec/plugins/subscription/weather_spec.rb @@ -14,7 +14,7 @@ context "with empty zipcode" do subject { Automatic::Plugin::SubscriptionWeather.new( - { } + {} ) } From 523deb3a279ab2226c98778dfeaf8c4e9ea04344 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 11:34:47 +0900 Subject: [PATCH 045/188] 340 Refactoring --- plugins/filter/sanitize.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index f9a65b9..278d93d 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -41,11 +41,10 @@ def run def sanitize(feed) begin feed.description = Sanitize.clean(feed.description, @mode) unless feed.description.nil? - return feed rescue Automatic::Log.puts("warn", "Undefined field detected in feed.") - return feed end + feed end end end From 1ff38e9f9de3e299261ee42ae11c8f2efa079974 Mon Sep 17 00:00:00 2001 From: cube Date: Fri, 28 Jun 2013 12:02:46 +0900 Subject: [PATCH 046/188] doc CHAN-TORU G-guide --- doc/PLUGINS | 35 +++++++++++++++++++++++++++++++++++ doc/PLUGINS.ja | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index f4c97d2..1a0c69b 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -176,6 +176,41 @@ SubscriptionPocket retry: RETRY_COUNT +SubscriptionGGuide +------------------ +[Path] + /plugins/subscription/g_guide.rb + +[Abstract] + search keyword to the G guide (information on a TV program) rss + +[Syntax] + - module: SubscriptionGGuide + config: + keyword: 'anime' # search word + station: '地上波' + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + +SubscriptionChanToru +------------------ +[Path] + /plugins/subscription/chan_toru.rb + +[Abstract] + search keyword to CHAN-TORU (information on a TV program) rss + (SubscriptionGGuide Plug-in dependence) + +[Syntax] + - module: SubscriptionChanToru + config: + keyword: 'anime' # search word + station: '地上波' + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + FilterSort ---------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index f82df97..7380e02 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -157,6 +157,7 @@ SubscriptionText SubscriptionPocket + 検索キーワードからCHAN-TORUページの取得(Gk) ------------------ [パス] /plugins/subscription/pocket.rb @@ -176,6 +177,41 @@ SubscriptionPocket retry: エラー時のリトライ回数 (回数, 省略時 0) +SubscriptionGGuide +------------------ +[パス] + /plugins/subscription/g_guide.rb + +[概要] + 検索キーワードからGガイド(テレビ番組の情報)rssの取得 + +[レシピ記法] + - module: SubscriptionGGuide + config: + keyword: 'アニメ' # 検索ワード + station: '地上波' # 衛星放送の区域(現在は地上波のみ対応) + interval: スクレイピングの間隔 (秒数, 省略可) + retry: エラー時のリトライ回数 (回数, 省略時 0) + + +SubscriptionChanToru +------------------ +[パス] + /plugins/subscription/chan_toru.rb + +[概要] + 検索キーワードからCHAN-TORU(テレビ番組の情報)rssの取得 + (SubscriptionGGuideプラグイン依存) + +[レシピ記法] + - module: SubscriptionChanToru + config: + keyword: 'アニメ' # 検索ワード + station: '地上波' # 衛星放送の区域(現在は地上波のみ対応) + interval: スクレイピングの間隔 (秒数, 省略可) + retry: エラー時のリトライ回数 (回数, 省略時 0) + + FilterSort ---------- [パス] From 10b49b12d582938cb4b649a5d36138000ad0c4e7 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 13:04:13 +0900 Subject: [PATCH 047/188] 341 Fix encode --- test/integration/test_chan_toru.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration/test_chan_toru.yml b/test/integration/test_chan_toru.yml index 05703db..792808c 100644 --- a/test/integration/test_chan_toru.yml +++ b/test/integration/test_chan_toru.yml @@ -16,3 +16,4 @@ plugins: db: test_chan_toru.db #- module: PublishConsoleLink + From a100db9f33075a102cc417d730e8b9cb457ab74b Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 13:12:19 +0900 Subject: [PATCH 048/188] 342 Fix docs --- doc/PLUGINS | 6 +++--- doc/PLUGINS.ja | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index 1a0c69b..7223b6f 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -194,19 +194,19 @@ SubscriptionGGuide SubscriptionChanToru ------------------- +-------------------- [Path] /plugins/subscription/chan_toru.rb [Abstract] - search keyword to CHAN-TORU (information on a TV program) rss + Search keyword to CHAN-TORU (information on a TV program) rss (SubscriptionGGuide Plug-in dependence) [Syntax] - module: SubscriptionChanToru config: keyword: 'anime' # search word - station: '地上波' + station: '地上波' # (It means terrestrial broadcasting in Japanese.) interval: INTERVAL_FOR_SCRAPING (in seconds.) retry: RETRY_COUNT diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 7380e02..36a6db5 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -195,7 +195,7 @@ SubscriptionGGuide SubscriptionChanToru ------------------- +-------------------- [パス] /plugins/subscription/chan_toru.rb From 769fb41b86fae061650f8003437595decfe0518f Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 13:13:11 +0900 Subject: [PATCH 049/188] 343 Append ChangeLog --- doc/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7512301..6602baf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -4,6 +4,8 @@ * Subscription::Pocket * Subscription::TwitterSearch + * Subscription::GGuide + * Subscription::ChanToru * Filter::Accept * Filter::Sanitize * Filter::GithubFeed From 40785cb5d81c2cca0a0f4b1f6e78245b307e0d2c Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 13:37:43 +0900 Subject: [PATCH 050/188] 344 Update Gemfile --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d54a312..6419416 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,9 @@ -# Version:20130627 +# Version:20130628 source "http://rubygems.org" source "http://gems.github.com" +gem 'json', '~> 1.7.7' gem 'sqlite3' gem 'activesupport', '~>4.0.0' gem 'activerecord', '~>4.0.0' From 2f0e0a004c222ee5d27990e38757194ccecd3e2c Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 14:26:32 +0900 Subject: [PATCH 051/188] 345 Fix doc --- doc/PLUGINS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index 7223b6f..e1666dc 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -188,7 +188,7 @@ SubscriptionGGuide - module: SubscriptionGGuide config: keyword: 'anime' # search word - station: '地上波' + station: '地上波' # (It means terrestrial broadcasting in Japanese.) interval: INTERVAL_FOR_SCRAPING (in seconds.) retry: RETRY_COUNT From 82c2e70b1b6b3cbcb784d5a8ad95eaec10676687 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 14:32:37 +0900 Subject: [PATCH 052/188] 346 Fix headers --- plugins/subscription/chan_toru.rb | 2 +- plugins/subscription/g_guide.rb | 2 +- spec/plugins/subscription/chan_toru_spec.rb | 6 +++--- spec/plugins/subscription/g_guide_spec.rb | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/subscription/chan_toru.rb b/plugins/subscription/chan_toru.rb index b177fab..827f1e0 100644 --- a/plugins/subscription/chan_toru.rb +++ b/plugins/subscription/chan_toru.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 28, 2013 # Updated:: Jun 28, 2013 -# Copyright:: Copyright (c) 2013 Automatic Ruby Developers. +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '/g_guide') diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index b038043..94da8ea 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -3,7 +3,7 @@ # Author:: soramugi # Created:: Jun 28, 2013 # Updated:: Jun 28, 2013 -# Copyright:: Copyright (c) 2013 Automatic Ruby Developers. +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/spec/plugins/subscription/chan_toru_spec.rb b/spec/plugins/subscription/chan_toru_spec.rb index 02da31a..ed59288 100644 --- a/spec/plugins/subscription/chan_toru_spec.rb +++ b/spec/plugins/subscription/chan_toru_spec.rb @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Subscription::g_guide +# Name:: Automatic::Plugin::Subscription::ChanToru # Author:: soramugi -# Created:: May 21, 2013 -# Updated:: May 21, 2013 +# Created:: Jun 28, 2013 +# Updated:: Jun 28, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. diff --git a/spec/plugins/subscription/g_guide_spec.rb b/spec/plugins/subscription/g_guide_spec.rb index 22d8bf7..2ce9e39 100644 --- a/spec/plugins/subscription/g_guide_spec.rb +++ b/spec/plugins/subscription/g_guide_spec.rb @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Subscription::g_guide +# Name:: Automatic::Plugin::Subscription::GGuide # Author:: soramugi -# Created:: May 21, 2013 -# Updated:: May 21, 2013 +# Created:: Jun 28, 2013 +# Updated:: Jun 28, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. From 51c4f205e196bf70e0803adffde83856edb1b420 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 14:44:05 +0900 Subject: [PATCH 053/188] 347 Clean up --- plugins/subscription/g_guide.rb | 23 ++++++++++----------- plugins/subscription/pocket.rb | 2 -- plugins/subscription/text.rb | 1 - plugins/subscription/weather.rb | 2 -- spec/plugins/subscription/chan_toru_spec.rb | 3 --- spec/plugins/subscription/g_guide_spec.rb | 4 +--- spec/plugins/subscription/pocket_spec.rb | 4 ---- 7 files changed, 12 insertions(+), 27 deletions(-) diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index 94da8ea..b4e79bc 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -25,25 +25,24 @@ def run sleep @config['interval'].to_i unless @config['interval'].nil? retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - @pipeline end def feed_url - feed = G_GUIDE_RSS - unless @config['keyword'].nil? - feed += "condition.keyword=#{@config['keyword']}&" - end - feed += station_param - URI.encode(feed) + feed = G_GUIDE_RSS + unless @config['keyword'].nil? + feed += "condition.keyword=#{@config['keyword']}&" + end + feed += station_param + URI.encode(feed) end def station_param - station = 0 - unless @config['station'].nil? - station = '1' if @config['station'] == '地上波' - end - "stationPlatformId=#{station}&" + station = 0 + unless @config['station'].nil? + station = '1' if @config['station'] == '地上波' + end + "stationPlatformId=#{station}&" end end end diff --git a/plugins/subscription/pocket.rb b/plugins/subscription/pocket.rb index a802f86..684358e 100644 --- a/plugins/subscription/pocket.rb +++ b/plugins/subscription/pocket.rb @@ -31,14 +31,12 @@ def run sleep @config['interval'].to_i unless @config['interval'].nil? retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - @pipeline end def cleate_dummy_feed(retrieve) dummyFeeds = [] retrieve['list'].each {|key,list| - dummy = Hashie::Mash.new dummy.title = list['given_title'] dummy.link = list['given_url'] diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 837331b..6510bd9 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -70,7 +70,6 @@ def run if @dummyfeeds != [] @pipeline << Automatic::FeedParser.create(@dummyfeeds) end - @pipeline end end diff --git a/plugins/subscription/weather.rb b/plugins/subscription/weather.rb index f3bf627..825eb14 100644 --- a/plugins/subscription/weather.rb +++ b/plugins/subscription/weather.rb @@ -21,13 +21,11 @@ def initialize(config, pipeline=[]) def run weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil? if weather != nil - dummy = Hashie::Mash.new dummy.title = weather dummy.link = 'http://weather.dummy.' + @day @pipeline << Automatic::FeedParser.create([dummy]) end - @pipeline end end diff --git a/spec/plugins/subscription/chan_toru_spec.rb b/spec/plugins/subscription/chan_toru_spec.rb index ed59288..b2d204d 100644 --- a/spec/plugins/subscription/chan_toru_spec.rb +++ b/spec/plugins/subscription/chan_toru_spec.rb @@ -16,7 +16,6 @@ def chan_toru(config = {}, pipeline = []) describe 'Automatic::Plugin::SubscriptionChanToru' do context 'when feed is empty' do - describe 'attestation error' do subject { chan_toru } before do @@ -36,7 +35,6 @@ def chan_toru(config = {}, pipeline = []) end its(:run) { should be_empty } end - end context 'when feed' do @@ -54,6 +52,5 @@ def chan_toru(config = {}, pipeline = []) end its(:run) { should have(1).feed } end - end end diff --git a/spec/plugins/subscription/g_guide_spec.rb b/spec/plugins/subscription/g_guide_spec.rb index 2ce9e39..0fafa09 100644 --- a/spec/plugins/subscription/g_guide_spec.rb +++ b/spec/plugins/subscription/g_guide_spec.rb @@ -46,8 +46,8 @@ def g_guide(config = {}, pipeline = []) } end end - context 'when feed is empty' do + context 'when feed is empty' do describe 'attestation error' do subject { g_guide } before do @@ -64,7 +64,6 @@ def g_guide(config = {}, pipeline = []) end its(:run) { should be_empty } end - end context 'when feed' do @@ -73,6 +72,5 @@ def g_guide(config = {}, pipeline = []) subject { g_guide(config) } its(:run) { should have(1).feed } end - end end diff --git a/spec/plugins/subscription/pocket_spec.rb b/spec/plugins/subscription/pocket_spec.rb index 06adf15..420dd16 100644 --- a/spec/plugins/subscription/pocket_spec.rb +++ b/spec/plugins/subscription/pocket_spec.rb @@ -16,7 +16,6 @@ def pocket(config = {}, pipeline = []) describe 'Automatic::Plugin::SubscriptionPocket' do context 'when feed is empty' do - describe 'attestation error' do subject { pocket } @@ -29,11 +28,9 @@ def pocket(config = {}, pipeline = []) its(:run) { should be_empty } end - end context 'when feed' do - describe 'config optional' do config = { 'optional' => { 'count' => 1, @@ -56,6 +53,5 @@ def pocket(config = {}, pipeline = []) its(:run) { should have(1).item } end - end end From 284dccd27a4f52bb2a789157098b4bd6791c7eb6 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 14:48:01 +0900 Subject: [PATCH 054/188] 347 Clean up --- plugins/custom_feed/svn_log.rb | 4 ++-- plugins/publish/console.rb | 4 ++-- spec/plugins/notify/ikachan_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/custom_feed/svn_log.rb b/plugins/custom_feed/svn_log.rb index 9fb1a9f..6210a01 100644 --- a/plugins/custom_feed/svn_log.rb +++ b/plugins/custom_feed/svn_log.rb @@ -19,12 +19,12 @@ def initialize(config, pipeline=[]) def run revisions = XmlSimple.xml_in(`svn log #{svn_log_argument}`)["logentry"] - @pipeline << RSS::Maker.make("1.0") { |maker| + @pipeline << RSS::Maker.make("1.0") {|maker| maker.channel.title = @config["title"] || "" maker.channel.about = "" maker.channel.description = "" maker.channel.link = base_url - revisions.each { |rev| + revisions.each {|rev| item = maker.items.new_item item.title = "#{rev["msg"]} by #{rev["author"]}" item.link = base_url+"/!svn/bc/#{rev["revision"]}" diff --git a/plugins/publish/console.rb b/plugins/publish/console.rb index cef2ea9..700d664 100644 --- a/plugins/publish/console.rb +++ b/plugins/publish/console.rb @@ -17,9 +17,9 @@ def initialize(config, pipeline=[]) end def run - @pipeline.each { |feeds| + @pipeline.each {|feeds| unless feeds.nil? - feeds.items.each { |feed| + feeds.items.each {|feed| @output.puts("info", feed.pretty_inspect) } end diff --git a/spec/plugins/notify/ikachan_spec.rb b/spec/plugins/notify/ikachan_spec.rb index c5de16a..3173654 100644 --- a/spec/plugins/notify/ikachan_spec.rb +++ b/spec/plugins/notify/ikachan_spec.rb @@ -30,7 +30,7 @@ describe Automatic::Plugin::Ikachan do describe "#post" do subject { - Automatic::Plugin::Ikachan.new.tap { |ikachan| + Automatic::Plugin::Ikachan.new.tap {|ikachan| ikachan.params = { "channels" => "#room", "url" => "http://sample.com", From f9123daadcf36bb954586480872e2c4678d76697 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 28 Jun 2013 15:58:29 +0900 Subject: [PATCH 055/188] Regenerate gemspec for version 13.6.0 --- automatic.gemspec | 79 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index acb0b4f..95b308d 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = "automatic" - s.version = "13.5.0" + s.version = "13.6.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["id774"] - s.date = "2013-05-18" + s.date = "2013-06-28" s.description = "Ruby General Automation Framework" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -42,66 +42,86 @@ Gem::Specification.new do |s| "lib/automatic/recipe.rb", "plugins/custom_feed/svn_log.rb", "plugins/filter/absolute_uri.rb", + "plugins/filter/accept.rb", "plugins/filter/full_feed.rb", + "plugins/filter/github_feed.rb", "plugins/filter/ignore.rb", "plugins/filter/image.rb", "plugins/filter/image_source.rb", "plugins/filter/one.rb", "plugins/filter/rand.rb", + "plugins/filter/sanitize.rb", "plugins/filter/sort.rb", "plugins/filter/tumblr_resize.rb", "plugins/notify/ikachan.rb", "plugins/publish/console.rb", + "plugins/publish/console_link.rb", + "plugins/publish/eject.rb", + "plugins/publish/fluentd.rb", "plugins/publish/google_calendar.rb", "plugins/publish/hatena_bookmark.rb", + "plugins/publish/hipchat.rb", "plugins/publish/instapaper.rb", - "plugins/publish/mail.rb", + "plugins/publish/memcached.rb", "plugins/publish/pocket.rb", - "plugins/publish/smtp.rb", "plugins/publish/twitter.rb", "plugins/store/database.rb", "plugins/store/full_text.rb", "plugins/store/permalink.rb", "plugins/store/target_link.rb", + "plugins/subscription/chan_toru.rb", "plugins/subscription/feed.rb", + "plugins/subscription/g_guide.rb", "plugins/subscription/google_reader_star.rb", "plugins/subscription/link.rb", + "plugins/subscription/pocket.rb", "plugins/subscription/text.rb", "plugins/subscription/tumblr.rb", "plugins/subscription/twitter.rb", + "plugins/subscription/twitter_search.rb", "plugins/subscription/weather.rb", "script/build", "spec/fixtures/sampleRecipe.yml", + "spec/lib/automatic/log_spec.rb", "spec/lib/automatic/pipeline_spec.rb", "spec/lib/automatic/recipe_spec.rb", "spec/lib/automatic_spec.rb", "spec/plugins/custom_feed/svn_log_spec.rb", "spec/plugins/filter/absolute_uri_spec.rb", + "spec/plugins/filter/accept_spec.rb", "spec/plugins/filter/full_feed_spec.rb", + "spec/plugins/filter/github_feed_spec.rb", "spec/plugins/filter/ignore_spec.rb", "spec/plugins/filter/image_source_spec.rb", "spec/plugins/filter/image_spec.rb", "spec/plugins/filter/one_spec.rb", "spec/plugins/filter/rand_spec.rb", + "spec/plugins/filter/sanitize_spec.rb", "spec/plugins/filter/sort_spec.rb", "spec/plugins/filter/tumblr_resize_spec.rb", "spec/plugins/notify/ikachan_spec.rb", "spec/plugins/publish/console_spec.rb", + "spec/plugins/publish/eject_spec.rb", + "spec/plugins/publish/fluentd_spec.rb", "spec/plugins/publish/google_calendar_spec.rb", "spec/plugins/publish/hatena_bookmark_spec.rb", + "spec/plugins/publish/hipchat_spec.rb", "spec/plugins/publish/instapaper_spec.rb", - "spec/plugins/publish/mail_spec.rb", + "spec/plugins/publish/memcached_spec.rb", "spec/plugins/publish/pocket_spec.rb", - "spec/plugins/publish/smtp_spec.rb", "spec/plugins/publish/twitter_spec.rb", "spec/plugins/store/full_text_spec.rb", "spec/plugins/store/permalink_spec.rb", "spec/plugins/store/target_link_spec.rb", + "spec/plugins/subscription/chan_toru_spec.rb", "spec/plugins/subscription/feed_spec.rb", + "spec/plugins/subscription/g_guide_spec.rb", "spec/plugins/subscription/google_reader_star_spec.rb", "spec/plugins/subscription/link_spec.rb", + "spec/plugins/subscription/pocket_spec.rb", "spec/plugins/subscription/text_spec.rb", "spec/plugins/subscription/tumblr_spec.rb", + "spec/plugins/subscription/twitter_search_spec.rb", "spec/plugins/subscription/twitter_spec.rb", "spec/plugins/subscription/weather_spec.rb", "spec/spec_helper.rb", @@ -110,6 +130,8 @@ Gem::Specification.new do |s| "test/integration/test_absoluteurl.yml", "test/integration/test_activerecord.yml", "test/integration/test_add_pocket.yml", + "test/integration/test_chan_toru.yml", + "test/integration/test_fluentd.yml", "test/integration/test_fulltext.yml", "test/integration/test_googlealert.yml", "test/integration/test_googlestar.yml", @@ -120,11 +142,14 @@ Gem::Specification.new do |s| "test/integration/test_instapaper.yml", "test/integration/test_link2local.yml", "test/integration/test_one.yml", + "test/integration/test_pocket.yml", "test/integration/test_rand.yml", + "test/integration/test_sanitize.yml", "test/integration/test_sort.yml", "test/integration/test_svnlog.yml", "test/integration/test_text2feed.yml", "test/integration/test_tumblr2local.yml", + "test/integration/test_twitter_search.yml", "test/integration/test_weather.yml", "vendor/.gitkeep" ] @@ -138,53 +163,71 @@ Gem::Specification.new do |s| s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, ["~> 1.7.7"]) s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 3"]) + s.add_runtime_dependency(%q, ["~> 4.0.0"]) + s.add_runtime_dependency(%q, ["~> 4.0.0"]) + s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 3"]) - s.add_runtime_dependency(%q, ["~> 3"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 1.3.5"]) + s.add_development_dependency(%q, ["~> 3.1.0"]) s.add_development_dependency(%q, [">= 0"]) else + s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3"]) + s.add_dependency(%q, ["~> 4.0.0"]) + s.add_dependency(%q, ["~> 4.0.0"]) + s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3"]) - s.add_dependency(%q, ["~> 3"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3.5"]) + s.add_dependency(%q, ["~> 3.1.0"]) s.add_dependency(%q, [">= 0"]) end else + s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3"]) + s.add_dependency(%q, ["~> 4.0.0"]) + s.add_dependency(%q, ["~> 4.0.0"]) + s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3"]) - s.add_dependency(%q, ["~> 3"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3.5"]) + s.add_dependency(%q, ["~> 3.1.0"]) s.add_dependency(%q, [">= 0"]) end end From a68781260dcf12de46cb6f6e20ad19ab44d269a7 Mon Sep 17 00:00:00 2001 From: soramugi Date: Tue, 2 Jul 2013 10:10:44 +0900 Subject: [PATCH 056/188] keyword ',' more serche --- doc/PLUGINS | 2 +- doc/PLUGINS.ja | 4 ++-- plugins/subscription/g_guide.rb | 15 +++++++++++---- spec/plugins/subscription/g_guide_spec.rb | 12 +++++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index e1666dc..d5b7e49 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -187,7 +187,7 @@ SubscriptionGGuide [Syntax] - module: SubscriptionGGuide config: - keyword: 'anime' # search word + keyword: 'anime,shogi' # search word (',' dividing and coming out two or more search) station: '地上波' # (It means terrestrial broadcasting in Japanese.) interval: INTERVAL_FOR_SCRAPING (in seconds.) retry: RETRY_COUNT diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 36a6db5..51a07b0 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -188,7 +188,7 @@ SubscriptionGGuide [レシピ記法] - module: SubscriptionGGuide config: - keyword: 'アニメ' # 検索ワード + keyword: 'アニメ,将棋' # 検索ワード(','区切りで複数検索) station: '地上波' # 衛星放送の区域(現在は地上波のみ対応) interval: スクレイピングの間隔 (秒数, 省略可) retry: エラー時のリトライ回数 (回数, 省略時 0) @@ -206,7 +206,7 @@ SubscriptionChanToru [レシピ記法] - module: SubscriptionChanToru config: - keyword: 'アニメ' # 検索ワード + keyword: 'アニメ,将棋' # 検索ワード(','区切りで複数検索) station: '地上波' # 衛星放送の区域(現在は地上波のみ対応) interval: スクレイピングの間隔 (秒数, 省略可) retry: エラー時のリトライ回数 (回数, 省略時 0) diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index b4e79bc..a542fd5 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -13,12 +13,19 @@ class SubscriptionGGuide def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + unless @config['keyword'].nil? || @config['keyword'].index(',').nil? + @keywords = @config['keyword'].split(',') + else + @keywords = [@config['keyword']] + end end def run retries = 0 begin - @pipeline << Automatic::FeedParser.get(feed_url) + @keywords.each {|keyword| + @pipeline << Automatic::FeedParser.get(feed_url keyword) + } rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") @@ -28,10 +35,10 @@ def run @pipeline end - def feed_url + def feed_url keyword = nil feed = G_GUIDE_RSS - unless @config['keyword'].nil? - feed += "condition.keyword=#{@config['keyword']}&" + unless keyword.nil? + feed += "condition.keyword=#{keyword}&" end feed += station_param URI.encode(feed) diff --git a/spec/plugins/subscription/g_guide_spec.rb b/spec/plugins/subscription/g_guide_spec.rb index 0fafa09..3a72cb2 100644 --- a/spec/plugins/subscription/g_guide_spec.rb +++ b/spec/plugins/subscription/g_guide_spec.rb @@ -28,12 +28,12 @@ def g_guide(config = {}, pipeline = []) config = { 'keyword' => 'anime' } subject { g_guide(config) } - its(:feed_url) { - should == URI.encode( + it 'feed_url' do + subject.feed_url(config['keyword']).should == URI.encode( Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + "condition.keyword=#{config['keyword']}&" + 'stationPlatformId=0&') - } + end end describe 'station is 地上波' do config = { 'station' => '地上波' } @@ -72,5 +72,11 @@ def g_guide(config = {}, pipeline = []) subject { g_guide(config) } its(:run) { should have(1).feed } end + + describe 'config keyword ","' do + config = { 'keyword' => 'おじゃる丸,忍たま', 'station' => '地上波' } + subject { g_guide(config) } + its(:run) { should have(2).feed } + end end end From 1be0012bf39cf9a77210d1e6b75575feebe71962 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 3 Jul 2013 14:33:44 +0900 Subject: [PATCH 057/188] 348 Version bump to next release --- lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/automatic.rb b/lib/automatic.rb index a70407f..e60f4c9 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jun 27, 2013 +# Updated:: Jul 3, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.6.0" + VERSION = "13.6.0-devel" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 6f067c9..93abbdf 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jun 27, 2013 +# Updated:: Jul 3, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -26,7 +26,7 @@ describe "#version" do specify { - Automatic.const_get(:VERSION).should == "13.6.0" + Automatic.const_get(:VERSION).should == "13.6.0-devel" } end From ae0d08f4ef0e5915b1ae20afafda62022c043f62 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 3 Jul 2013 14:35:28 +0900 Subject: [PATCH 058/188] 349 Google Reader has been discontinued --- doc/PLUGINS | 18 ----- doc/PLUGINS.ja | 18 ----- plugins/subscription/google_reader_star.rb | 66 ----------------- .../subscription/google_reader_star_spec.rb | 74 ------------------- 4 files changed, 176 deletions(-) delete mode 100644 plugins/subscription/google_reader_star.rb delete mode 100644 spec/plugins/subscription/google_reader_star_spec.rb diff --git a/doc/PLUGINS b/doc/PLUGINS index e1666dc..15838b4 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -58,24 +58,6 @@ SubscriptionTumblr retry: RETRY_COUNT -SubscriptionGoogleReaderStar ----------------------------- -[Path] - /plugins/subscription/google_reader_star.rb - -[Abstract] - Subscribe to Google reader star feed. - -[Syntax] - - module: SubscriptionGoogleReaderStar - config: - feeds: - - FEED - - FEED ... - retry: RETRY_COUNT - interval: INTERVAL_FOR_RETRY (in seconds.) - - SubscriptionTwitter ------------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 36a6db5..ebe00bb 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -58,24 +58,6 @@ SubscriptionTumblr retry: エラー時のリトライ回数 (回数, 省略時 0) -SubscriptionGoogleReaderStar ----------------------------- -[パス] - /plugins/subscription/google_reader_star.rb - -[概要] - Google リーダーのスターフィードを購読する - -[レシピ記法] - - module: SubscriptionGoogleReaderStar - config: - feeds: - - フィード名 - - フィード名 ... - retry: エラー時のリトライ回数 (回数, 省略時 0) - interval: エラー時のリトライ間隔 (秒数, 省略可) - - SubscriptionTwitter ------------------- [パス] diff --git a/plugins/subscription/google_reader_star.rb b/plugins/subscription/google_reader_star.rb deleted file mode 100644 index 36f2f5c..0000000 --- a/plugins/subscription/google_reader_star.rb +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Subscription::GoogleReaderStar -# Author:: soramugi -# 774 -# Created:: Feb 10, 2013 -# Updated:: Jun 28, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -module Automatic::Plugin - class SubscriptionGoogleReaderStar - require 'open-uri' - require 'nokogiri' - require 'rss' - - def initialize(config, pipeline=[]) - @config = config - @pipeline = pipeline - end - - def run - @return_feeds = [] - @config['feeds'].each {|feed| - retries = 0 - begin - Automatic::Log.puts("info", "Parsing: #{feed}") - @return_feeds << self.parse(Automatic::FeedParser.get(feed).items) - rescue - retries += 1 - Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}") - sleep @config['interval'].to_i unless @config['interval'].nil? - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? - end - } - @return_feeds - end - - def parse(feeds = []) - RSS::Maker.make("2.0") {|maker| - maker.xml_stylesheets.new_xml_stylesheet - maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" - maker.channel.link = "https://github.com/automaticruby/automaticruby" - maker.items.do_sort = true - - unless feeds.nil? - feeds.each {|feed| - unless feed.link.href.nil? - Automatic::Log.puts("info", "Feed: #{feed.link.href}") - item = maker.items.new_item - item.title = feed.title.content # google reader feed - item.link = feed.link.href # google reader feed - begin - item.description = feed.content - item.date = feed.dc_date || Time.now - rescue NoMethodError - Automatic::Log.puts("warn", "Undefined field detected in feed.") - end - end - } - end - } - end - - end -end diff --git a/spec/plugins/subscription/google_reader_star_spec.rb b/spec/plugins/subscription/google_reader_star_spec.rb deleted file mode 100644 index 6af401e..0000000 --- a/spec/plugins/subscription/google_reader_star_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Subscription::GoogleReaderStar -# Author:: soramugi -# 774 -# Created:: Feb 10, 2013 -# Updated:: Feb 17, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. -# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. - -require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') - -require 'subscription/google_reader_star' - -describe Automatic::Plugin::SubscriptionGoogleReaderStar do - context "with empty feeds" do - subject { - Automatic::Plugin::SubscriptionGoogleReaderStar.new( - { 'feeds' => [] } - ) - } - - its(:run) { should be_empty } - end - - context "with feeds whose invalid URL" do - subject { - Automatic::Plugin::SubscriptionGoogleReaderStar.new( - { 'feeds' => ["invalid_url"] } - ) - } - - its(:run) { should be_empty } - end - - context "with feeds whose valid URL" do - subject { - Automatic::Plugin::SubscriptionGoogleReaderStar.new( - { 'feeds' => [ - "http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred"] - } - ) - } - - its(:run) { should have(1).feed } - end - - context "with retry to feeds whose valid URL" do - subject { - Automatic::Plugin::SubscriptionGoogleReaderStar.new( - { 'feeds' => [ - "http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred"], - 'retry' => 3, - 'interval' => 5 - } - ) - } - - its(:run) { should have(1).feed } - end - - context "with retry to feeds whose invalid URL" do - subject { - Automatic::Plugin::SubscriptionGoogleReaderStar.new( - { 'feeds' => ["invalid_url"], - 'retry' => 1, - 'interval' => 1 - } - ) - } - - its(:run) { should be_empty } - end - -end From 285b5c91b1eef4062cec9e398194d6a1ee7bd62a Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 3 Jul 2013 14:36:03 +0900 Subject: [PATCH 059/188] 350 Removed action_mailer --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6419416..9e47b9b 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ gem 'json', '~> 1.7.7' gem 'sqlite3' gem 'activesupport', '~>4.0.0' gem 'activerecord', '~>4.0.0' -gem 'actionmailer', '~>4.0.0' gem 'hashie' gem 'gcalapi' gem 'xml-simple' From c8bd41a3ada1e9740e747d439b89dcb10923bc5f Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 4 Jul 2013 10:36:34 +0900 Subject: [PATCH 060/188] 349 Google Reader has been discontinued --- test/integration/test_googlestar.yml | 32 ---------------------------- 1 file changed, 32 deletions(-) delete mode 100644 test/integration/test_googlestar.yml diff --git a/test/integration/test_googlestar.yml b/test/integration/test_googlestar.yml deleted file mode 100644 index abcbf06..0000000 --- a/test/integration/test_googlestar.yml +++ /dev/null @@ -1,32 +0,0 @@ -global: - timezone: Asia/Tokyo - cache: - base: /tmp - log: - level: info - -plugins: - - module: SubscriptionGoogleReaderStar - config: - feeds: - - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred - - - module: SubscriptionGoogleReaderStar - config: - feeds: - - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred - internal: 1 - - - module: SubscriptionGoogleReaderStar - config: - feeds: - - http://www.google.com/reader/public/atom/user%2F00482198897189159802%2Fstate%2Fcom.google%2Fstarred - internal: 5 - retry: 5 - - - module: StorePermalink - config: - db: test_googlestar.db - - #- module: PublishConsole - From f70873117b5bc349441c4118ecb91163567d3269 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 11:39:27 +0900 Subject: [PATCH 061/188] #55 Add Plugin Subscription::StatDb --- plugins/subscription/stat_db.rb | 66 ++++++++++++++++++++++++++++++++ test/integration/test_statdb.yml | 15 ++++++++ 2 files changed, 81 insertions(+) create mode 100644 plugins/subscription/stat_db.rb create mode 100644 test/integration/test_statdb.yml diff --git a/plugins/subscription/stat_db.rb b/plugins/subscription/stat_db.rb new file mode 100644 index 0000000..7c73e32 --- /dev/null +++ b/plugins/subscription/stat_db.rb @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::StatDb +# Author:: 774 +# Created:: Jul 12, 2013 +# Updated:: Jul 12, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class SubscriptionStatDb + require 'open-uri' + require 'active_support' + require 'active_support/core_ext' + require 'rss' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + @return_feeds = [] + @config['params'].each {|param| + url = "http://statdb.nstac.go.jp/api/1.0b/app/getStatsData?appId=#{@config['appid']}&#{param}" + retries = 0 + begin + create_rss(URI.encode(url)) + rescue + retries += 1 + Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") + sleep @config['interval'].to_i unless @config['interval'].nil? + retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + end + } + @return_feeds + end + + private + def create_rss(url) + Automatic::Log.puts("info", "Parsing: #{url}") + hash = Hash.from_xml open(url).read + json = hash.to_json + data = ActiveSupport::JSON.decode(json) + unless data.nil? + rss = create(data, url) + sleep @config['interval'].to_i unless @config['interval'].nil? + @return_feeds << rss + end + end + + def create(data, url) + RSS::Maker.make("2.0") {|maker| + xss = maker.xml_stylesheets.new_xml_stylesheet + maker.channel.title = "Automatic Ruby" + maker.channel.description = "Automatic Ruby" + maker.channel.link = "https://github.com/automaticruby/automaticruby" + maker.items.do_sort = true + item = maker.items.new_item + item.title = "StatDB Feed by Automatic Ruby" + item.link = url + item.content_encoded = data + item.date = Time.now + } + end + end +end diff --git a/test/integration/test_statdb.yml b/test/integration/test_statdb.yml new file mode 100644 index 0000000..fe1b2aa --- /dev/null +++ b/test/integration/test_statdb.yml @@ -0,0 +1,15 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionStatDb + config: + appid: your_app_id + params: + - cdArea=09003,22004&cdCat01=010920070&cdTimeFrom=2012000101&cdTimeTo=2013000303 + + - module: PublishConsole From 2f3893ba3c01776f6b10c521a3c66f5091fac830 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 13:25:01 +0900 Subject: [PATCH 062/188] #56 Add Plugin Provide::Fluentd --- plugins/provide/fluentd.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/provide/fluentd.rb diff --git a/plugins/provide/fluentd.rb b/plugins/provide/fluentd.rb new file mode 100644 index 0000000..6707aa1 --- /dev/null +++ b/plugins/provide/fluentd.rb @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Provide::Fluentd +# Author:: 774 +# Created:: Jul 12, 2013 +# Updated:: Jul 12, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class ProvideFluentd + require 'fluent-logger' + require 'active_support' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + @fluentd = Fluent::Logger::FluentLogger.open(nil, + host = @config['host'], + port = @config['port']) + end + + def run + @pipeline.each {|feeds| + unless feeds.nil? + feeds.items.each {|feed| + begin + @fluentd.post(@config['tag'], feed.content_encoded) + rescue + Automatic::Log.puts("error", "Fluent::Logger.post failed, the content_encoded of item may be not kind of Hash.") + end + } + end + } + @pipeline + end + end +end From 917376f6a3c20e52504a50d50eba739878a365c9 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 14:29:10 +0900 Subject: [PATCH 063/188] #57 Create Plugin Subscription::Xml --- lib/automatic/feed_parser.rb | 14 +++++++++++ plugins/subscription/{stat_db.rb => xml.rb} | 26 ++++----------------- test/integration/test_statdb.yml | 15 ------------ test/integration/test_xml2fluentd.yml | 21 +++++++++++++++++ 4 files changed, 40 insertions(+), 36 deletions(-) rename plugins/subscription/{stat_db.rb => xml.rb} (60%) delete mode 100644 test/integration/test_statdb.yml create mode 100644 test/integration/test_xml2fluentd.yml diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 119b482..9457097 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -77,5 +77,19 @@ def self.parse(html) } end + def self.content_provide(url, data) + RSS::Maker.make("2.0") {|maker| + xss = maker.xml_stylesheets.new_xml_stylesheet + maker.channel.title = "Automatic Ruby" + maker.channel.description = "Automatic Ruby" + maker.channel.link = "https://github.com/automaticruby/automaticruby" + maker.items.do_sort = true + item = maker.items.new_item + item.title = "Automatic Ruby" + item.link = url + item.content_encoded = data + item.date = Time.now + } + end end end diff --git a/plugins/subscription/stat_db.rb b/plugins/subscription/xml.rb similarity index 60% rename from plugins/subscription/stat_db.rb rename to plugins/subscription/xml.rb index 7c73e32..0db84b1 100644 --- a/plugins/subscription/stat_db.rb +++ b/plugins/subscription/xml.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Subscription::StatDb +# Name:: Automatic::Plugin::Subscription::Xml # Author:: 774 # Created:: Jul 12, 2013 # Updated:: Jul 12, 2013 @@ -7,7 +7,7 @@ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin - class SubscriptionStatDb + class SubscriptionXml require 'open-uri' require 'active_support' require 'active_support/core_ext' @@ -20,8 +20,7 @@ def initialize(config, pipeline=[]) def run @return_feeds = [] - @config['params'].each {|param| - url = "http://statdb.nstac.go.jp/api/1.0b/app/getStatsData?appId=#{@config['appid']}&#{param}" + @config['urls'].each {|url| retries = 0 begin create_rss(URI.encode(url)) @@ -38,29 +37,14 @@ def run private def create_rss(url) Automatic::Log.puts("info", "Parsing: #{url}") - hash = Hash.from_xml open(url).read + hash = Hash.from_xml(open(url).read) json = hash.to_json data = ActiveSupport::JSON.decode(json) unless data.nil? - rss = create(data, url) + rss = Automatic::FeedParser.content_provide(url, data) sleep @config['interval'].to_i unless @config['interval'].nil? @return_feeds << rss end end - - def create(data, url) - RSS::Maker.make("2.0") {|maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" - maker.channel.link = "https://github.com/automaticruby/automaticruby" - maker.items.do_sort = true - item = maker.items.new_item - item.title = "StatDB Feed by Automatic Ruby" - item.link = url - item.content_encoded = data - item.date = Time.now - } - end end end diff --git a/test/integration/test_statdb.yml b/test/integration/test_statdb.yml deleted file mode 100644 index fe1b2aa..0000000 --- a/test/integration/test_statdb.yml +++ /dev/null @@ -1,15 +0,0 @@ -global: - timezone: Asia/Tokyo - cache: - base: /tmp - log: - level: info - -plugins: - - module: SubscriptionStatDb - config: - appid: your_app_id - params: - - cdArea=09003,22004&cdCat01=010920070&cdTimeFrom=2012000101&cdTimeTo=2013000303 - - - module: PublishConsole diff --git a/test/integration/test_xml2fluentd.yml b/test/integration/test_xml2fluentd.yml new file mode 100644 index 0000000..90c119d --- /dev/null +++ b/test/integration/test_xml2fluentd.yml @@ -0,0 +1,21 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionXml + config: + urls: + - http://id774.net/test/xml/data + + - module: ProvideFluentd + config: + host: localhost + port: 9999 + tag: automatic.debug + + # - module: PublishConsole + From 3f199db5fdc77b86c091f1e1ae4364f0b37ef7e9 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 14:39:32 +0900 Subject: [PATCH 064/188] #57 RSpec for Subscription::Xml --- spec/plugins/subscription/xml_spec.rb | 84 +++++++++++++++++++++++++++ test/integration/test_xml2fluentd.yml | 2 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 spec/plugins/subscription/xml_spec.rb diff --git a/spec/plugins/subscription/xml_spec.rb b/spec/plugins/subscription/xml_spec.rb new file mode 100644 index 0000000..c5905f8 --- /dev/null +++ b/spec/plugins/subscription/xml_spec.rb @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Subscription::Xml +# Author:: 774 +# Created:: Jul 12, 2013 +# Updated:: Jul 12, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'subscription/xml' + +describe Automatic::Plugin::SubscriptionXml do + context "with empty URLs" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => [] }) + } + + its(:run) { should be_empty } + end + + context "with URLs whose invalid URL" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => ["invalid_url"] } + ) + } + + its(:run) { should be_empty } + end + + context "with URLs whose invalid Xml" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => [ + "http://id774.net"] + } + ) + } + + its(:run) { should be_empty } + end + + context "with URLs whose valid XML" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => [ + "http://id774.net/test/xml/data"], + 'interval' => 1 + } + ) + } + + its(:run) { should have(1).item } + end + + context "with retry to URLs whose valid XML" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => [ + "http://id774.net/test/xml/data"], + 'interval' => 2, + 'retry' => 3 + } + ) + } + + its(:run) { should have(1).item } + end + + context "with retry to URLs whose invalid XML" do + subject { + Automatic::Plugin::SubscriptionXml.new( + { 'urls' => ["invalid_url"], + 'interval' => 1, + 'retry' => 1 + } + ) + } + + its(:run) { should be_empty } + end +end diff --git a/test/integration/test_xml2fluentd.yml b/test/integration/test_xml2fluentd.yml index 90c119d..0ea95cd 100644 --- a/test/integration/test_xml2fluentd.yml +++ b/test/integration/test_xml2fluentd.yml @@ -14,7 +14,7 @@ plugins: - module: ProvideFluentd config: host: localhost - port: 9999 + port: 10000 tag: automatic.debug # - module: PublishConsole From d4fed34129f5eb99e196a85bd1434fe63b2036f5 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 15:13:28 +0900 Subject: [PATCH 065/188] #56 RSpec for Provide::Fluentd --- spec/plugins/provide/fluentd_spec.rb | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 spec/plugins/provide/fluentd_spec.rb diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb new file mode 100644 index 0000000..d99ccfa --- /dev/null +++ b/spec/plugins/provide/fluentd_spec.rb @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Provide::Fluentd +# Author:: 774 +# Created:: Jul 12, 2013 +# Updated:: Jul 12, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'provide/fluentd' + +describe Automatic::Plugin::ProvideFluentd do + context 'when feed' do + describe 'should forward the feeds' do + feeds = [] + hash = {} + hash['test1'] = "test2" + hash['test3'] = "test4" + expect = hash + json = hash.to_json + data = ActiveSupport::JSON.decode(json) + url = "http://id774.net" + rss = Automatic::FeedParser.content_provide(url, data) + feeds << rss + + subject { + Automatic::Plugin::ProvideFluentd.new( + { + 'host' => "localhost", + 'port' => "10000", + 'tag' => "automatic_test.provide_fluentd_spec" + }, + feeds + ) + } + + its (:run) { + fluentd = mock("fluentd") + subject.run.should have(1).feed + subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.should == expect + } + end + + end +end From 47d53b150fbb116b9e3c74bb2bb14ef4edd4dfc6 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 16:03:36 +0900 Subject: [PATCH 066/188] 351 Clean Up --- plugins/subscription/link.rb | 1 - spec/plugins/provide/fluentd_spec.rb | 2 +- spec/plugins/publish/fluentd_spec.rb | 4 ++-- test/integration/test_fluentd.yml | 4 ++-- test/integration/test_xml2fluentd.yml | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index 1ea270a..380cd85 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -9,7 +9,6 @@ module Automatic::Plugin class SubscriptionLink require 'open-uri' - require 'nokogiri' require 'rss' def initialize(config, pipeline=[]) diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb index d99ccfa..43581e8 100644 --- a/spec/plugins/provide/fluentd_spec.rb +++ b/spec/plugins/provide/fluentd_spec.rb @@ -29,7 +29,7 @@ { 'host' => "localhost", 'port' => "10000", - 'tag' => "automatic_test.provide_fluentd_spec" + 'tag' => "automatic_spec.provide_fluentd" }, feeds ) diff --git a/spec/plugins/publish/fluentd_spec.rb b/spec/plugins/publish/fluentd_spec.rb index 4154762..658562d 100644 --- a/spec/plugins/publish/fluentd_spec.rb +++ b/spec/plugins/publish/fluentd_spec.rb @@ -17,8 +17,8 @@ Automatic::Plugin::PublishFluentd.new( { 'host' => "localhost", - 'port' => "9999", - 'tag' => "debug.forward" + 'port' => "10000", + 'tag' => "automatic_spec.publish_fluent" }, AutomaticSpec.generate_pipeline{ feed { diff --git a/test/integration/test_fluentd.yml b/test/integration/test_fluentd.yml index 3fa25e7..885d2a7 100644 --- a/test/integration/test_fluentd.yml +++ b/test/integration/test_fluentd.yml @@ -14,7 +14,7 @@ plugins: - module: PublishFluentd config: host: localhost - port: 9999 - tag: automatic.feed + port: 10000 + tag: automatic_test.publish_fluentd # - module: PublishConsole diff --git a/test/integration/test_xml2fluentd.yml b/test/integration/test_xml2fluentd.yml index 0ea95cd..3f5fb60 100644 --- a/test/integration/test_xml2fluentd.yml +++ b/test/integration/test_xml2fluentd.yml @@ -15,7 +15,7 @@ plugins: config: host: localhost port: 10000 - tag: automatic.debug + tag: automatic_test.provide_fluentd # - module: PublishConsole From 128a2a4d788c7a298e6651e06d8d4a628228a28f Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 12 Jul 2013 16:27:54 +0900 Subject: [PATCH 067/188] 351 Clean Up --- lib/automatic/feed_parser.rb | 2 +- spec/plugins/provide/fluentd_spec.rb | 6 ++++-- test/integration/test_add_pocket.yml | 1 + test/integration/test_fluentd.yml | 1 + test/integration/test_instapaper.yml | 1 + test/integration/test_one.yml | 1 + test/integration/test_pocket.yml | 2 ++ test/integration/test_rand.yml | 1 + test/integration/test_sanitize.yml | 1 + test/integration/test_text2feed.yml | 1 + test/integration/test_twitter_search.yml | 1 + test/integration/test_weather.yml | 1 + 12 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 9457097..337b966 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -2,7 +2,7 @@ # Name:: Automatic::FeedParser # Author:: 774 # Created:: Feb 19, 2012 -# Updated:: Jan 8, 2013 +# Updated:: Jul 12, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb index 43581e8..2b38db1 100644 --- a/spec/plugins/provide/fluentd_spec.rb +++ b/spec/plugins/provide/fluentd_spec.rb @@ -13,14 +13,15 @@ describe Automatic::Plugin::ProvideFluentd do context 'when feed' do describe 'should forward the feeds' do - feeds = [] hash = {} hash['test1'] = "test2" hash['test3'] = "test4" expect = hash + + feeds = [] json = hash.to_json data = ActiveSupport::JSON.decode(json) - url = "http://id774.net" + url = "http://id774.net/test/xml/data" rss = Automatic::FeedParser.content_provide(url, data) feeds << rss @@ -38,6 +39,7 @@ its (:run) { fluentd = mock("fluentd") subject.run.should have(1).feed + subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.class == Hash subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.should == expect } end diff --git a/test/integration/test_add_pocket.yml b/test/integration/test_add_pocket.yml index a17a395..43d7753 100644 --- a/test/integration/test_add_pocket.yml +++ b/test/integration/test_add_pocket.yml @@ -21,3 +21,4 @@ plugins: access_token: access_token #- module: PublishConsole + diff --git a/test/integration/test_fluentd.yml b/test/integration/test_fluentd.yml index 885d2a7..6c60244 100644 --- a/test/integration/test_fluentd.yml +++ b/test/integration/test_fluentd.yml @@ -18,3 +18,4 @@ plugins: tag: automatic_test.publish_fluentd # - module: PublishConsole + diff --git a/test/integration/test_instapaper.yml b/test/integration/test_instapaper.yml index 75fa80a..cdaf387 100644 --- a/test/integration/test_instapaper.yml +++ b/test/integration/test_instapaper.yml @@ -22,3 +22,4 @@ plugins: interval: 5 #- module: PublishConsole + diff --git a/test/integration/test_one.yml b/test/integration/test_one.yml index f26eb3a..0418aaa 100644 --- a/test/integration/test_one.yml +++ b/test/integration/test_one.yml @@ -20,3 +20,4 @@ plugins: db: test_one.db # - module: PublishConsole + diff --git a/test/integration/test_pocket.yml b/test/integration/test_pocket.yml index 8e83b16..ec11e0d 100644 --- a/test/integration/test_pocket.yml +++ b/test/integration/test_pocket.yml @@ -19,3 +19,5 @@ plugins: db: test_pocket.db #- module: PublishConsole + + diff --git a/test/integration/test_rand.yml b/test/integration/test_rand.yml index 78dea4a..5f3898d 100644 --- a/test/integration/test_rand.yml +++ b/test/integration/test_rand.yml @@ -18,3 +18,4 @@ plugins: db: test_rand.db # - module: PublishConsole + diff --git a/test/integration/test_sanitize.yml b/test/integration/test_sanitize.yml index afbad30..c2d734a 100644 --- a/test/integration/test_sanitize.yml +++ b/test/integration/test_sanitize.yml @@ -20,3 +20,4 @@ plugins: db: test_sanitize.db # - module: PublishConsole + diff --git a/test/integration/test_text2feed.yml b/test/integration/test_text2feed.yml index d333dfe..047d612 100644 --- a/test/integration/test_text2feed.yml +++ b/test/integration/test_text2feed.yml @@ -25,3 +25,4 @@ plugins: db: test_text2feed.db # - module: PublishConsole + diff --git a/test/integration/test_twitter_search.yml b/test/integration/test_twitter_search.yml index e77c1c6..679e481 100644 --- a/test/integration/test_twitter_search.yml +++ b/test/integration/test_twitter_search.yml @@ -19,3 +19,4 @@ plugins: db: test_twitter_search.db #- module: PublishConsole + diff --git a/test/integration/test_weather.yml b/test/integration/test_weather.yml index abfee61..204e874 100644 --- a/test/integration/test_weather.yml +++ b/test/integration/test_weather.yml @@ -16,3 +16,4 @@ plugins: db: test_weather.db #- module: PublishConsole + From adc9aebbf689832623f7a240fae49dbff9adfe11 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 14 Jul 2013 00:30:43 +0900 Subject: [PATCH 068/188] 352 Append doc for Subscription::Xml --- doc/PLUGINS | 19 +++++++++++++++++++ doc/PLUGINS.ja | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index 15838b4..117afb2 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -38,6 +38,25 @@ SubscriptionLink retry: RETRY_COUNT +SubscriptionXml +--------------- +[Path] + /plugins/subscription/xml.rb + +[Abstract] + Subscribe XML API with GET method. + This plug-in store encoded XML in content_encoded of RSS feed. + +[Syntax] + - module: SubscriptionXml + config: + urls: + - URL + - URL ... (XML base API) + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + SubscriptionTumblr ------------------ [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index ebe00bb..42e1468 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -38,6 +38,26 @@ SubscriptionLink retry: エラー時のリトライ回数 (回数, 省略時 0) +SubscriptionXml +--------------- +[パス] + /plugins/subscription/xml.rb + +[概要] + XML で提供された API を GET メソッドで購読する + このプラグインはエンコードされた XML を RSS フィードの + content_encoded に保存する + +[Syntax] + - module: SubscriptionXml + config: + urls: + - URL + - URL ... (XML base API) + interval: INTERVAL_FOR_SCRAPING (in seconds.) + retry: RETRY_COUNT + + SubscriptionTumblr ------------------ [パス] From 672f9904b534943d8fa4fdbe7e969b9390df49a3 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 14 Jul 2013 01:43:16 +0900 Subject: [PATCH 069/188] 352 Append doc for Subscription::Xml --- doc/PLUGINS.ja | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 42e1468..a65980c 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -48,14 +48,14 @@ SubscriptionXml このプラグインはエンコードされた XML を RSS フィードの content_encoded に保存する -[Syntax] +[レシピ記法] - module: SubscriptionXml config: urls: - URL - - URL ... (XML base API) - interval: INTERVAL_FOR_SCRAPING (in seconds.) - retry: RETRY_COUNT + - URL ... (XML ベース API) + interval: スクレイピングの間隔 (秒数, 省略可) + retry: エラー時のリトライ回数 (回数, 省略時 0) SubscriptionTumblr From 65d091ba36d0e7a5460c1854182d0d0a3212c107 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 15 Jul 2013 10:33:59 +0900 Subject: [PATCH 070/188] 353 Append doc for Provide::Fluentd --- doc/PLUGINS | 22 ++++++++++++++++++++++ doc/PLUGINS.ja | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index 117afb2..2ca1510 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -463,6 +463,28 @@ PublishFluentd tag: TAGS (example: automatic.feed) +ProvideFluentd +-------------- +[Path] + /plugins/provide/fluentd.rb + +[Abstract] + This plugin output content_encoded to fluentd. + +[Description] + Provide::Fluentd is different from Publish::Fluentd. + + Publish::Fluentd -> Output feed to flulentd. + Provide::Fluentd -> Output content_encoded to fluentd. + +[Syntax] + - module: ProvideFluentd + config: + host: HOSTNAME + port: PORT_NUMBER + tag: TAGS (example: automatic.feed) + + PublishMemcached ---------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index a65980c..6647127 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -465,6 +465,29 @@ PublishFluentd tag: タグ (例 automatic.feed) +ProvideFluentd +-------------- +[パス] + /plugins/provide/fluentd.rb + +[概要] + fluentd に content_encoded の内容を出力する + +[説明] + このプラグインは Publish::Fluentd とは異なる + + Publish::Fluentd -> フィード全体を fluentd に出力 + Provide::Fluentd -> content_encoded の内容を fluentd に出力 + + +[レシピ記法] + - module: ProvideFluentd + config: + host: ホスト名 + port: ポート番号 + tag: タグ (例 automatic.feed) + + PublishMemcached ---------------- [パス] From 8b83355b3d1db42c90275b41a4b1a6232e7d4174 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 15 Jul 2013 10:35:20 +0900 Subject: [PATCH 071/188] 353 Append doc for Provide::Fluentd --- doc/PLUGINS.ja | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 6647127..3a7fd30 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -479,7 +479,6 @@ ProvideFluentd Publish::Fluentd -> フィード全体を fluentd に出力 Provide::Fluentd -> content_encoded の内容を fluentd に出力 - [レシピ記法] - module: ProvideFluentd config: From 3a7ae8ea9c08b81762191c05815216af40ea55f4 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 19 Jul 2013 13:57:17 +0900 Subject: [PATCH 072/188] 354 Fix footer --- bin/automatic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/automatic b/bin/automatic index d10cb49..cb6987a 100755 --- a/bin/automatic +++ b/bin/automatic @@ -3,8 +3,8 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Apr 10, 2013 -# Copyright:: 774 Copyright (c) 2012-2013 +# Updated:: Jul 19, 2013 +# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. root_dir = File.expand_path("..", File.dirname(__FILE__)) From 0c54c06098b4db448a3c2f501930968261903fcd Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 21 Jul 2013 04:48:18 +0900 Subject: [PATCH 073/188] 355 Append ChangeLog --- doc/ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6602baf..8519672 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,13 @@ +=== 13.7.0 / 2013-07-xx + +* Added new plugins. + + * Subscription::Xml + * Provide::Fluentd + +* Fix other some problems. + + === 13.6.0 / 2013-06-28 * Added new plugins. From 3e62368beea1a4ab14a5eff951f93093e96b1e3c Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 28 Jul 2013 00:36:20 +0900 Subject: [PATCH 074/188] 356 Version bump to 13.7.0 --- VERSION | 2 +- doc/ChangeLog | 4 ++-- lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index fc9c00c..d6ef998 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.6.0 +13.7.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index 8519672..87bc24e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,11 +1,11 @@ -=== 13.7.0 / 2013-07-xx +=== 13.7.0 / 2013-07-28 * Added new plugins. * Subscription::Xml * Provide::Fluentd -* Fix other some problems. +* Fix some problems. === 13.6.0 / 2013-06-28 diff --git a/lib/automatic.rb b/lib/automatic.rb index e60f4c9..b14c347 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jul 3, 2013 +# Updated:: Jul 28, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.6.0-devel" + VERSION = "13.7.0" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 93abbdf..be95747 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jul 3, 2013 +# Updated:: Jul 28, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -26,7 +26,7 @@ describe "#version" do specify { - Automatic.const_get(:VERSION).should == "13.6.0-devel" + Automatic.const_get(:VERSION).should == "13.7.0" } end From 4bf8702fc484cdeae69a005a2e0599c7a6c35ed3 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 28 Jul 2013 00:41:34 +0900 Subject: [PATCH 075/188] Regenerate gemspec for version 13.7.0 --- automatic.gemspec | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 95b308d..a6d3877 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = "automatic" - s.version = "13.6.0" + s.version = "13.7.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["id774"] - s.date = "2013-06-28" + s.date = "2013-07-27" s.description = "Ruby General Automation Framework" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -54,6 +54,7 @@ Gem::Specification.new do |s| "plugins/filter/sort.rb", "plugins/filter/tumblr_resize.rb", "plugins/notify/ikachan.rb", + "plugins/provide/fluentd.rb", "plugins/publish/console.rb", "plugins/publish/console_link.rb", "plugins/publish/eject.rb", @@ -72,7 +73,6 @@ Gem::Specification.new do |s| "plugins/subscription/chan_toru.rb", "plugins/subscription/feed.rb", "plugins/subscription/g_guide.rb", - "plugins/subscription/google_reader_star.rb", "plugins/subscription/link.rb", "plugins/subscription/pocket.rb", "plugins/subscription/text.rb", @@ -80,6 +80,7 @@ Gem::Specification.new do |s| "plugins/subscription/twitter.rb", "plugins/subscription/twitter_search.rb", "plugins/subscription/weather.rb", + "plugins/subscription/xml.rb", "script/build", "spec/fixtures/sampleRecipe.yml", "spec/lib/automatic/log_spec.rb", @@ -100,6 +101,7 @@ Gem::Specification.new do |s| "spec/plugins/filter/sort_spec.rb", "spec/plugins/filter/tumblr_resize_spec.rb", "spec/plugins/notify/ikachan_spec.rb", + "spec/plugins/provide/fluentd_spec.rb", "spec/plugins/publish/console_spec.rb", "spec/plugins/publish/eject_spec.rb", "spec/plugins/publish/fluentd_spec.rb", @@ -116,7 +118,6 @@ Gem::Specification.new do |s| "spec/plugins/subscription/chan_toru_spec.rb", "spec/plugins/subscription/feed_spec.rb", "spec/plugins/subscription/g_guide_spec.rb", - "spec/plugins/subscription/google_reader_star_spec.rb", "spec/plugins/subscription/link_spec.rb", "spec/plugins/subscription/pocket_spec.rb", "spec/plugins/subscription/text_spec.rb", @@ -124,6 +125,7 @@ Gem::Specification.new do |s| "spec/plugins/subscription/twitter_search_spec.rb", "spec/plugins/subscription/twitter_spec.rb", "spec/plugins/subscription/weather_spec.rb", + "spec/plugins/subscription/xml_spec.rb", "spec/spec_helper.rb", "spec/user_dir/plugins/store/mock.rb", "test/fixtures/sampleOPML.xml", @@ -134,7 +136,6 @@ Gem::Specification.new do |s| "test/integration/test_fluentd.yml", "test/integration/test_fulltext.yml", "test/integration/test_googlealert.yml", - "test/integration/test_googlestar.yml", "test/integration/test_hatenabookmark.yml", "test/integration/test_ignore.yml", "test/integration/test_ignore2.yml", @@ -151,23 +152,23 @@ Gem::Specification.new do |s| "test/integration/test_tumblr2local.yml", "test/integration/test_twitter_search.yml", "test/integration/test_weather.yml", + "test/integration/test_xml2fluentd.yml", "vendor/.gitkeep" ] s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] s.require_paths = ["lib"] - s.rubygems_version = "1.8.24" + s.rubygems_version = "2.0.5" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 1.7.7"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) - s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) @@ -189,7 +190,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) @@ -212,7 +212,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From 7f6f6f41f493f2cfd8b27446a52b8a607883817f Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 28 Jul 2013 00:42:24 +0900 Subject: [PATCH 076/188] Regenerate gemspec for version 13.7.0 --- automatic.gemspec | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 95b308d..a6d3877 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = "automatic" - s.version = "13.6.0" + s.version = "13.7.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["id774"] - s.date = "2013-06-28" + s.date = "2013-07-27" s.description = "Ruby General Automation Framework" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -54,6 +54,7 @@ Gem::Specification.new do |s| "plugins/filter/sort.rb", "plugins/filter/tumblr_resize.rb", "plugins/notify/ikachan.rb", + "plugins/provide/fluentd.rb", "plugins/publish/console.rb", "plugins/publish/console_link.rb", "plugins/publish/eject.rb", @@ -72,7 +73,6 @@ Gem::Specification.new do |s| "plugins/subscription/chan_toru.rb", "plugins/subscription/feed.rb", "plugins/subscription/g_guide.rb", - "plugins/subscription/google_reader_star.rb", "plugins/subscription/link.rb", "plugins/subscription/pocket.rb", "plugins/subscription/text.rb", @@ -80,6 +80,7 @@ Gem::Specification.new do |s| "plugins/subscription/twitter.rb", "plugins/subscription/twitter_search.rb", "plugins/subscription/weather.rb", + "plugins/subscription/xml.rb", "script/build", "spec/fixtures/sampleRecipe.yml", "spec/lib/automatic/log_spec.rb", @@ -100,6 +101,7 @@ Gem::Specification.new do |s| "spec/plugins/filter/sort_spec.rb", "spec/plugins/filter/tumblr_resize_spec.rb", "spec/plugins/notify/ikachan_spec.rb", + "spec/plugins/provide/fluentd_spec.rb", "spec/plugins/publish/console_spec.rb", "spec/plugins/publish/eject_spec.rb", "spec/plugins/publish/fluentd_spec.rb", @@ -116,7 +118,6 @@ Gem::Specification.new do |s| "spec/plugins/subscription/chan_toru_spec.rb", "spec/plugins/subscription/feed_spec.rb", "spec/plugins/subscription/g_guide_spec.rb", - "spec/plugins/subscription/google_reader_star_spec.rb", "spec/plugins/subscription/link_spec.rb", "spec/plugins/subscription/pocket_spec.rb", "spec/plugins/subscription/text_spec.rb", @@ -124,6 +125,7 @@ Gem::Specification.new do |s| "spec/plugins/subscription/twitter_search_spec.rb", "spec/plugins/subscription/twitter_spec.rb", "spec/plugins/subscription/weather_spec.rb", + "spec/plugins/subscription/xml_spec.rb", "spec/spec_helper.rb", "spec/user_dir/plugins/store/mock.rb", "test/fixtures/sampleOPML.xml", @@ -134,7 +136,6 @@ Gem::Specification.new do |s| "test/integration/test_fluentd.yml", "test/integration/test_fulltext.yml", "test/integration/test_googlealert.yml", - "test/integration/test_googlestar.yml", "test/integration/test_hatenabookmark.yml", "test/integration/test_ignore.yml", "test/integration/test_ignore2.yml", @@ -151,23 +152,23 @@ Gem::Specification.new do |s| "test/integration/test_tumblr2local.yml", "test/integration/test_twitter_search.yml", "test/integration/test_weather.yml", + "test/integration/test_xml2fluentd.yml", "vendor/.gitkeep" ] s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] s.require_paths = ["lib"] - s.rubygems_version = "1.8.24" + s.rubygems_version = "2.0.5" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 1.7.7"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) - s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) @@ -189,7 +190,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) @@ -212,7 +212,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From aacbed954440c3a480ed7c5afaf6aeb78c4c2842 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 30 Jul 2013 11:21:01 +0900 Subject: [PATCH 077/188] 357 Version bump to the next release --- lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/automatic.rb b/lib/automatic.rb index b14c347..9e376f8 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jul 28, 2013 +# Updated:: Jul 30, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.7.0" + VERSION = "13.7.0-devel" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index be95747..b540006 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jul 28, 2013 +# Updated:: Jul 30, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -26,7 +26,7 @@ describe "#version" do specify { - Automatic.const_get(:VERSION).should == "13.7.0" + Automatic.const_get(:VERSION).should == "13.7.0-devel" } end From 9bb5f0d28dba7ec4c3d9eabb5ac6fa5557a04edd Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 30 Jul 2013 11:21:45 +0900 Subject: [PATCH 078/188] 358 Clean up Gemfile --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 9e47b9b..31d2e09 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,9 @@ -# Version:20130628 +# Version:20130730 source "http://rubygems.org" source "http://gems.github.com" -gem 'json', '~> 1.7.7' +gem 'json' gem 'sqlite3' gem 'activesupport', '~>4.0.0' gem 'activerecord', '~>4.0.0' @@ -30,7 +30,7 @@ end group :development do gem "cucumber" - gem 'bundler', '~>1.3.5' - gem 'builder', '~>3.1.0' + gem 'bundler' + gem 'builder' gem "jeweler" end From 66f784cd48f4e52034f709c4bfe52c60e31faa13 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 15 Oct 2013 13:58:10 +0900 Subject: [PATCH 079/188] 359 Refactoring --- plugins/filter/ignore.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/plugins/filter/ignore.rb b/plugins/filter/ignore.rb index d0fa507..90f9df0 100644 --- a/plugins/filter/ignore.rb +++ b/plugins/filter/ignore.rb @@ -28,31 +28,28 @@ def run end private + def detect_exclude(item, evaluation, reason) + if item.include?(evaluation) + Automatic::Log.puts("info", "Excluded by #{reason}: #{item}") + return true + end + end def exclude(items) detection = false unless @config['title'].nil? @config['title'].each {|e| - if items.title.include?(e.chomp) - detection = true - Automatic::Log.puts("info", "Excluded by title: #{items.link}") - end + detection = true if detect_exclude(items.title, e.chomp, 'title') } end unless @config['link'].nil? @config['link'].each {|e| - if items.link.include?(e.chomp) - detection = true - Automatic::Log.puts("info", "Excluded by link: #{items.link}") - end + detection = true if detect_exclude(items.link, e.chomp, 'link') } end unless @config['description'].nil? @config['description'].each {|e| - if items.description.include?(e.chomp) - detection = true - Automatic::Log.puts("info", "Excluded by description: #{items.link}") - end + detection = true if detect_exclude(items.description, e.chomp, 'description') } end detection From f4367086f81bf8486aa5cd06a91366c605408c6d Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 15 Oct 2013 14:11:29 +0900 Subject: [PATCH 080/188] 360 Prepare for invalid feed items --- plugins/filter/ignore.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/filter/ignore.rb b/plugins/filter/ignore.rb index 90f9df0..a3a4eba 100644 --- a/plugins/filter/ignore.rb +++ b/plugins/filter/ignore.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::Ignore # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Apr 5, 2013 +# Updated:: Oct 15, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -29,9 +29,14 @@ def run private def detect_exclude(item, evaluation, reason) - if item.include?(evaluation) - Automatic::Log.puts("info", "Excluded by #{reason}: #{item}") - return true + begin + if item.include?(evaluation) + Automatic::Log.puts("info", "Excluded by #{reason}: #{item}") + return true + end + rescue NoMethodError + Automatic::Log.puts("warn", "Invalid feed detected in ignore process with #{item}") + return false end end From a5e0aa9c84fe7d0f7052bf17a1f1984db384bf27 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 20 Nov 2013 14:25:46 +0900 Subject: [PATCH 081/188] 361 Fix twitter gem version --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 31d2e09..c7db769 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20130730 +# Version:20131120 source "http://rubygems.org" source "http://gems.github.com" @@ -13,7 +13,7 @@ gem 'xml-simple' gem 'feedbag' gem 'nokogiri' gem 'sanitize' -gem 'twitter' +gem 'twitter', '~>4.0.0' gem 'weather_hacker' gem 'pocket-ruby' gem 'hipchat' From 234c36b015b66b71ba27a755e016f8756f5e713c Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 20 Nov 2013 14:33:10 +0900 Subject: [PATCH 082/188] 361 Fix twitter gem version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c7db769..671f715 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'xml-simple' gem 'feedbag' gem 'nokogiri' gem 'sanitize' -gem 'twitter', '~>4.0.0' +gem 'twitter', '~>4.8.1' gem 'weather_hacker' gem 'pocket-ruby' gem 'hipchat' From 3a07394924451dc51e61804ff934e639126c6064 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 25 Nov 2013 14:13:50 +0900 Subject: [PATCH 083/188] #62 Correspond to rspec 2.14 --- Gemfile | 4 ++-- spec/lib/automatic_spec.rb | 38 ++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 671f715..9469357 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20131120 +# Version:20131125 source "http://rubygems.org" source "http://gems.github.com" @@ -21,7 +21,7 @@ gem 'fluent-logger' gem 'dalli' group :test do - gem 'rspec' + gem 'rspec', '~> 2.14.0' gem 'rcov', :platforms => :mri_18 gem 'simplecov' gem 'simplecov-rcov' diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index b540006..3c34005 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -25,16 +25,22 @@ end describe "#version" do - specify { - Automatic.const_get(:VERSION).should == "13.7.0-devel" - } + subject { Automatic.const_get(:VERSION) } + + it { expect(subject).to eq "13.7.0-devel" } + end + + describe "#(root)_dir" do + subject { Automatic.root_dir } + + it { expect(subject).to eq APP_ROOT } + end - describe "#(root|config)_dir" do - specify { - Automatic.root_dir.should == APP_ROOT - Automatic.config_dir.should == APP_ROOT+"/config" - } + describe "#(config)_dir" do + subject { Automatic.config_dir } + + it { expect(subject).to eq APP_ROOT+"/config" } end describe "#user_dir= in test env" do @@ -43,14 +49,18 @@ end describe "#user_dir" do + subject { Automatic.user_dir } + it "return valid value" do - Automatic.user_dir.should == File.join(APP_ROOT, "spec/user_dir") + expect(subject).to eq File.join(APP_ROOT, "spec/user_dir") end end describe "#user_plugins_dir" do + subject { Automatic.user_plugins_dir } + it "return valid value" do - Automatic.user_plugins_dir.should == File.join(APP_ROOT, "spec/user_dir/plugins") + expect(subject).to eq File.join(APP_ROOT, "spec/user_dir/plugins") end end @@ -66,14 +76,18 @@ end describe "#user_dir" do + subject { Automatic.user_dir } + it "return valid value" do - Automatic.user_dir.should == File.expand_path("~/") + "/.automatic" + expect(subject).to eq File.expand_path("~/") + "/.automatic" end end describe "#user_plugins_dir" do + subject { Automatic.user_plugins_dir } + it "return valid value" do - Automatic.user_plugins_dir.should == File.expand_path("~/") + "/.automatic/plugins" + expect(subject).to eq File.expand_path("~/") + "/.automatic/plugins" end end From 4e2aa169bb8531de38c375def65a7620771016fd Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 25 Nov 2013 14:29:28 +0900 Subject: [PATCH 084/188] #62 Correspond to rspec 2.14 --- spec/lib/automatic_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 3c34005..f8106c3 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jul 30, 2013 +# Updated:: Nov 25, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -14,13 +14,13 @@ describe Automatic do describe "#run" do describe "with a root dir which has default recipe" do - specify { - lambda{ + subject { Automatic.run(:recipe => "", :root_dir => APP_ROOT, :user_dir => APP_ROOT + "/spec/user_dir") - }.should_not raise_exception(Errno::ENOENT) } + + it { expect { subject }.to raise_error } end end From 153d47545cd18f8711a56347d8ec205265f788e7 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 17 Dec 2013 17:33:55 +0900 Subject: [PATCH 085/188] Version bump to v13.12.0 --- VERSION | 2 +- doc/ChangeLog | 5 +++++ lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index d6ef998..6665a53 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.7.0 +13.12.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index 87bc24e..7e93e1a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +=== 13.12.0 / 2013-12-17 + +* Fix twitter gem version. + + === 13.7.0 / 2013-07-28 * Added new plugins. diff --git a/lib/automatic.rb b/lib/automatic.rb index 9e376f8..f0c9803 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jul 30, 2013 +# Updated:: Dec 17, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.7.0-devel" + VERSION = "13.12.0" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index f8106c3..137a016 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Name:: Automatic +# Name:: Automatic::Ruby # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Nov 25, 2013 +# Updated:: Dec 17, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "13.7.0-devel" } + it { expect(subject).to eq "13.12.0" } end describe "#(root)_dir" do From 7ea5fccf8709ee8d3d8af54c338872bd7cd29bfa Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 17 Dec 2013 17:38:00 +0900 Subject: [PATCH 086/188] Regenerate gemspec for version 13.12.0 --- automatic.gemspec | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index a6d3877..c722f96 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,14 +2,15 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- +# stub: automatic 13.12.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "13.7.0" + s.version = "13.12.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["id774"] - s.date = "2013-07-27" + s.date = "2013-12-17" s.description = "Ruby General Automation Framework" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -158,14 +159,14 @@ Gem::Specification.new do |s| s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] s.require_paths = ["lib"] - s.rubygems_version = "2.0.5" + s.rubygems_version = "2.1.11" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 1.7.7"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) s.add_runtime_dependency(%q, ["~> 4.0.0"]) @@ -175,18 +176,18 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 4.8.1"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) - s.add_development_dependency(%q, ["~> 1.3.5"]) - s.add_development_dependency(%q, ["~> 3.1.0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, ["~> 1.7.7"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) @@ -196,19 +197,19 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.8.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 1.3.5"]) - s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, ["~> 1.7.7"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, ["~> 4.0.0"]) s.add_dependency(%q, ["~> 4.0.0"]) @@ -218,15 +219,15 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.8.1"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 1.3.5"]) - s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end end From ab3b8b95bd741f0ab3c1a4f4246f750f9af9b7a6 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 18 Dec 2013 15:48:42 +0900 Subject: [PATCH 087/188] Version bump to next release --- lib/automatic.rb | 4 ++-- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/automatic.rb b/lib/automatic.rb index f0c9803..2b61d38 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Dec 17, 2013 +# Updated:: Dec 18, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -13,7 +13,7 @@ module Automatic require 'automatic/log' require 'automatic/feed_parser' - VERSION = "13.12.0" + VERSION = "13.12.0-devel" USER_DIR = "/.automatic" class << self diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 137a016..137845e 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Dec 17, 2013 +# Updated:: Dec 18, 2013 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "13.12.0" } + it { expect(subject).to eq "13.12.0-devel" } end describe "#(root)_dir" do From febfd4e39593ce2b3f2e5673662d616d781ed3b0 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 18 Dec 2013 15:55:09 +0900 Subject: [PATCH 088/188] New RSpec Syntax --- spec/lib/automatic/recipe_spec.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/spec/lib/automatic/recipe_spec.rb b/spec/lib/automatic/recipe_spec.rb index b77549d..589a517 100644 --- a/spec/lib/automatic/recipe_spec.rb +++ b/spec/lib/automatic/recipe_spec.rb @@ -20,14 +20,19 @@ Automatic.user_dir = nil end - describe "with a normal recipe" do - it "correctly load recipe" do + context "with a normal recipe" do + subject { recipe = Automatic::Recipe.new(TEST_RECIPE) - expect =[{"module"=>"SubscriptionFeed", - "config"=>{"feeds"=>["http://blog.id774.net/post/feed/"]}}, - {"module"=>"FilterIgnore", "config"=>{"link"=>["hoge"]}}, - {"module"=>"StorePermalink", "config"=>{"db"=>"test_permalink.db"}}] - recipe.each_plugin{recipe}.should == expect + recipe.each_plugin{recipe} + } + let(:expected) { [{"module"=>"SubscriptionFeed", + "config"=>{"feeds"=>["http://blog.id774.net/post/feed/"]}}, + {"module"=>"FilterIgnore", "config"=>{"link"=>["hoge"]}}, + {"module"=>"StorePermalink", "config"=>{"db"=>"test_permalink.db"}}] + } + + it "correctly load recipe" do + expect(subject).to eq expected end end From a51900f5aa6f700f58111be809601d1b94f2c075 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 23 Dec 2013 11:36:31 +0900 Subject: [PATCH 089/188] Append gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b6ee79e..66a4ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,6 @@ bin/tt pkg/ vendor/gems/ vendor/bundle/ +vendor/bundler/ bin/httparty bin/weather From d9a73c97db94c27aa4438ba98e58cf9385f6af8d Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 30 Dec 2013 18:41:33 +0900 Subject: [PATCH 090/188] Update Gemfile --- Gemfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 9469357..389a6dc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,19 @@ -# Version:20131125 +# Version:20131230 source "http://rubygems.org" source "http://gems.github.com" gem 'json' gem 'sqlite3' -gem 'activesupport', '~>4.0.0' -gem 'activerecord', '~>4.0.0' +gem 'activesupport', '~> 4.0.0' +gem 'activerecord', '~> 4.0.0' gem 'hashie' gem 'gcalapi' gem 'xml-simple' gem 'feedbag' gem 'nokogiri' gem 'sanitize' -gem 'twitter', '~>4.8.1' +gem 'twitter', '~> 4.8.1' gem 'weather_hacker' gem 'pocket-ruby' gem 'hipchat' @@ -21,7 +21,7 @@ gem 'fluent-logger' gem 'dalli' group :test do - gem 'rspec', '~> 2.14.0' + gem 'rspec', '~> 2.14.1' gem 'rcov', :platforms => :mri_18 gem 'simplecov' gem 'simplecov-rcov' From 765733fd35e86f8a1fb7b152ffaaedb331828dbe Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 7 Jan 2014 09:33:05 +0900 Subject: [PATCH 091/188] 362 Ruby 2.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15e94fa..89ab6c1 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ For more info, refer to the document (doc/README). Environment ----------- -Ruby 1.9 - 2.0. See Gemfile. +Ruby 1.9 - 2.1. See Gemfile. Development From a87260a1f3e0ff71ea4f4f0cdf2727f0d0ccc923 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 15 Jan 2014 13:57:25 +0900 Subject: [PATCH 092/188] #16 Refactoring error retry handling --- plugins/notify/ikachan.rb | 2 +- plugins/publish/eject.rb | 8 ++++---- plugins/publish/google_calendar.rb | 4 ++-- plugins/publish/hatena_bookmark.rb | 6 +++--- plugins/publish/hipchat.rb | 10 +++++----- plugins/publish/instapaper.rb | 8 ++++---- plugins/publish/pocket.rb | 8 ++++---- plugins/publish/twitter.rb | 4 ++-- plugins/store/target_link.rb | 8 ++++---- plugins/subscription/chan_toru.rb | 2 +- plugins/subscription/feed.rb | 6 +++--- plugins/subscription/g_guide.rb | 6 +++--- plugins/subscription/link.rb | 8 ++++---- plugins/subscription/pocket.rb | 6 +++--- plugins/subscription/tumblr.rb | 8 ++++---- plugins/subscription/twitter.rb | 8 ++++---- plugins/subscription/twitter_search.rb | 2 +- plugins/subscription/xml.rb | 8 ++++---- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/plugins/notify/ikachan.rb b/plugins/notify/ikachan.rb index 05d4fb0..796096f 100644 --- a/plugins/notify/ikachan.rb +++ b/plugins/notify/ikachan.rb @@ -75,7 +75,7 @@ def run feeds.items.each {|feed| Automatic::Log.puts("info", %Q(Ikachan: [#{feed.link}] sending with params #{ikachan.params.to_s}...)) ikachan.post(feed.link, feed.title) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/eject.rb b/plugins/publish/eject.rb index 7907ee1..4334a72 100644 --- a/plugins/publish/eject.rb +++ b/plugins/publish/eject.rb @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Publish::Eject # Author:: soramugi -# Created:: Jun 9, 2013 -# Updated:: Jun 9, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Created:: Jun 9, 2013 +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -23,7 +23,7 @@ def run Automatic::Log.puts('info', "Eject: #{feed.link}") interval = @config['interval'].to_i unless @config['interval'].nil? unless @config.nil? - sleep 3 if interval.nil? + sleep ||= @config['interval'].to_i end } end diff --git a/plugins/publish/google_calendar.rb b/plugins/publish/google_calendar.rb index 46ed9fa..f70e568 100644 --- a/plugins/publish/google_calendar.rb +++ b/plugins/publish/google_calendar.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Googlecalendar # Author:: 774 # Created:: Feb 24, 2012 -# Updated:: Jan 8, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/plugins/publish/hatena_bookmark.rb b/plugins/publish/hatena_bookmark.rb index d9a57fe..d7f0ca4 100644 --- a/plugins/publish/hatena_bookmark.rb +++ b/plugins/publish/hatena_bookmark.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::HatenaBookmark # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Mar 7, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -89,7 +89,7 @@ def run unless feeds.nil? feeds.items.each {|feed| hb.post(rewrite(feed.link), nil) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/hipchat.rb b/plugins/publish/hipchat.rb index 73205f3..7189f8e 100644 --- a/plugins/publish/hipchat.rb +++ b/plugins/publish/hipchat.rb @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Publish::Hipchat # Author:: Kohei Hasegawa -# Created:: Jun 6, 2013 -# Updated:: Jun 6, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Created:: Jun 6, 2013 +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -32,10 +32,10 @@ def run rescue => e retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, #{e.message}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/instapaper.rb b/plugins/publish/instapaper.rb index 3faa296..c7226c9 100644 --- a/plugins/publish/instapaper.rb +++ b/plugins/publish/instapaper.rb @@ -3,8 +3,8 @@ # Author:: soramugi # 774 # Created:: Feb 9, 2013 -# Updated:: Mar 23, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -74,10 +74,10 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to instapaper.") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/pocket.rb b/plugins/publish/pocket.rb index a0ad52f..f2533d5 100644 --- a/plugins/publish/pocket.rb +++ b/plugins/publish/pocket.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Pocket # Author:: soramugi # Created:: May 15, 2013 -# Updated:: May 15, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -31,10 +31,10 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to pocket.") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/twitter.rb b/plugins/publish/twitter.rb index c724702..0503cda 100644 --- a/plugins/publish/twitter.rb +++ b/plugins/publish/twitter.rb @@ -44,10 +44,10 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to twitter.") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/store/target_link.rb b/plugins/store/target_link.rb index 86cd308..510adab 100644 --- a/plugins/store/target_link.rb +++ b/plugins/store/target_link.rb @@ -3,8 +3,8 @@ # Name:: Automatic::Plugin::Store::TargetLink # Author:: 774 # Created:: Feb 28, 2012 -# Updated:: Feb 9, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'open-uri' @@ -28,10 +28,10 @@ def run begin retries += 1 wget(feed.link) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i rescue Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault during file download.") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end end diff --git a/plugins/subscription/chan_toru.rb b/plugins/subscription/chan_toru.rb index 827f1e0..72a1492 100644 --- a/plugins/subscription/chan_toru.rb +++ b/plugins/subscription/chan_toru.rb @@ -33,7 +33,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end diff --git a/plugins/subscription/feed.rb b/plugins/subscription/feed.rb index 6eb9fe2..cf92b51 100644 --- a/plugins/subscription/feed.rb +++ b/plugins/subscription/feed.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::SubscriptionFeed # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Feb 8, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -22,7 +22,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end } diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index a542fd5..789c058 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::GGuide # Author:: soramugi # Created:: Jun 28, 2013 -# Updated:: Jun 28, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -29,7 +29,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end @pipeline diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index 380cd85..d5e08a2 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Link # Author:: 774 # Created:: Sep 18, 2012 -# Updated:: Apr 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -25,7 +25,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end } @@ -38,7 +38,7 @@ def create_rss(url) html = open(url).read unless html.nil? rss = Automatic::FeedParser.parse(html) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i @return_feeds << rss end end diff --git a/plugins/subscription/pocket.rb b/plugins/subscription/pocket.rb index 684358e..b33c913 100644 --- a/plugins/subscription/pocket.rb +++ b/plugins/subscription/pocket.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Pocket # Author:: soramugi # Created:: May 21, 2013 -# Updated:: May 21, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -28,7 +28,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end @pipeline diff --git a/plugins/subscription/tumblr.rb b/plugins/subscription/tumblr.rb index 0e9179b..2abc5af 100644 --- a/plugins/subscription/tumblr.rb +++ b/plugins/subscription/tumblr.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Tumblr # Author:: 774 # Created:: Oct 16, 2012 -# Updated:: Apr 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -32,7 +32,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end } @@ -51,7 +51,7 @@ def create_rss(url) item.link = nil end } - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i @return_feeds << rss end end diff --git a/plugins/subscription/twitter.rb b/plugins/subscription/twitter.rb index 3630675..65a5ad1 100644 --- a/plugins/subscription/twitter.rb +++ b/plugins/subscription/twitter.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Twitter # Author:: 774 # Created:: Sep 9, 2012 -# Updated:: Apr 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -26,7 +26,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end } @@ -59,7 +59,7 @@ def create_rss(url) item.description = content.search('[@class="js-tweet-text"]').text.to_s } } - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i @return_feeds << rss end end diff --git a/plugins/subscription/twitter_search.rb b/plugins/subscription/twitter_search.rb index ae0aedb..835586f 100644 --- a/plugins/subscription/twitter_search.rb +++ b/plugins/subscription/twitter_search.rb @@ -41,7 +41,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end @pipeline diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index 0db84b1..945fd03 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Xml # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Jul 12, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -27,7 +27,7 @@ def run rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i retry if retries <= @config['retry'].to_i unless @config['retry'].nil? end } @@ -42,7 +42,7 @@ def create_rss(url) data = ActiveSupport::JSON.decode(json) unless data.nil? rss = Automatic::FeedParser.content_provide(url, data) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i @return_feeds << rss end end From 672d2b5c991066adf03766c581c7f3ae618edfee Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 15 Jan 2014 14:38:41 +0900 Subject: [PATCH 093/188] #16 Refactoring error retry handling --- plugins/publish/google_calendar.rb | 2 +- plugins/publish/hipchat.rb | 3 ++- plugins/publish/instapaper.rb | 3 ++- plugins/publish/pocket.rb | 3 ++- plugins/publish/twitter.rb | 3 ++- plugins/store/target_link.rb | 3 ++- plugins/subscription/chan_toru.rb | 3 ++- plugins/subscription/feed.rb | 3 ++- plugins/subscription/g_guide.rb | 3 ++- plugins/subscription/link.rb | 3 ++- plugins/subscription/pocket.rb | 3 ++- plugins/subscription/tumblr.rb | 3 ++- plugins/subscription/twitter.rb | 4 +++- plugins/subscription/twitter_search.rb | 7 ++++--- plugins/subscription/xml.rb | 3 ++- test/integration/test_instapaper.yml | 3 ++- 16 files changed, 34 insertions(+), 18 deletions(-) diff --git a/plugins/publish/google_calendar.rb b/plugins/publish/google_calendar.rb index f70e568..d1d03b2 100644 --- a/plugins/publish/google_calendar.rb +++ b/plugins/publish/google_calendar.rb @@ -74,7 +74,7 @@ def run unless feeds.nil? feeds.items.each {|feed| @gc.add('今日 ' + feed.title) - sleep @config['interval'].to_i unless @config['interval'].nil? + sleep ||= @config['interval'].to_i } end } diff --git a/plugins/publish/hipchat.rb b/plugins/publish/hipchat.rb index 7189f8e..15c6db5 100644 --- a/plugins/publish/hipchat.rb +++ b/plugins/publish/hipchat.rb @@ -26,6 +26,7 @@ def run unless feeds.nil? feeds.items.each {|feed| retries = 0 + retry_max = @config['retry'].to_i || 0 begin @client.send(@config['username'], feed.description, @options) Automatic::Log.puts("info", "post: #{feed.description.gsub(/[\r\n]/,'')[0..50]}...") rescue nil @@ -33,7 +34,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, #{e.message}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end sleep ||= @config['interval'].to_i } diff --git a/plugins/publish/instapaper.rb b/plugins/publish/instapaper.rb index c7226c9..3cc240f 100644 --- a/plugins/publish/instapaper.rb +++ b/plugins/publish/instapaper.rb @@ -69,13 +69,14 @@ def run feeds.items.each {|feed| Automatic::Log.puts("info", "add: #{feed.link}") retries = 0 + retry_max = @config['retry'].to_i || 0 begin instapaper.add(feed.link, feed.title, feed.description) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to instapaper.") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end sleep ||= @config['interval'].to_i } diff --git a/plugins/publish/pocket.rb b/plugins/publish/pocket.rb index f2533d5..2100a0e 100644 --- a/plugins/publish/pocket.rb +++ b/plugins/publish/pocket.rb @@ -25,6 +25,7 @@ def run unless feeds.nil? feeds.items.each {|feed| retries = 0 + retry_max = @config['retry'].to_i || 0 begin @client.add(:url => feed.link) Automatic::Log.puts("info", "add: #{feed.link}") @@ -32,7 +33,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to pocket.") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end sleep ||= @config['interval'].to_i } diff --git a/plugins/publish/twitter.rb b/plugins/publish/twitter.rb index 0503cda..b01d068 100644 --- a/plugins/publish/twitter.rb +++ b/plugins/publish/twitter.rb @@ -36,6 +36,7 @@ def run feeds.items.each {|feed| Automatic::Log.puts("info", "tweet: #{feed.link}") retries = 0 + retry_max = @config['retry'].to_i || 0 begin tweet = @tweet_tmp.gsub(/\{(.+?)\}/) do |text| feed.__send__($1) @@ -45,7 +46,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to twitter.") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end sleep ||= @config['interval'].to_i } diff --git a/plugins/store/target_link.rb b/plugins/store/target_link.rb index 510adab..a8245d3 100644 --- a/plugins/store/target_link.rb +++ b/plugins/store/target_link.rb @@ -25,6 +25,7 @@ def run Automatic::Log.puts("info", "Downloading: #{feed.link}") FileUtils.mkdir_p(@config['path']) unless FileTest.exist?(@config['path']) retries = 0 + retry_max = @config['retry'].to_i || 0 begin retries += 1 wget(feed.link) @@ -32,7 +33,7 @@ def run rescue Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault during file download.") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end end } diff --git a/plugins/subscription/chan_toru.rb b/plugins/subscription/chan_toru.rb index 72a1492..070ad32 100644 --- a/plugins/subscription/chan_toru.rb +++ b/plugins/subscription/chan_toru.rb @@ -32,9 +32,10 @@ def run @pipeline = pipeline rescue retries += 1 + retry_max = @config['retry'].to_i || 0 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end @pipeline diff --git a/plugins/subscription/feed.rb b/plugins/subscription/feed.rb index cf92b51..2d1e8e8 100644 --- a/plugins/subscription/feed.rb +++ b/plugins/subscription/feed.rb @@ -16,6 +16,7 @@ def initialize(config, pipeline=[]) def run @config['feeds'].each {|feed| retries = 0 + retry_max = @config['retry'].to_i || 0 begin rss = Automatic::FeedParser.get(feed) @pipeline << rss @@ -23,7 +24,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end } @pipeline diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index 789c058..7c77455 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -22,6 +22,7 @@ def initialize(config, pipeline=[]) def run retries = 0 + retry_max = @config['retry'].to_i || 0 begin @keywords.each {|keyword| @pipeline << Automatic::FeedParser.get(feed_url keyword) @@ -30,7 +31,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end @pipeline end diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index d5e08a2..1e7e07b 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -20,13 +20,14 @@ def run @return_feeds = [] @config['urls'].each {|url| retries = 0 + retry_max = @config['retry'].to_i || 0 begin create_rss(URI.encode(url)) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end } @return_feeds diff --git a/plugins/subscription/pocket.rb b/plugins/subscription/pocket.rb index b33c913..51ff11f 100644 --- a/plugins/subscription/pocket.rb +++ b/plugins/subscription/pocket.rb @@ -22,6 +22,7 @@ def initialize(config, pipeline=[]) def run retries = 0 + retry_max = @config['retry'].to_i || 0 begin dummyfeeds = cleate_dummy_feed(@client.retrieve(@config['optional'])) @pipeline << Automatic::FeedParser.create(dummyfeeds) @@ -29,7 +30,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end @pipeline end diff --git a/plugins/subscription/tumblr.rb b/plugins/subscription/tumblr.rb index 2abc5af..229fb3d 100644 --- a/plugins/subscription/tumblr.rb +++ b/plugins/subscription/tumblr.rb @@ -19,6 +19,7 @@ def run @return_feeds = [] @config['urls'].each {|url| retries = 0 + retry_max = @config['retry'].to_i || 0 begin create_rss(url) unless @config['pages'].nil? @@ -33,7 +34,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end } @return_feeds diff --git a/plugins/subscription/twitter.rb b/plugins/subscription/twitter.rb index 65a5ad1..ac732a4 100644 --- a/plugins/subscription/twitter.rb +++ b/plugins/subscription/twitter.rb @@ -21,19 +21,21 @@ def run @return_feeds = [] @config['urls'].each {|url| retries = 0 + retry_max = @config['retry'].to_i || 0 begin create_rss(url) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end } @return_feeds end private + def create_rss(url) Automatic::Log.puts("info", "Parsing: #{url}") html = open(url).read diff --git a/plugins/subscription/twitter_search.rb b/plugins/subscription/twitter_search.rb index 835586f..41b85ab 100644 --- a/plugins/subscription/twitter_search.rb +++ b/plugins/subscription/twitter_search.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::TwitterSearch # Author:: soramugi # Created:: May 30, 2013 -# Updated:: May 30, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -24,6 +24,7 @@ def initialize(config, pipeline=[]) def run @pipeline = [] retries = 0 + retry_max = @config['retry'].to_i || 0 begin feeds = [] @client.search(@config['search'],@config['opt']).results.each do |status| @@ -42,7 +43,7 @@ def run retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end @pipeline end diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index 945fd03..d0ac02c 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -22,13 +22,14 @@ def run @return_feeds = [] @config['urls'].each {|url| retries = 0 + retry_max = @config['retry'].to_i || 0 begin create_rss(URI.encode(url)) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") sleep ||= @config['interval'].to_i - retry if retries <= @config['retry'].to_i unless @config['retry'].nil? + retry if retries <= retry_max end } @return_feeds diff --git a/test/integration/test_instapaper.yml b/test/integration/test_instapaper.yml index cdaf387..034b70c 100644 --- a/test/integration/test_instapaper.yml +++ b/test/integration/test_instapaper.yml @@ -19,7 +19,8 @@ plugins: config: email: your_email password: your_pass - interval: 5 + interval: 2 + retry: 2 #- module: PublishConsole From 0fcf960b36e2fae9de52459e6612c87a0d03d34d Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 15 Jan 2014 15:03:12 +0900 Subject: [PATCH 094/188] #65 Improvement CI with network connection --- plugins/subscription/chan_toru.rb | 6 +++--- test/integration/test_add_pocket.yml | 2 ++ test/integration/test_chan_toru.yml | 6 ++++-- test/integration/test_image2local.yml | 2 +- test/integration/test_link2local.yml | 4 ++-- test/integration/test_pocket.yml | 3 +-- test/integration/test_sort.yml | 4 ++-- test/integration/test_tumblr2local.yml | 4 ++-- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/plugins/subscription/chan_toru.rb b/plugins/subscription/chan_toru.rb index 070ad32..4af0a86 100644 --- a/plugins/subscription/chan_toru.rb +++ b/plugins/subscription/chan_toru.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::ChanToru # Author:: soramugi # Created:: Jun 28, 2013 -# Updated:: Jun 28, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '/g_guide') @@ -22,6 +22,7 @@ def g_guide_pipeline def run retries = 0 + retry_max = @config['retry'].to_i || 0 begin pipeline = g_guide_pipeline pipeline.each {|feeds| @@ -32,7 +33,6 @@ def run @pipeline = pipeline rescue retries += 1 - retry_max = @config['retry'].to_i || 0 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") sleep ||= @config['interval'].to_i retry if retries <= retry_max diff --git a/test/integration/test_add_pocket.yml b/test/integration/test_add_pocket.yml index 43d7753..6f1c48d 100644 --- a/test/integration/test_add_pocket.yml +++ b/test/integration/test_add_pocket.yml @@ -19,6 +19,8 @@ plugins: config: consumer_key: consumer_key access_token: access_token + interval: 2 + retry: 2 #- module: PublishConsole diff --git a/test/integration/test_chan_toru.yml b/test/integration/test_chan_toru.yml index 792808c..5a9f5c2 100644 --- a/test/integration/test_chan_toru.yml +++ b/test/integration/test_chan_toru.yml @@ -8,8 +8,10 @@ global: plugins: - module: SubscriptionChanToru config: - keyword: 'アニメ' - station: '地上波' + keyword: 'アニメ' + station: '地上波' + interval: 2 + retry: 2 - module: StorePermalink config: diff --git a/test/integration/test_image2local.yml b/test/integration/test_image2local.yml index f927390..7892987 100644 --- a/test/integration/test_image2local.yml +++ b/test/integration/test_image2local.yml @@ -23,7 +23,7 @@ plugins: config: path: /tmp retry: 2 - interval: 4 + interval: 2 #- module: PublishConsole diff --git a/test/integration/test_link2local.yml b/test/integration/test_link2local.yml index cdcfa63..a8e3113 100644 --- a/test/integration/test_link2local.yml +++ b/test/integration/test_link2local.yml @@ -21,8 +21,8 @@ plugins: config: urls: - http://reblog.id774.net - interval: 5 - retry: 5 + interval: 2 + retry: 2 - module: FilterImage diff --git a/test/integration/test_pocket.yml b/test/integration/test_pocket.yml index ec11e0d..1b0ce77 100644 --- a/test/integration/test_pocket.yml +++ b/test/integration/test_pocket.yml @@ -11,7 +11,7 @@ plugins: consumer_key: 'consumer_key' access_token: 'access_token' optional: - favorite: 1 + favorite: 3 count: 2 - module: StorePermalink @@ -20,4 +20,3 @@ plugins: #- module: PublishConsole - diff --git a/test/integration/test_sort.yml b/test/integration/test_sort.yml index 3332d72..faf5cd3 100644 --- a/test/integration/test_sort.yml +++ b/test/integration/test_sort.yml @@ -21,8 +21,8 @@ plugins: config: feeds: - http://blog.id774.net/post/feed/ - interval: 5 - retry: 5 + interval: 2 + retry: 2 - module: FilterSort config: diff --git a/test/integration/test_tumblr2local.yml b/test/integration/test_tumblr2local.yml index 9a3dc1d..23bef2b 100644 --- a/test/integration/test_tumblr2local.yml +++ b/test/integration/test_tumblr2local.yml @@ -24,8 +24,8 @@ plugins: urls: - http://reblog.id774.net pages: 1 - interval: 5 - retry: 5 + interval: 2 + retry: 2 - module: FilterImage From 3923d2cc5e23fa37a5658557093a7803bec0d332 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Jan 2014 14:25:07 +0900 Subject: [PATCH 095/188] 363 Fix dependency conflict --- Gemfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 389a6dc..bd5e2c3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20131230 +# Version:20140116 source "http://rubygems.org" source "http://gems.github.com" @@ -13,9 +13,10 @@ gem 'xml-simple' gem 'feedbag' gem 'nokogiri' gem 'sanitize' +gem 'faraday', '~> 0.8.9' gem 'twitter', '~> 4.8.1' +gem 'pocket-ruby', '~> 0.0.4' gem 'weather_hacker' -gem 'pocket-ruby' gem 'hipchat' gem 'fluent-logger' gem 'dalli' From d1671286d4d4418ce6e2692d697a0cba656ad02a Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 24 Jan 2014 14:37:23 +0900 Subject: [PATCH 096/188] 364 Fix all gems version, Append ChangeLog --- Gemfile | 44 ++++++++++++++++++++++---------------------- doc/ChangeLog | 7 +++++++ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index bd5e2c3..3dc12c4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,36 +1,36 @@ -# Version:20140116 +# Version:20140124 source "http://rubygems.org" source "http://gems.github.com" -gem 'json' -gem 'sqlite3' -gem 'activesupport', '~> 4.0.0' -gem 'activerecord', '~> 4.0.0' -gem 'hashie' -gem 'gcalapi' -gem 'xml-simple' -gem 'feedbag' -gem 'nokogiri' -gem 'sanitize' -gem 'faraday', '~> 0.8.9' -gem 'twitter', '~> 4.8.1' -gem 'pocket-ruby', '~> 0.0.4' -gem 'weather_hacker' -gem 'hipchat' -gem 'fluent-logger' -gem 'dalli' +gem 'json', '~> 1.8.1' +gem 'sqlite3', '~> 1.3.8' +gem 'activesupport', '~> 4.0.2' +gem 'activerecord', '~> 4.0.2' +gem 'hashie', '~> 2.0.5' +gem 'gcalapi', '~> 0.1.2' +gem 'xml-simple', '~> 1.1.3' +gem 'feedbag', '~> 0.9.2' +gem 'nokogiri', '~> 1.6.1' +gem 'sanitize', '~> 2.1.0' +gem 'faraday', '~> 0.8.9' +gem 'twitter', '~> 4.8.1' +gem 'pocket-ruby', '~> 0.0.4' +gem 'weather_hacker', '~> 0.1.7' +gem 'hipchat', '~> 1.0.1' +gem 'fluent-logger', '~> 0.4.7' +gem 'dalli', '~> 2.7.0' group :test do gem 'rspec', '~> 2.14.1' gem 'rcov', :platforms => :mri_18 - gem 'simplecov' - gem 'simplecov-rcov' - gem 'koseki-mocksmtpd' + gem 'simplecov', '~> 0.8.2' + gem 'simplecov-rcov', '~> 0.2.3' + gem 'koseki-mocksmtpd', '~> 0.0.3' end group :development do - gem "cucumber" + gem 'cucumber' gem 'bundler' gem 'builder' gem "jeweler" diff --git a/doc/ChangeLog b/doc/ChangeLog index 7e93e1a..92b8af7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +=== 14.1.0 / 2014-01-24 + +* Fix dependency conflict. + +* Refactoring error retry handling. + + === 13.12.0 / 2013-12-17 * Fix twitter gem version. From 569708be2e9433afebc494aa6fb8dcbaa2cf1720 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 24 Jan 2014 15:04:47 +0900 Subject: [PATCH 097/188] 365 Version bump to 14.1.0 --- VERSION | 2 +- lib/automatic.rb | 6 +++--- lib/automatic/version.rb | 3 +++ spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 lib/automatic/version.rb diff --git a/VERSION b/VERSION index 6665a53..7b3b6e0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.12.0 +14.1.0 diff --git a/lib/automatic.rb b/lib/automatic.rb index 2b61d38..5506525 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Dec 18, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Jan 24, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic @@ -12,8 +12,8 @@ module Automatic require 'automatic/pipeline' require 'automatic/log' require 'automatic/feed_parser' + require 'automatic/version' - VERSION = "13.12.0-devel" USER_DIR = "/.automatic" class << self diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb new file mode 100644 index 0000000..2a4f4cc --- /dev/null +++ b/lib/automatic/version.rb @@ -0,0 +1,3 @@ +module Automatic + VERSION = "14.1.0" +end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 137845e..a78108b 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Dec 18, 2013 +# Updated:: Jan 24, 2014 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "13.12.0-devel" } + it { expect(subject).to eq "14.1.0" } end describe "#(root)_dir" do From b7acfcca762ee6c3f463d2ecd7f36dcee7d4c6c3 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 24 Jan 2014 15:51:19 +0900 Subject: [PATCH 098/188] Regenerate gemspec for version 14.1.0 --- automatic.gemspec | 104 ++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index c722f96..9b15815 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,15 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 13.12.0 ruby lib +# stub: automatic 14.1.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "13.12.0" + s.version = "14.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2013-12-17" + s.date = "2014-01-24" s.description = "Ruby General Automation Framework" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -41,6 +42,7 @@ Gem::Specification.new do |s| "lib/automatic/opml.rb", "lib/automatic/pipeline.rb", "lib/automatic/recipe.rb", + "lib/automatic/version.rb", "plugins/custom_feed/svn_log.rb", "plugins/filter/absolute_uri.rb", "plugins/filter/accept.rb", @@ -158,73 +160,75 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] - s.require_paths = ["lib"] - s.rubygems_version = "2.1.11" + s.rubygems_version = "2.2.0" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 4.0.0"]) - s.add_runtime_dependency(%q, ["~> 4.0.0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 1.8.1"]) + s.add_runtime_dependency(%q, ["~> 1.3.8"]) + s.add_runtime_dependency(%q, ["~> 4.0.2"]) + s.add_runtime_dependency(%q, ["~> 4.0.2"]) + s.add_runtime_dependency(%q, ["~> 2.0.5"]) + s.add_runtime_dependency(%q, ["~> 0.1.2"]) + s.add_runtime_dependency(%q, ["~> 1.1.3"]) + s.add_runtime_dependency(%q, ["~> 0.9.2"]) + s.add_runtime_dependency(%q, ["~> 1.6.1"]) + s.add_runtime_dependency(%q, ["~> 2.1.0"]) + s.add_runtime_dependency(%q, ["~> 0.8.9"]) s.add_runtime_dependency(%q, ["~> 4.8.1"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 0.0.4"]) + s.add_runtime_dependency(%q, ["~> 0.1.7"]) + s.add_runtime_dependency(%q, ["~> 1.0.1"]) + s.add_runtime_dependency(%q, ["~> 0.4.7"]) + s.add_runtime_dependency(%q, ["~> 2.7.0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.3.8"]) + s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 2.0.5"]) + s.add_dependency(%q, ["~> 0.1.2"]) + s.add_dependency(%q, ["~> 1.1.3"]) + s.add_dependency(%q, ["~> 0.9.2"]) + s.add_dependency(%q, ["~> 1.6.1"]) + s.add_dependency(%q, ["~> 2.1.0"]) + s.add_dependency(%q, ["~> 0.8.9"]) s.add_dependency(%q, ["~> 4.8.1"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.0.4"]) + s.add_dependency(%q, ["~> 0.1.7"]) + s.add_dependency(%q, ["~> 1.0.1"]) + s.add_dependency(%q, ["~> 0.4.7"]) + s.add_dependency(%q, ["~> 2.7.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, ["~> 4.0.0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.3.8"]) + s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 2.0.5"]) + s.add_dependency(%q, ["~> 0.1.2"]) + s.add_dependency(%q, ["~> 1.1.3"]) + s.add_dependency(%q, ["~> 0.9.2"]) + s.add_dependency(%q, ["~> 1.6.1"]) + s.add_dependency(%q, ["~> 2.1.0"]) + s.add_dependency(%q, ["~> 0.8.9"]) s.add_dependency(%q, ["~> 4.8.1"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.0.4"]) + s.add_dependency(%q, ["~> 0.1.7"]) + s.add_dependency(%q, ["~> 1.0.1"]) + s.add_dependency(%q, ["~> 0.4.7"]) + s.add_dependency(%q, ["~> 2.7.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From 51764081f63458d8fae5e3e11b960c3aa65606ca Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 25 Jan 2014 18:03:31 +0900 Subject: [PATCH 099/188] 366 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 2a4f4cc..4e72ba1 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.1.0" + VERSION = "14.1.0-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index a78108b..4681618 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jan 24, 2014 +# Updated:: Jan 25, 2014 # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.1.0" } + it { expect(subject).to eq "14.1.0-devel" } end describe "#(root)_dir" do From e601cc7889c6cb394074787109a576b3e546ad4c Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 26 Jan 2014 23:04:54 +0900 Subject: [PATCH 100/188] 367 Fix readme --- doc/README | 2 +- doc/README.ja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README b/doc/README index 8b25d7b..d24a6d8 100644 --- a/doc/README +++ b/doc/README @@ -496,7 +496,7 @@ TODO Environment =========== - Ruby 1.9 - 2.0. + Ruby 1.9 - 2.1. Depend on the packages that described in Gemfile. diff --git a/doc/README.ja b/doc/README.ja index b266d14..dce3a99 100644 --- a/doc/README.ja +++ b/doc/README.ja @@ -504,7 +504,7 @@ TODO 動作環境 ======== -Ruby 1.9 - 2.0 +Ruby 1.9 - 2.1 Gemfile に記述された gem パッケージに依存 From 91a03e183f7c81374a904a7fd29e2bbae30e6e07 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Feb 2014 14:47:39 +0900 Subject: [PATCH 101/188] #66 Refactoring --- plugins/subscription/text.rb | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 6510bd9..d13af2e 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -8,26 +8,11 @@ module Automatic::Plugin class TextFeed + attr_accessor :title, :link def initialize @link = 'http://dummy' @title = 'dummy' end - - def link - @link - end - - def title - @title - end - - def set_link(link) - @link = link - end - - def set_title(title) - @title = title - end end class SubscriptionText @@ -41,7 +26,7 @@ def initialize(config, pipeline=[]) unless @config['titles'].nil? @config['titles'].each {|title| textFeed = TextFeed.new - textFeed.set_title(title) + textFeed.title = title @dummyfeeds << textFeed } end @@ -49,7 +34,7 @@ def initialize(config, pipeline=[]) unless @config['urls'].nil? @config['urls'].each {|url| textFeed = TextFeed.new - textFeed.set_link(url) + textFeed.link = url @dummyfeeds << textFeed } end @@ -57,8 +42,8 @@ def initialize(config, pipeline=[]) unless @config['feeds'].nil? @config['feeds'].each {|feed| textFeed = TextFeed.new - textFeed.set_title(feed['title']) unless feed['title'].nil? - textFeed.set_link(feed['url']) unless feed['url'].nil? + textFeed.title = feed['title'] unless feed['title'].nil? + textFeed.link = feed['url'] unless feed['url'].nil? @dummyfeeds << textFeed } end From e9dd237e87f4f8699ab1354ffa3313b74a4252d3 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Feb 2014 15:01:37 +0900 Subject: [PATCH 102/188] #66 Add fields description, author, comments --- plugins/subscription/text.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index d13af2e..939590f 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -1,17 +1,22 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::Text # Author:: soramugi -# Created:: May 6, 2013 -# Updated:: May 6, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# 774 +# Created:: May 6, 2013 +# Updated:: Feb 19, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin class TextFeed - attr_accessor :title, :link + attr_accessor :title, :link, :description, :author, :comments + def initialize - @link = 'http://dummy' - @title = 'dummy' + @link = 'http://dummy' + @title = 'dummy' + @description = '' + @author = '' + @comments = '' end end @@ -44,11 +49,14 @@ def initialize(config, pipeline=[]) textFeed = TextFeed.new textFeed.title = feed['title'] unless feed['title'].nil? textFeed.link = feed['url'] unless feed['url'].nil? + textFeed.description = feed['description'] unless feed['description'].nil? + textFeed.author = feed['author'] unless feed['author'].nil? + textFeed.comments = feed['comments'] unless feed['comments'].nil? @dummyfeeds << textFeed } end - end + end end def run From 9f76d8188afbe0af47a09d751f6e16addfb1bfeb Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Feb 2014 15:38:39 +0900 Subject: [PATCH 103/188] #66 Refactoring --- plugins/subscription/text.rb | 59 ++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 939590f..92b3c69 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -25,45 +25,66 @@ class SubscriptionText def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + end + + def run + create_feed + + if @dummyfeeds != [] + @pipeline << Automatic::FeedParser.create(@dummyfeeds) + end + @pipeline + end + + private + def generate_textfeed(feed) + textFeed = TextFeed.new + textFeed.title = feed['title'] unless feed['title'].nil? + textFeed.link = feed['url'] unless feed['url'].nil? + textFeed.description = feed['description'] unless feed['description'].nil? + textFeed.author = feed['author'] unless feed['author'].nil? + textFeed.comments = feed['comments'] unless feed['comments'].nil? + @dummyfeeds << textFeed + end + + def create_feed unless @config.nil? @dummyfeeds = [] unless @config['titles'].nil? @config['titles'].each {|title| - textFeed = TextFeed.new - textFeed.title = title - @dummyfeeds << textFeed + feed = {} + feed['title'] = title + generate_textfeed(feed) } end unless @config['urls'].nil? @config['urls'].each {|url| - textFeed = TextFeed.new - textFeed.link = url - @dummyfeeds << textFeed + feed = {} + feed['url'] = url + generate_textfeed(feed) } end unless @config['feeds'].nil? @config['feeds'].each {|feed| - textFeed = TextFeed.new - textFeed.title = feed['title'] unless feed['title'].nil? - textFeed.link = feed['url'] unless feed['url'].nil? - textFeed.description = feed['description'] unless feed['description'].nil? - textFeed.author = feed['author'] unless feed['author'].nil? - textFeed.comments = feed['comments'] unless feed['comments'].nil? - @dummyfeeds << textFeed + generate_textfeed(feed) } end + unless @config['file'].nil? + open(@config['file']) do |file| + file.each_line do |line| + feed = {} + feed['title'], feed['link'], feed['description'], feed['author'], + feed['comments'] = line.force_encoding("utf-8").strip.split("\t") + generate_textfeed(feed) + end + end + end end end - def run - if @dummyfeeds != [] - @pipeline << Automatic::FeedParser.create(@dummyfeeds) - end - @pipeline - end end end From 6eea8957c87ae08d7749efe8b152dc566d99ddec Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 19 Feb 2014 16:06:58 +0900 Subject: [PATCH 104/188] #66 Add function to read text from files --- plugins/subscription/text.rb | 18 ++++++++------ spec/fixtures/sampleFeeds.tsv | 1 + spec/fixtures/sampleFeeds2.tsv | 2 ++ spec/plugins/subscription/text_spec.rb | 34 ++++++++++++++++++++++++-- test/integration/test_text2feed.yml | 8 ++++++ 5 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 spec/fixtures/sampleFeeds.tsv create mode 100644 spec/fixtures/sampleFeeds2.tsv diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 92b3c69..cc7228d 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -73,15 +73,17 @@ def create_feed } end - unless @config['file'].nil? - open(@config['file']) do |file| - file.each_line do |line| - feed = {} - feed['title'], feed['link'], feed['description'], feed['author'], - feed['comments'] = line.force_encoding("utf-8").strip.split("\t") - generate_textfeed(feed) + unless @config['files'].nil? + @config['files'].each {|f| + open(File.expand_path(f)) do |file| + file.each_line do |line| + feed = {} + feed['title'], feed['url'], feed['description'], feed['author'], + feed['comments'] = line.force_encoding("utf-8").strip.split("\t") + generate_textfeed(feed) + end end - end + } end end end diff --git a/spec/fixtures/sampleFeeds.tsv b/spec/fixtures/sampleFeeds.tsv new file mode 100644 index 0000000..0bb1339 --- /dev/null +++ b/spec/fixtures/sampleFeeds.tsv @@ -0,0 +1 @@ +testTitle http://dummy.from.file testDescription testComments diff --git a/spec/fixtures/sampleFeeds2.tsv b/spec/fixtures/sampleFeeds2.tsv new file mode 100644 index 0000000..6b40681 --- /dev/null +++ b/spec/fixtures/sampleFeeds2.tsv @@ -0,0 +1,2 @@ +testTitle1 http://dummy.from.file1 testDescription1 testComments1 +testTitle2 http://dummy.from.file2 testDescription2 testComments2 diff --git a/spec/plugins/subscription/text_spec.rb b/spec/plugins/subscription/text_spec.rb index 6e24533..b7bad74 100644 --- a/spec/plugins/subscription/text_spec.rb +++ b/spec/plugins/subscription/text_spec.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::Text # Author:: soramugi +# 774 # Created:: May 6, 2013 -# Updated:: May 6, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 19, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -51,4 +52,33 @@ its(:run) { should have(1).feed } end + context "with feeds including full fields whose return feed" do + subject { + Automatic::Plugin::SubscriptionText.new( + { 'feeds' => [ {'title' => 'huge', 'url' => "http://hugehuge", 'description' => "aaa", 'comments' => "bbb", 'author' => "ccc" } ] } + ) + } + + its(:run) { should have(1).feed } + end + + context "with file whose return feed" do + subject { + Automatic::Plugin::SubscriptionText.new( + { 'files' => ["spec/fixtures/sampleFeeds.tsv"] } + ) + } + + its(:run) { should have(1).feed } + end + + context "with files whose return feed" do + subject { + Automatic::Plugin::SubscriptionText.new( + { 'files' => ["spec/fixtures/sampleFeeds.tsv", "spec/fixtures/sampleFeeds2.tsv"] } + ) + } + + its(:run) { should have(1).feed } + end end diff --git a/test/integration/test_text2feed.yml b/test/integration/test_text2feed.yml index 047d612..819097e 100644 --- a/test/integration/test_text2feed.yml +++ b/test/integration/test_text2feed.yml @@ -19,6 +19,14 @@ plugins: - title: 'Tumblr' url: 'http://www.tumblr.com/dashboard' + description: 'aaa' + comments: 'bbb' + author: 'ccc' + files: + - 'spec/fixtures/sampleFeeds.tsv' + files: + - 'spec/fixtures/sampleFeeds.tsv' + - 'spec/fixtures/sampleFeeds2.tsv' - module: StorePermalink config: From 32d1728e0d00c60513d3f6d52e4c10b3f8dab1ff Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 20 Feb 2014 13:58:50 +0900 Subject: [PATCH 105/188] 368 Fix docs --- README.md | 2 +- Rakefile | 2 +- doc/README | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89ab6c1..dbfe39e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Automatic Ruby ============== -**Ruby General Automation Framework** +**Ruby framework for the general-purpose automatic processing** Description diff --git a/Rakefile b/Rakefile index 7e6b791..531bd17 100644 --- a/Rakefile +++ b/Rakefile @@ -32,7 +32,7 @@ Jeweler::Tasks.new do |gem| gem.homepage = "http://github.com/automaticruby/automaticruby" gem.license = "GPL" gem.summary = %Q{Automatic Ruby} - gem.description = %Q{Ruby General Automation Framework} + gem.description = %Q{Ruby framework for the general-purpose automatic processing} gem.email = "idnanashi@gmail.com" gem.authors = ["id774"] # dependencies defined in Gemfile diff --git a/doc/README b/doc/README index d24a6d8..c1be42f 100644 --- a/doc/README +++ b/doc/README @@ -1,7 +1,7 @@ automaticruby Name - Automatic Ruby - Ruby General Automation Framework + Automatic Ruby - Ruby framework for the general-purpose automatic processing Syntax $ automatic From 5b1cd3c724f28138f6a9a6895bd09c19a8377471 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 20 Feb 2014 17:16:08 +0900 Subject: [PATCH 106/188] Refactoring plugin Subscription::Text --- lib/automatic/feed_parser.rb | 21 +++++++++++++++++++ plugins/subscription/text.rb | 37 ++++++---------------------------- spec/fixtures/sampleFeeds.tsv | 2 +- spec/fixtures/sampleFeeds2.tsv | 4 ++-- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 337b966..477a65f 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -12,6 +12,27 @@ module FeedParser require 'uri' require 'nokogiri' + class FeedObject + attr_accessor :title, :link, :description, :author, :comments + def initialize + @link = 'http://dummy' + @title = 'dummy' + @description = '' + @author = '' + @comments = '' + end + end + + def self.generate_feed(feed) + feed_object = FeedObject.new + feed_object.title = feed['title'] unless feed['title'].nil? + feed_object.link = feed['url'] unless feed['url'].nil? + feed_object.description = feed['description'] unless feed['description'].nil? + feed_object.author = feed['author'] unless feed['author'].nil? + feed_object.comments = feed['comments'] unless feed['comments'].nil? + feed_object + end + def self.get(url) begin unless url.nil? diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index cc7228d..5d4d981 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -8,46 +8,21 @@ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin - class TextFeed - attr_accessor :title, :link, :description, :author, :comments - - def initialize - @link = 'http://dummy' - @title = 'dummy' - @description = '' - @author = '' - @comments = '' - end - end - class SubscriptionText - def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + @return_feeds = [] end def run create_feed - - if @dummyfeeds != [] - @pipeline << Automatic::FeedParser.create(@dummyfeeds) - end + @pipeline << Automatic::FeedParser.create(@return_feeds) unless @return_feeds.length == 0 @pipeline end private - def generate_textfeed(feed) - textFeed = TextFeed.new - textFeed.title = feed['title'] unless feed['title'].nil? - textFeed.link = feed['url'] unless feed['url'].nil? - textFeed.description = feed['description'] unless feed['description'].nil? - textFeed.author = feed['author'] unless feed['author'].nil? - textFeed.comments = feed['comments'] unless feed['comments'].nil? - @dummyfeeds << textFeed - end - def create_feed unless @config.nil? @dummyfeeds = [] @@ -55,7 +30,7 @@ def create_feed @config['titles'].each {|title| feed = {} feed['title'] = title - generate_textfeed(feed) + @return_feeds << Automatic::FeedParser.generate_feed(feed) } end @@ -63,13 +38,13 @@ def create_feed @config['urls'].each {|url| feed = {} feed['url'] = url - generate_textfeed(feed) + @return_feeds << Automatic::FeedParser.generate_feed(feed) } end unless @config['feeds'].nil? @config['feeds'].each {|feed| - generate_textfeed(feed) + @return_feeds << Automatic::FeedParser.generate_feed(feed) } end @@ -80,7 +55,7 @@ def create_feed feed = {} feed['title'], feed['url'], feed['description'], feed['author'], feed['comments'] = line.force_encoding("utf-8").strip.split("\t") - generate_textfeed(feed) + @return_feeds << Automatic::FeedParser.generate_feed(feed) end end } diff --git a/spec/fixtures/sampleFeeds.tsv b/spec/fixtures/sampleFeeds.tsv index 0bb1339..e6135d0 100644 --- a/spec/fixtures/sampleFeeds.tsv +++ b/spec/fixtures/sampleFeeds.tsv @@ -1 +1 @@ -testTitle http://dummy.from.file testDescription testComments +testTitle http://dummy.from.file testDescription testAuthor testComments diff --git a/spec/fixtures/sampleFeeds2.tsv b/spec/fixtures/sampleFeeds2.tsv index 6b40681..5064327 100644 --- a/spec/fixtures/sampleFeeds2.tsv +++ b/spec/fixtures/sampleFeeds2.tsv @@ -1,2 +1,2 @@ -testTitle1 http://dummy.from.file1 testDescription1 testComments1 -testTitle2 http://dummy.from.file2 testDescription2 testComments2 +testTitle1 http://dummy.from.file1 testDescription1 testComments1 +testTitle2 http://dummy.from.file2 testDescription2 testAuthor2 From 2f5e6be31b30720c0b93c408e50f4e494436032e Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 12:18:26 +0900 Subject: [PATCH 107/188] #71 Implement Automatic::FeedMaker --- lib/automatic.rb | 3 +- lib/automatic/feed_maker.rb | 80 ++++++++++++++++++++++++++ lib/automatic/feed_parser.rb | 73 ++--------------------- plugins/filter/accept.rb | 7 ++- plugins/filter/github_feed.rb | 23 ++++---- plugins/filter/image_source.rb | 18 +++--- plugins/filter/one.rb | 7 ++- plugins/filter/rand.rb | 6 +- plugins/store/database.rb | 6 +- plugins/subscription/feed.rb | 4 +- plugins/subscription/g_guide.rb | 5 +- plugins/subscription/link.rb | 5 +- plugins/subscription/pocket.rb | 23 ++++---- plugins/subscription/text.rb | 4 +- plugins/subscription/tumblr.rb | 4 +- plugins/subscription/twitter_search.rb | 23 ++++---- plugins/subscription/weather.rb | 13 +++-- plugins/subscription/xml.rb | 5 +- spec/plugins/provide/fluentd_spec.rb | 6 +- 19 files changed, 169 insertions(+), 146 deletions(-) create mode 100644 lib/automatic/feed_maker.rb diff --git a/lib/automatic.rb b/lib/automatic.rb index 5506525..07408f1 100755 --- a/lib/automatic.rb +++ b/lib/automatic.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jan 24, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -12,6 +12,7 @@ module Automatic require 'automatic/pipeline' require 'automatic/log' require 'automatic/feed_parser' + require 'automatic/feed_maker' require 'automatic/version' USER_DIR = "/.automatic" diff --git a/lib/automatic/feed_maker.rb b/lib/automatic/feed_maker.rb new file mode 100644 index 0000000..fddb99d --- /dev/null +++ b/lib/automatic/feed_maker.rb @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::FeedMaker +# Author:: 774 +# Created:: Feb 21, 2014 +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic + module FeedMaker + require 'rss' + require 'uri' + require 'nokogiri' + + class FeedObject + attr_accessor :title, :link, :description, :author, :comments + def initialize + @link = 'http://dummy' + @title = 'dummy' + @description = '' + @author = '' + @comments = '' + end + end + + def self.generate_feed(feed) + feed_object = FeedObject.new + feed_object.title = feed['title'] unless feed['title'].nil? + feed_object.link = feed['url'] unless feed['url'].nil? + feed_object.description = feed['description'] unless feed['description'].nil? + feed_object.author = feed['author'] unless feed['author'].nil? + feed_object.comments = feed['comments'] unless feed['comments'].nil? + feed_object + end + + def self.create_pipeline(feeds = []) + RSS::Maker.make("2.0") {|maker| + xss = maker.xml_stylesheets.new_xml_stylesheet + maker.channel.title = "Automatic Ruby" + maker.channel.description = "Automatic Ruby" + maker.channel.link = "https://github.com/automaticruby/automaticruby" + maker.items.do_sort = true + + unless feeds.nil? + feeds.each {|feed| + unless feed.link.nil? + Automatic::Log.puts("info", "Feed: #{feed.link}") + item = maker.items.new_item + item.title = feed.title + item.link = feed.link + begin + item.description = feed.description + item.author = feed.author + item.comments = feed.comments + item.date = feed.pubDate || Time.now + rescue NoMethodError + Automatic::Log.puts("warn", "Undefined field detected in feed.") + end + end + } + end + } + end + + def self.content_provide(url, data) + RSS::Maker.make("2.0") {|maker| + xss = maker.xml_stylesheets.new_xml_stylesheet + maker.channel.title = "Automatic Ruby" + maker.channel.description = "Automatic Ruby" + maker.channel.link = "https://github.com/automaticruby/automaticruby" + maker.items.do_sort = true + item = maker.items.new_item + item.title = "Automatic Ruby" + item.link = url + item.content_encoded = data + item.date = Time.now + } + end + end +end diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 477a65f..c9df848 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -2,8 +2,8 @@ # Name:: Automatic::FeedParser # Author:: 774 # Created:: Feb 19, 2012 -# Updated:: Jul 12, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic @@ -12,28 +12,7 @@ module FeedParser require 'uri' require 'nokogiri' - class FeedObject - attr_accessor :title, :link, :description, :author, :comments - def initialize - @link = 'http://dummy' - @title = 'dummy' - @description = '' - @author = '' - @comments = '' - end - end - - def self.generate_feed(feed) - feed_object = FeedObject.new - feed_object.title = feed['title'] unless feed['title'].nil? - feed_object.link = feed['url'] unless feed['url'].nil? - feed_object.description = feed['description'] unless feed['description'].nil? - feed_object.author = feed['author'] unless feed['author'].nil? - feed_object.comments = feed['comments'] unless feed['comments'].nil? - feed_object - end - - def self.get(url) + def self.get_url(url) begin unless url.nil? Automatic::Log.puts("info", "Parsing: #{url}") @@ -48,36 +27,7 @@ def self.get(url) end end - def self.create(feeds = []) - RSS::Maker.make("2.0") {|maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" - maker.channel.link = "https://github.com/automaticruby/automaticruby" - maker.items.do_sort = true - - unless feeds.nil? - feeds.each {|feed| - unless feed.link.nil? - Automatic::Log.puts("info", "Feed: #{feed.link}") - item = maker.items.new_item - item.title = feed.title - item.link = feed.link - begin - item.description = feed.description - item.author = feed.author - item.comments = feed.comments - item.date = feed.pubDate || Time.now - rescue NoMethodError - Automatic::Log.puts("warn", "Undefined field detected in feed.") - end - end - } - end - } - end - - def self.parse(html) + def self.parse_html(html) RSS::Maker.make("2.0") {|maker| xss = maker.xml_stylesheets.new_xml_stylesheet maker.channel.title = "Automatic Ruby" @@ -97,20 +47,5 @@ def self.parse(html) } } end - - def self.content_provide(url, data) - RSS::Maker.make("2.0") {|maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" - maker.channel.link = "https://github.com/automaticruby/automaticruby" - maker.items.do_sort = true - item = maker.items.new_item - item.title = "Automatic Ruby" - item.link = url - item.content_encoded = data - item.date = Time.now - } - end end end diff --git a/plugins/filter/accept.rb b/plugins/filter/accept.rb index ba3fe28..e2e901d 100644 --- a/plugins/filter/accept.rb +++ b/plugins/filter/accept.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Filter::Accept # Author:: soramugi +# 774 # Created:: Jun 4, 2013 -# Updated:: Jun 4, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -22,7 +23,7 @@ def run new_feeds << items if contain(items) == true } end - @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0 + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) if new_feeds.length > 0 } @return_feeds end diff --git a/plugins/filter/github_feed.rb b/plugins/filter/github_feed.rb index a102182..f845c16 100644 --- a/plugins/filter/github_feed.rb +++ b/plugins/filter/github_feed.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Filter::GithubFeed # Author:: Kohei Hasegawa -# Created:: Jun 6, 2013 -# Updated:: Jun 6, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# 774 +# Created:: Jun 6, 2013 +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -17,20 +18,20 @@ def initialize(config, pipeline=[]) def run @return_feeds = [] @pipeline.each {|feeds| - dummyFeeds = [] + new_feeds = [] unless feeds.nil? feeds.items.each {|feed| Automatic::Log.puts("info", "Invoked: FilterGithubFeed") - dummy = Hashie::Mash.new - dummy.title = feed.title.content - dummy.link = feed.id.content - dummy.description = feed.content.content - dummyFeeds << dummy + hashie = Hashie::Mash.new + hashie.title = feed.title.content + hashie.link = feed.id.content + hashie.description = feed.content.content + new_feeds << hashie } end - @return_feeds << Automatic::FeedParser.create(dummyFeeds) + @return_feeds << Automatic::FeedMaker.create_pipeline(feeds) } - @pipeline = @return_feeds + @return_feeds end end end diff --git a/plugins/filter/image_source.rb b/plugins/filter/image_source.rb index da3233f..d29c32f 100644 --- a/plugins/filter/image_source.rb +++ b/plugins/filter/image_source.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Filter::ImageSource # Author:: 774 # Created:: Feb 28, 2012 -# Updated:: Apr 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -19,24 +19,24 @@ def initialize(config, pipeline=[]) def run @return_feeds = [] @pipeline.each {|feeds| - dummyFeeds = Array.new + new_feeds = Array.new unless feeds.nil? feeds.items.each {|feed| arr = rewrite_link(feed) if arr.length > 0 arr.each {|link| Automatic::Log.puts("info", "Parsing: #{link}") - dummy = Hashie::Mash.new - dummy.title = 'FilterImageSource' - dummy.link = link - dummyFeeds << dummy + hashie = Hashie::Mash.new + hashie.title = 'FilterImageSource' + hashie.link = link + new_feeds << hashie } end } end - @return_feeds << Automatic::FeedParser.create(dummyFeeds) + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) } - @pipeline = @return_feeds + @return_feeds end private diff --git a/plugins/filter/one.rb b/plugins/filter/one.rb index f2b3760..e593e5b 100644 --- a/plugins/filter/one.rb +++ b/plugins/filter/one.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Filter::One # Author:: soramugi +# 774 # Created:: May 8, 2013 -# Updated:: May 8, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -27,7 +28,7 @@ def run if item.count == 0 item << feed.items.shift end - @return_feeds << Automatic::FeedParser.create(item) + @return_feeds << Automatic::FeedMaker.create_pipeline(item) end } @return_feeds diff --git a/plugins/filter/rand.rb b/plugins/filter/rand.rb index f0b6156..36c9239 100644 --- a/plugins/filter/rand.rb +++ b/plugins/filter/rand.rb @@ -3,8 +3,8 @@ # Author:: soramugi # 774 # Created:: Mar 6, 2013 -# Updated:: Mar 7, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -19,7 +19,7 @@ def run @return_feeds = [] @pipeline.each {|feed| unless feed.nil? - @return_feeds << Automatic::FeedParser.create(feed.items.shuffle) + @return_feeds << Automatic::FeedMaker.create_pipeline(feed.items.shuffle) end } @return_feeds diff --git a/plugins/store/database.rb b/plugins/store/database.rb index 8b1d4fb..1c9f3d5 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -4,8 +4,8 @@ # 774 # soramugi # Created:: Feb 27, 2012 -# Updated:: Jun 27, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'active_record' @@ -27,7 +27,7 @@ def for_each_new_feed end end } - @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0 + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) if new_feeds.length > 0 end } @return_feeds diff --git a/plugins/subscription/feed.rb b/plugins/subscription/feed.rb index 2d1e8e8..a997655 100644 --- a/plugins/subscription/feed.rb +++ b/plugins/subscription/feed.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::SubscriptionFeed # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -18,7 +18,7 @@ def run retries = 0 retry_max = @config['retry'].to_i || 0 begin - rss = Automatic::FeedParser.get(feed) + rss = Automatic::FeedParser.get_url(feed) @pipeline << rss rescue retries += 1 diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index 7c77455..f343a06 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::GGuide # Author:: soramugi +# 774 # Created:: Jun 28, 2013 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -25,7 +26,7 @@ def run retry_max = @config['retry'].to_i || 0 begin @keywords.each {|keyword| - @pipeline << Automatic::FeedParser.get(feed_url keyword) + @pipeline << Automatic::FeedParser.get_url(feed_url keyword) } rescue retries += 1 diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index 1e7e07b..66c0c80 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Link # Author:: 774 # Created:: Sep 18, 2012 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -34,11 +34,12 @@ def run end private + def create_rss(url) Automatic::Log.puts("info", "Parsing: #{url}") html = open(url).read unless html.nil? - rss = Automatic::FeedParser.parse(html) + rss = Automatic::FeedParser.parse_html(html) sleep ||= @config['interval'].to_i @return_feeds << rss end diff --git a/plugins/subscription/pocket.rb b/plugins/subscription/pocket.rb index 51ff11f..dfd59d2 100644 --- a/plugins/subscription/pocket.rb +++ b/plugins/subscription/pocket.rb @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::Pocket # Author:: soramugi +# 774 # Created:: May 21, 2013 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -24,8 +25,8 @@ def run retries = 0 retry_max = @config['retry'].to_i || 0 begin - dummyfeeds = cleate_dummy_feed(@client.retrieve(@config['optional'])) - @pipeline << Automatic::FeedParser.create(dummyfeeds) + return_feeds = generate_feed(@client.retrieve(@config['optional'])) + @pipeline << Automatic::FeedMaker.create_pipeline(return_feeds) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}") @@ -35,16 +36,16 @@ def run @pipeline end - def cleate_dummy_feed(retrieve) - dummyFeeds = [] + def generate_feed(retrieve) + return_feeds = [] retrieve['list'].each {|key,list| - dummy = Hashie::Mash.new - dummy.title = list['given_title'] - dummy.link = list['given_url'] - dummy.description = list['excerpt'] - dummyFeeds << dummy + hashie = Hashie::Mash.new + hashie.title = list['given_title'] + hashie.link = list['given_url'] + hashie.description = list['excerpt'] + return_feeds << hashie } - dummyFeeds + return_feeds end end end diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index 5d4d981..cd16212 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -3,7 +3,7 @@ # Author:: soramugi # 774 # Created:: May 6, 2013 -# Updated:: Feb 19, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -17,7 +17,7 @@ def initialize(config, pipeline=[]) def run create_feed - @pipeline << Automatic::FeedParser.create(@return_feeds) unless @return_feeds.length == 0 + @pipeline << Automatic::FeedMaker.create_pipeline(@return_feeds) unless @return_feeds.length == 0 @pipeline end diff --git a/plugins/subscription/tumblr.rb b/plugins/subscription/tumblr.rb index 229fb3d..2dfbdae 100644 --- a/plugins/subscription/tumblr.rb +++ b/plugins/subscription/tumblr.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Tumblr # Author:: 774 # Created:: Oct 16, 2012 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -46,7 +46,7 @@ def create_rss(url) html = open(url).read unless html.nil? uri = URI.parse(url) - rss = Automatic::FeedParser.parse(html) + rss = Automatic::FeedParser.parse_html(html) rss.items.each {|item| unless item.link =~ Regexp.new(uri.host) item.link = nil diff --git a/plugins/subscription/twitter_search.rb b/plugins/subscription/twitter_search.rb index 41b85ab..8974034 100644 --- a/plugins/subscription/twitter_search.rb +++ b/plugins/subscription/twitter_search.rb @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::TwitterSearch # Author:: soramugi +# 774 # Created:: May 30, 2013 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -26,19 +27,17 @@ def run retries = 0 retry_max = @config['retry'].to_i || 0 begin - feeds = [] + return_feeds = [] @client.search(@config['search'],@config['opt']).results.each do |status| - - dummy = Hashie::Mash.new - dummy.title = 'Twitter Search' - dummy.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}" - dummy.description = status.text - dummy.author = status.user['screen_name'] - dummy.date = status.created_at - - feeds << dummy + hashie = Hashie::Mash.new + hashie.title = 'Twitter Search' + hashie.link = "https://twitter.com/#{status.user['screen_name']}/status/#{status.id}" + hashie.description = status.text + hashie.author = status.user['screen_name'] + hashie.date = status.created_at + return_feeds << hashie end - @pipeline << Automatic::FeedParser.create(feeds) + @pipeline << Automatic::FeedMaker.create_pipeline(return_feeds) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}") diff --git a/plugins/subscription/weather.rb b/plugins/subscription/weather.rb index 825eb14..844f5ef 100644 --- a/plugins/subscription/weather.rb +++ b/plugins/subscription/weather.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Subscription::Weather # Author:: soramugi +# 774 # Created:: May 12, 2013 -# Updated:: May 12, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -21,10 +22,10 @@ def initialize(config, pipeline=[]) def run weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil? if weather != nil - dummy = Hashie::Mash.new - dummy.title = weather - dummy.link = 'http://weather.dummy.' + @day - @pipeline << Automatic::FeedParser.create([dummy]) + hashie = Hashie::Mash.new + hashie.title = weather + hashie.link = 'http://weather.dummy.' + @day + @pipeline << Automatic::FeedMaker.create_pipeline([hashie]) end @pipeline end diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index d0ac02c..fc27794 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Xml # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -36,13 +36,14 @@ def run end private + def create_rss(url) Automatic::Log.puts("info", "Parsing: #{url}") hash = Hash.from_xml(open(url).read) json = hash.to_json data = ActiveSupport::JSON.decode(json) unless data.nil? - rss = Automatic::FeedParser.content_provide(url, data) + rss = Automatic::FeedMaker.content_provide(url, data) sleep ||= @config['interval'].to_i @return_feeds << rss end diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb index 2b38db1..3033879 100644 --- a/spec/plugins/provide/fluentd_spec.rb +++ b/spec/plugins/provide/fluentd_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Provide::Fluentd # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Jul 12, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -22,7 +22,7 @@ json = hash.to_json data = ActiveSupport::JSON.decode(json) url = "http://id774.net/test/xml/data" - rss = Automatic::FeedParser.content_provide(url, data) + rss = Automatic::FeedMaker.content_provide(url, data) feeds << rss subject { From 27656a795b9a2e0e0a8704dbe0db563da2efd34a Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 14:24:47 +0900 Subject: [PATCH 108/188] #70 Rename Store::TargetLink to Store::File --- doc/PLUGINS | 10 +++++----- doc/PLUGINS.ja | 10 +++++----- doc/README | 4 ++-- doc/README.ja | 4 ++-- plugins/store/{target_link.rb => file.rb} | 6 +++--- .../store/{target_link_spec.rb => file_spec.rb} | 16 ++++++++-------- 6 files changed, 25 insertions(+), 25 deletions(-) rename plugins/store/{target_link.rb => file.rb} (93%) rename spec/plugins/store/{target_link_spec.rb => file_spec.rb} (74%) diff --git a/doc/PLUGINS b/doc/PLUGINS index 27ac3b9..3fbe2bd 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -409,17 +409,17 @@ StoreFullText db: DB_NAME -StoreTargetLink ---------------- +StoreFile +--------- [Path] - /plugins/store/target_link.rb + /plugins/store/file.rb [Abstract] - Store target locally. + Store target to local file system. This emulate "Right click to save". [Syntax] - - Module: StoreTargetLink + - Module: StoreFile config: path: SAVE_TO_PATH retry: RETRY_COUNT diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 49e618b..714e5ea 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -412,16 +412,16 @@ StoreFullText db: SQLite3 DB 名 -StoreTargetLink ---------------- +StoreFile +--------- [パス] - /plugins/store/target_link.rb + /plugins/store/file.rb [概要] - リンク先のコンテンツをローカルに保存する + リンク先のコンテンツをローカルファイルシステムに保存する [レシピ記法] - - module: StoreTargetLink + - module: StoreFile config: path: 保存先のフォルダ retry: エラー時のリトライ回数 (回数, 省略時 0) diff --git a/doc/README b/doc/README index c1be42f..4ee53dc 100644 --- a/doc/README +++ b/doc/README @@ -112,7 +112,7 @@ plugins: - module: FilterTumblrResize - - module: StoreTargetLink + - module: StoreFile config: path: /Users/yourname/Desktop/ interval: 1 @@ -121,7 +121,7 @@ In the case of sample this recipe. 1. Subscribe to RSS feeds of Tumblr by SubScriptionFeed. 2. Save permalink to database by StorePermalink. 3. Specify the URL of the image by FilterImage and FilterTumblrResize. -4. Downloading image file of Tumblr by StoreTargetLink. +4. Downloading image file of Tumblr by StoreFile. Showing another example as follows. diff --git a/doc/README.ja b/doc/README.ja index dce3a99..e6def5e 100644 --- a/doc/README.ja +++ b/doc/README.ja @@ -117,7 +117,7 @@ plugins: - module: FilterTumblrResize - - module: StoreTargetLink + - module: StoreFile config: path: /Users/yourname/Desktop/ interval: 1 @@ -126,7 +126,7 @@ plugins: 1. Subscription Feed で Tumblr のフィードを購読し 2. StorePermalink でパーマリンクをデータベースに保存し 3 FilterImage と FilterTumblrResize で画像の URL を指定して -4. StoreTargetLink で Tumblr の画像をダウンロードする +4. StoreFile で Tumblr の画像をダウンロードする という一連の処理をプラグインの組み合わせで実現している。 diff --git a/plugins/store/target_link.rb b/plugins/store/file.rb similarity index 93% rename from plugins/store/target_link.rb rename to plugins/store/file.rb index a8245d3..a92f01f 100644 --- a/plugins/store/target_link.rb +++ b/plugins/store/file.rb @@ -1,16 +1,16 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::Store::TargetLink +# Name:: Automatic::Plugin::Store::File # Author:: 774 # Created:: Feb 28, 2012 -# Updated:: Jan 15, 2014 +# Updated:: Feb 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'open-uri' module Automatic::Plugin - class StoreTargetLink + class StoreFile def initialize(config, pipeline=[]) @config = config diff --git a/spec/plugins/store/target_link_spec.rb b/spec/plugins/store/file_spec.rb similarity index 74% rename from spec/plugins/store/target_link_spec.rb rename to spec/plugins/store/file_spec.rb index 3ebb0f8..efaa9e7 100644 --- a/spec/plugins/store/target_link_spec.rb +++ b/spec/plugins/store/file_spec.rb @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- -# Name:: Automatic::Plugin::CustomFeed::SVNFLog +# Name:: Automatic::Plugin::Store::File # Author:: kzgs # 774 # Created:: Mar 4, 2012 -# Updated:: May 1, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') -require 'store/target_link' +require 'store/file' require 'tmpdir' require 'pathname' -describe Automatic::Plugin::StoreTargetLink do +describe Automatic::Plugin::StoreFile do it "should store the target link" do Dir.mktmpdir do |dir| - instance = Automatic::Plugin::StoreTargetLink.new( + instance = Automatic::Plugin::StoreFile.new( { "path" => dir }, AutomaticSpec.generate_pipeline { feed { item "http://id774.net/test/store/rss" } @@ -29,7 +29,7 @@ it "should error during file download" do Dir.mktmpdir do |dir| - instance = Automatic::Plugin::StoreTargetLink.new( + instance = Automatic::Plugin::StoreFile.new( { "path" => dir }, AutomaticSpec.generate_pipeline { feed { item "aaa" } @@ -41,7 +41,7 @@ it "should error and retry during file download" do Dir.mktmpdir do |dir| - instance = Automatic::Plugin::StoreTargetLink.new( + instance = Automatic::Plugin::StoreFile.new( { "path" => dir, 'retry' => 1, From 99c7ab933b4aae4c8310c4a72c27b1b0ba32e784 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 15:22:28 +0900 Subject: [PATCH 109/188] #70 Plugin Store::File rewrite link to file URI scheme --- lib/automatic/feed_maker.rb | 4 ++-- lib/automatic/feed_parser.rb | 2 +- plugins/store/file.rb | 11 +++++++++-- plugins/subscription/text.rb | 4 ++-- test/integration/test_image2local.yml | 8 ++++++-- test/integration/test_tumblr2local.yml | 6 ++++++ 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/lib/automatic/feed_maker.rb b/lib/automatic/feed_maker.rb index fddb99d..4e2fba4 100644 --- a/lib/automatic/feed_maker.rb +++ b/lib/automatic/feed_maker.rb @@ -37,7 +37,7 @@ def self.create_pipeline(feeds = []) RSS::Maker.make("2.0") {|maker| xss = maker.xml_stylesheets.new_xml_stylesheet maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" + maker.channel.description = "Automatic::FeedMaker" maker.channel.link = "https://github.com/automaticruby/automaticruby" maker.items.do_sort = true @@ -66,7 +66,7 @@ def self.content_provide(url, data) RSS::Maker.make("2.0") {|maker| xss = maker.xml_stylesheets.new_xml_stylesheet maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" + maker.channel.description = "Automatic::FeedMaker" maker.channel.link = "https://github.com/automaticruby/automaticruby" maker.items.do_sort = true item = maker.items.new_item diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index c9df848..61697f3 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -31,7 +31,7 @@ def self.parse_html(html) RSS::Maker.make("2.0") {|maker| xss = maker.xml_stylesheets.new_xml_stylesheet maker.channel.title = "Automatic Ruby" - maker.channel.description = "Automatic Ruby" + maker.channel.description = "Automatic::FeedParser" maker.channel.link = "https://github.com/automaticruby/automaticruby" maker.items.do_sort = true diff --git a/plugins/store/file.rb b/plugins/store/file.rb index a92f01f..b3b3447 100644 --- a/plugins/store/file.rb +++ b/plugins/store/file.rb @@ -15,6 +15,7 @@ class StoreFile def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + @return_feeds = [] end def run @@ -28,8 +29,9 @@ def run retry_max = @config['retry'].to_i || 0 begin retries += 1 - wget(feed.link) + feed.link = wget(feed.link) sleep ||= @config['interval'].to_i + @return_feeds << Automatic::FeedMaker.generate_feed(feed) rescue Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault during file download.") sleep ||= @config['interval'].to_i @@ -39,17 +41,22 @@ def run } end } + @pipeline << Automatic::FeedMaker.create_pipeline(@return_feeds) if @return_feeds.length > 0 @pipeline end private def wget(url) filename = url.split(/\//).last + filepath = File.join(@config['path'], filename) open(url) {|source| - open(File.join(@config['path'], filename), "w+b") { |o| + open(filepath, "w+b") { |o| o.print source.read } } + uri_scheme = "file://" + filepath + Automatic::Log.puts("info", "Saved: #{uri_scheme}") + uri_scheme end end end diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index cd16212..fc39072 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -17,7 +17,7 @@ def initialize(config, pipeline=[]) def run create_feed - @pipeline << Automatic::FeedMaker.create_pipeline(@return_feeds) unless @return_feeds.length == 0 + @pipeline << Automatic::FeedMaker.create_pipeline(@return_feeds) if @return_feeds.length > 0 @pipeline end @@ -30,7 +30,7 @@ def create_feed @config['titles'].each {|title| feed = {} feed['title'] = title - @return_feeds << Automatic::FeedParser.generate_feed(feed) + @return_feeds << Automatic::FeedMaker.generate_feed(feed) } end diff --git a/test/integration/test_image2local.yml b/test/integration/test_image2local.yml index 7892987..1352e28 100644 --- a/test/integration/test_image2local.yml +++ b/test/integration/test_image2local.yml @@ -19,11 +19,15 @@ plugins: config: db: test_image.db - - module: StoreTargetLink + - module: StoreFile config: path: /tmp retry: 2 interval: 2 - #- module: PublishConsole + - module: StorePermalink + config: + db: test_image2.db + + # - module: PublishConsole diff --git a/test/integration/test_tumblr2local.yml b/test/integration/test_tumblr2local.yml index 23bef2b..a81323f 100644 --- a/test/integration/test_tumblr2local.yml +++ b/test/integration/test_tumblr2local.yml @@ -33,5 +33,11 @@ plugins: config: db: test_tumblr.db + - module: StoreFile + config: + path: /tmp + retry: 2 + interval: 2 + #- module: PublishConsole From 1ca1dffa8f751f2723ef4b9fbc0ae9e191d87706 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 15:30:01 +0900 Subject: [PATCH 110/188] Fix commit leakage --- plugins/filter/ignore.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/filter/ignore.rb b/plugins/filter/ignore.rb index a3a4eba..a198a8d 100644 --- a/plugins/filter/ignore.rb +++ b/plugins/filter/ignore.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Filter::Ignore # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Oct 15, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -22,7 +22,7 @@ def run new_feeds << items if exclude(items) == false } end - @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0 + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) if new_feeds.length > 0 } @return_feeds end From 3b8bf11ed8495c989fe8f07d76680ae06de43362 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 15:58:56 +0900 Subject: [PATCH 111/188] Fix typo --- plugins/filter/sanitize.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/filter/sanitize.rb b/plugins/filter/sanitize.rb index 278d93d..2d80a74 100644 --- a/plugins/filter/sanitize.rb +++ b/plugins/filter/sanitize.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Filter::Sanitize # Author:: 774 # Created:: Jun 20, 2013 -# Updated:: Jun 24, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -26,7 +26,6 @@ def initialize(config, pipeline=[]) def run @return_feeds = [] @pipeline.each {|feeds| - return_feed_items = [] unless feeds.nil? feeds.items.each {|feed| feed = sanitize(feed) From 1f9cd9b7daeba5b26d088cedf77f69a6490a2a66 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 16:47:40 +0900 Subject: [PATCH 112/188] Fix typo --- plugins/subscription/text.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/subscription/text.rb b/plugins/subscription/text.rb index fc39072..f811a5c 100644 --- a/plugins/subscription/text.rb +++ b/plugins/subscription/text.rb @@ -38,13 +38,13 @@ def create_feed @config['urls'].each {|url| feed = {} feed['url'] = url - @return_feeds << Automatic::FeedParser.generate_feed(feed) + @return_feeds << Automatic::FeedMaker.generate_feed(feed) } end unless @config['feeds'].nil? @config['feeds'].each {|feed| - @return_feeds << Automatic::FeedParser.generate_feed(feed) + @return_feeds << Automatic::FeedMaker.generate_feed(feed) } end @@ -55,7 +55,7 @@ def create_feed feed = {} feed['title'], feed['url'], feed['description'], feed['author'], feed['comments'] = line.force_encoding("utf-8").strip.split("\t") - @return_feeds << Automatic::FeedParser.generate_feed(feed) + @return_feeds << Automatic::FeedMaker.generate_feed(feed) end end } From 0aae7f669e519c96d8f19e7ffdd2da2404d54c66 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 17:02:45 +0900 Subject: [PATCH 113/188] Fix typo --- plugins/filter/github_feed.rb | 2 +- spec/plugins/filter/github_feed_spec.rb | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/filter/github_feed.rb b/plugins/filter/github_feed.rb index f845c16..a16ef7d 100644 --- a/plugins/filter/github_feed.rb +++ b/plugins/filter/github_feed.rb @@ -29,7 +29,7 @@ def run new_feeds << hashie } end - @return_feeds << Automatic::FeedMaker.create_pipeline(feeds) + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) } @return_feeds end diff --git a/spec/plugins/filter/github_feed_spec.rb b/spec/plugins/filter/github_feed_spec.rb index 61230ef..2b76476 100644 --- a/spec/plugins/filter/github_feed_spec.rb +++ b/spec/plugins/filter/github_feed_spec.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Filter::GithubFeed # Author:: Kohei Hasegawa +# 774 # Created:: Jun 6, 2013 -# Updated:: Jun 6, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -35,18 +36,18 @@ specify { subject.run - subject.instance_variable_get(:@pipeline)[0].items[0].link + subject.instance_variable_get(:@return_feeds)[0].items[0].link .should == '1' - subject.instance_variable_get(:@pipeline)[0].items[0].title + subject.instance_variable_get(:@return_feeds)[0].items[0].title .should == 'title1' - subject.instance_variable_get(:@pipeline)[0].items[0].description + subject.instance_variable_get(:@return_feeds)[0].items[0].description .should == 'description1' - subject.instance_variable_get(:@pipeline)[0].items[1].link + subject.instance_variable_get(:@return_feeds)[0].items[1].link .should == '0' - subject.instance_variable_get(:@pipeline)[0].items[1].title + subject.instance_variable_get(:@return_feeds)[0].items[1].title .should == 'title0' - subject.instance_variable_get(:@pipeline)[0].items[1].description + subject.instance_variable_get(:@return_feeds)[0].items[1].description .should == 'description0' } end From 993b4eb0879756fa0cb5d18b6828aa9a90f36161 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 17:05:44 +0900 Subject: [PATCH 114/188] Fix test cases --- spec/plugins/filter/image_source_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/plugins/filter/image_source_spec.rb b/spec/plugins/filter/image_source_spec.rb index 4c13dee..0fc3881 100644 --- a/spec/plugins/filter/image_source_spec.rb +++ b/spec/plugins/filter/image_source_spec.rb @@ -3,8 +3,8 @@ # Author:: kzgs # 774 # Created:: Mar 1, 2012 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -25,7 +25,7 @@ its(:run) { should have(1).feeds } specify { subject.run - subject.instance_variable_get(:@pipeline)[0].items[0].link. + subject.instance_variable_get(:@return_feeds)[0].items[0].link. should == "http://27.media.tumblr.com/tumblr_lzrubkfPlt1qb8vzto1_500.png" } end @@ -46,7 +46,7 @@ its(:run) { should have(1).feeds } specify { subject.run - subject.instance_variable_get(:@pipeline)[0].items[0].link. + subject.instance_variable_get(:@return_feeds)[0].items[0].link. should == "http://24.media.tumblr.com/tumblr_m07wttnIdy1qzoj1jo1_400.jpg" } end @@ -65,13 +65,13 @@ describe "#run" do before do - subject.stub!(:rewrite_link).and_return(['http://huge.png']) + subject.stub(:rewrite_link).and_return(['http://huge.png']) end its(:run) { should have(1).feeds } specify { subject.run - subject.instance_variable_get(:@pipeline)[0].items[0].link. + subject.instance_variable_get(:@return_feeds)[0].items[0].link. should == 'http://huge.png' } end @@ -80,7 +80,7 @@ before do open = Hashie::Mash.new open.read = '
' - subject.stub!(:open).and_return(open) + subject.stub(:open).and_return(open) end its(:run) { subject.run[0].items.length.should == 2 } From 37ebc94ebb9ae09a2d70f9613fd0c130283cdc90 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Feb 2014 17:28:36 +0900 Subject: [PATCH 115/188] Fix gemfile, method names --- Gemfile | 4 ++-- bin/automatic | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 3dc12c4..5b94dbc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,9 @@ -# Version:20140124 +# Version:20140221 source "http://rubygems.org" source "http://gems.github.com" -gem 'json', '~> 1.8.1' +gem 'json', '~> 1.7.7' gem 'sqlite3', '~> 1.3.8' gem 'activesupport', '~> 4.0.2' gem 'activerecord', '~> 4.0.2' diff --git a/bin/automatic b/bin/automatic index cb6987a..22b126c 100755 --- a/bin/automatic +++ b/bin/automatic @@ -3,8 +3,8 @@ # Name:: Automatic::Ruby # Author:: 774 # Created:: Feb 18, 2012 -# Updated:: Jul 19, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 21, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. root_dir = File.expand_path("..", File.dirname(__FILE__)) @@ -66,7 +66,7 @@ subparsers = { 'feedparser' => lambda {|argv| require 'automatic/feed_parser' url = argv.shift || abort_with_usage("feedparser", "") - rss_results = Automatic::FeedParser.get(url) + rss_results = Automatic::FeedParser.get_url(url) pp rss_results }, 'inspect' => lambda {|argv| @@ -74,7 +74,7 @@ subparsers = { url = argv.shift || abort_with_usage("inspect", "") feeds = Feedbag.find(url) pp feeds - rss_results = Automatic::FeedParser.get(feeds.pop) + rss_results = Automatic::FeedParser.get_url(feeds.pop) pp rss_results }, 'opmlparser' => lambda {|argv| From 1149d158c0c9cbdf7de2889ac3a4b2575edf086d Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 24 Feb 2014 17:49:01 +0900 Subject: [PATCH 116/188] #73 Create Plugin Publish::AmazonS3 --- Gemfile | 3 +- plugins/publish/amazon_s3.rb | 56 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 plugins/publish/amazon_s3.rb diff --git a/Gemfile b/Gemfile index 5b94dbc..168b9d5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20140221 +# Version:20140224 source "http://rubygems.org" source "http://gems.github.com" @@ -20,6 +20,7 @@ gem 'weather_hacker', '~> 0.1.7' gem 'hipchat', '~> 1.0.1' gem 'fluent-logger', '~> 0.4.7' gem 'dalli', '~> 2.7.0' +gem 'aws-sdk', '~> 1.33.0' group :test do gem 'rspec', '~> 2.14.1' diff --git a/plugins/publish/amazon_s3.rb b/plugins/publish/amazon_s3.rb new file mode 100644 index 0000000..4edeff8 --- /dev/null +++ b/plugins/publish/amazon_s3.rb @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::AmazonS3 +# Author:: 774 +# Created:: Feb 24, 2014 +# Updated:: Feb 24, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class PublishAmazonS3 + require 'uri' + require 'aws-sdk' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + s3 = AWS::S3.new( + :access_key_id => @config['access_key'], + :secret_access_key => @config['secret_key'] + ) + @bucket = s3.buckets[@config['bucket_name']] + end + + def run + @pipeline.each {|feeds| + unless feeds.nil? + feeds.items.each {|feed| + unless feed.link.nil? + begin + uri = URI.parse(feed.link) + if uri.scheme == 'file' + upload_amazons3(uri.path, @config['target_path']) + else + Automatic::Log.puts("warn", "Skip feed due to uri scheme is not file.") + end + rescue + Automatic::Log.puts("error", "Error detected with #{feed.link} in uploading AmazonS3.") + end + end + } + end + } + @pipeline + end + + private + + def upload_amazons3(filename, target_path) + target = File.join(target_path, File.basename(filename)) + object = @bucket.objects[target] + source = Pathname.new(filename) + object.write(source) + Automatic::Log.puts("info", "Uploaded file #{source} to the bucket #{target} on #{@bucket.name}.") + end + end +end From 24e3433494f9e75866b9deca30fca86103a38666 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 10:26:09 +0900 Subject: [PATCH 117/188] #73 RSpec for Plugin Publish::AmazonS3 --- plugins/publish/amazon_s3.rb | 4 ++- spec/plugins/publish/amazon_s3_spec.rb | 40 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 spec/plugins/publish/amazon_s3_spec.rb diff --git a/plugins/publish/amazon_s3.rb b/plugins/publish/amazon_s3.rb index 4edeff8..9631d63 100644 --- a/plugins/publish/amazon_s3.rb +++ b/plugins/publish/amazon_s3.rb @@ -19,6 +19,7 @@ def initialize(config, pipeline=[]) :secret_access_key => @config['secret_key'] ) @bucket = s3.buckets[@config['bucket_name']] + @mode = @config['mode'] end def run @@ -49,8 +50,9 @@ def upload_amazons3(filename, target_path) target = File.join(target_path, File.basename(filename)) object = @bucket.objects[target] source = Pathname.new(filename) - object.write(source) + object.write(source) unless @mode == "test" Automatic::Log.puts("info", "Uploaded file #{source} to the bucket #{target} on #{@bucket.name}.") + return source, target end end end diff --git a/spec/plugins/publish/amazon_s3_spec.rb b/spec/plugins/publish/amazon_s3_spec.rb new file mode 100644 index 0000000..93bca1e --- /dev/null +++ b/spec/plugins/publish/amazon_s3_spec.rb @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Publish::AmazonS3 +# Author:: 774 +# Created:: Feb 25, 2014 +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'publish/amazon_s3' + +describe Automatic::Plugin::PublishAmazonS3 do + context 'when feed' do + describe 'should forward the feeds' do + subject { + Automatic::Plugin::PublishAmazonS3.new( + { + 'access_key' => "aabbcc", + 'secret_key' => "ddeeff", + 'bucket_name' => "test_bucket", + 'target_path' => "test/tmp", + 'mode' => "test" + }, + AutomaticSpec.generate_pipeline{ + feed { + item "http://github.com", "hoge", + "fuga" + } + } + ) + } + + its (:run) { + subject.run.should have(1).feed + } + end + + end +end From 8103be78270d3df3c92e87e8ee7ff2abab66fd5e Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 10:54:10 +0900 Subject: [PATCH 118/188] #65 Fluentd test mode --- plugins/publish/fluentd.rb | 5 +++-- spec/plugins/publish/fluentd_spec.rb | 9 +++++---- test/integration/test_fluentd.yml | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index 65fd863..6ecfe96 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -13,9 +13,10 @@ class PublishFluentd def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + @mode = @config['mode'] @fluentd = Fluent::Logger::FluentLogger.open(nil, host = @config['host'], - port = @config['port']) + port = @config['port']) unless @mode == 'test' end def run @@ -29,7 +30,7 @@ def run :description => feed.description, :content => feed.content_encoded, :created_at => Time.now.strftime("%Y/%m/%d %X") - }) + }) unless @mode == 'test' rescue Automatic::Log.puts("warn", "Skip feed due to fault in forward.") end diff --git a/spec/plugins/publish/fluentd_spec.rb b/spec/plugins/publish/fluentd_spec.rb index 658562d..ac36dcb 100644 --- a/spec/plugins/publish/fluentd_spec.rb +++ b/spec/plugins/publish/fluentd_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Fluentd # Author:: 774 # Created:: Jun 21, 2013 -# Updated:: Jun 21, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -18,7 +18,8 @@ { 'host' => "localhost", 'port' => "10000", - 'tag' => "automatic_spec.publish_fluent" + 'tag' => "automatic_spec.publish_fluent", + 'mode' => "test" }, AutomaticSpec.generate_pipeline{ feed { @@ -30,7 +31,7 @@ } its (:run) { - fluentd = mock("fluentd") + fluentd = double("fluentd") subject.run.should have(1).feed } end diff --git a/test/integration/test_fluentd.yml b/test/integration/test_fluentd.yml index 6c60244..4ab7bb3 100644 --- a/test/integration/test_fluentd.yml +++ b/test/integration/test_fluentd.yml @@ -16,6 +16,7 @@ plugins: host: localhost port: 10000 tag: automatic_test.publish_fluentd + mode: test # - module: PublishConsole From e2a472ab0eca526dc43854d21aac4fbb8154574c Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 11:19:00 +0900 Subject: [PATCH 119/188] #87 Use 'double' instead of 'mock' for rspec-mocks --- spec/lib/automatic/pipeline_spec.rb | 8 ++++---- spec/plugins/notify/ikachan_spec.rb | 4 ++-- spec/plugins/provide/fluentd_spec.rb | 4 ++-- spec/plugins/publish/console_spec.rb | 6 +++--- spec/plugins/publish/google_calendar_spec.rb | 10 +++++----- spec/plugins/publish/hatena_bookmark_spec.rb | 16 ++++++++-------- spec/plugins/publish/hipchat_spec.rb | 12 ++++++------ spec/plugins/publish/instapaper_spec.rb | 10 +++++----- spec/plugins/publish/memcached_spec.rb | 6 +++--- spec/plugins/publish/pocket_spec.rb | 6 +++--- spec/plugins/publish/twitter_spec.rb | 8 ++++---- spec/plugins/subscription/pocket_spec.rb | 6 +++--- spec/plugins/subscription/twitter_search_spec.rb | 6 +++--- 13 files changed, 51 insertions(+), 51 deletions(-) diff --git a/spec/lib/automatic/pipeline_spec.rb b/spec/lib/automatic/pipeline_spec.rb index cd4fd5a..ee2764f 100644 --- a/spec/lib/automatic/pipeline_spec.rb +++ b/spec/lib/automatic/pipeline_spec.rb @@ -3,8 +3,8 @@ # Author:: ainame # 774 # Created:: Mar 10, 2012 -# Updated:: Jun 16, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper')) @@ -38,10 +38,10 @@ describe "#run" do it "run a recipe with FilterIgnore module" do - plugin = mock("plugin") + plugin = double("plugin") plugin.should_receive(:module).and_return("FilterIgnore") plugin.should_receive(:config) - recipe = mock("recipe") + recipe = double("recipe") recipe.should_receive(:each_plugin).and_yield(plugin) Automatic::Pipeline.run(recipe).should == [] end diff --git a/spec/plugins/notify/ikachan_spec.rb b/spec/plugins/notify/ikachan_spec.rb index 3173654..a693030 100644 --- a/spec/plugins/notify/ikachan_spec.rb +++ b/spec/plugins/notify/ikachan_spec.rb @@ -19,7 +19,7 @@ } it "should post title and link in the feed" do - ikachan = mock("ikachan") + ikachan = double("ikachan") ikachan.should_receive(:post).with("http://github.com", "GitHub") ikachan.should_receive(:params) subject.instance_variable_set(:@ikachan, ikachan) @@ -46,7 +46,7 @@ require 'net/http' res = stub("res") res.should_receive(:code).and_return("200") - http = mock("http") + http = double("http") http.should_receive(:post).with("/join", "channel=#room") http.should_receive(:post).with( "/notice", "channel=#room&message=#{link}").and_return(res) diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb index 3033879..9e78a06 100644 --- a/spec/plugins/provide/fluentd_spec.rb +++ b/spec/plugins/provide/fluentd_spec.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Provide::Fluentd # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Feb 21, 2014 +# Updated:: Feb 25, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -37,7 +37,7 @@ } its (:run) { - fluentd = mock("fluentd") + fluentd = double("fluentd") subject.run.should have(1).feed subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.class == Hash subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.should == expect diff --git a/spec/plugins/publish/console_spec.rb b/spec/plugins/publish/console_spec.rb index c0ed5cc..24e4647 100644 --- a/spec/plugins/publish/console_spec.rb +++ b/spec/plugins/publish/console_spec.rb @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Publish::Console # Author:: 774 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -21,7 +21,7 @@ } it "should output pretty inspect of feeds" do - output = mock("output") + output = double("output") output.should_receive(:puts). with("info", @pipeline[0].items[0].pretty_inspect) subject.instance_variable_set(:@output, output) diff --git a/spec/plugins/publish/google_calendar_spec.rb b/spec/plugins/publish/google_calendar_spec.rb index f53b404..f1ae1c5 100644 --- a/spec/plugins/publish/google_calendar_spec.rb +++ b/spec/plugins/publish/google_calendar_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::CustomFeed::SVNFLog # Author:: kzgs # Created:: Feb 26, 2012 -# Updated:: Mar 3, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -24,7 +24,7 @@ } it "should post the link in the feed" do - gc = mock("gc") + gc = double("gc") gc.should_receive(:add).with("今日 GitHub") subject.instance_variable_set(:@gc, gc) subject.run.should have(1).feed @@ -50,7 +50,7 @@ end def all_day_event_mock(title, where, date=nil) - event = mock("event") + event = double("event") { :title => title, :st => date.nil? ? nil : Time.mktime(date.year, date.month, date.day), @@ -69,7 +69,7 @@ def all_day_event_mock(title, where, date=nil) end def cal_mock(event_mock) - cal = mock("cal") + cal = double("cal") cal.should_receive(:create_event).and_return { event_mock } diff --git a/spec/plugins/publish/hatena_bookmark_spec.rb b/spec/plugins/publish/hatena_bookmark_spec.rb index 08a2635..01e985d 100644 --- a/spec/plugins/publish/hatena_bookmark_spec.rb +++ b/spec/plugins/publish/hatena_bookmark_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::HatenaBookmark # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Mar 7, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -21,7 +21,7 @@ } it "should post the link with prefix 'http' in the feed" do - hb = mock("hb") + hb = double("hb") hb.should_receive(:post).with("http://github.com", nil) subject.instance_variable_set(:@hb, hb) subject.run.should have(1).feed @@ -39,7 +39,7 @@ } it "should post the link with prefix '//...' in the feed" do - hb = mock("hb") + hb = double("hb") hb.should_receive(:post).with("http://github.com", nil) subject.instance_variable_set(:@hb, hb) subject.run.should have(1).feed @@ -57,7 +57,7 @@ } it "should post the link with prefix 'https' in the feed" do - hb = mock("hb") + hb = double("hb") hb.should_receive(:post).with("https://github.com", nil) subject.instance_variable_set(:@hb, hb) subject.run.should have(1).feed @@ -75,7 +75,7 @@ } it "should post the link with others in the feed" do - hb = mock("hb") + hb = double("hb") hb.should_receive(:post).with("http://github.com", nil) subject.instance_variable_set(:@hb, hb) subject.run.should have(1).feed @@ -108,7 +108,7 @@ require 'net/http' res = stub("res") res.should_receive(:code).and_return("201") - http = mock("http") + http = double("http") http.should_receive(:post).with("/atom/post", subject.toXml(url, comment), subject.wsse("", "")).and_return(res) http.should_receive(:start).and_yield(http) @@ -123,7 +123,7 @@ require 'net/http' res = stub("res") res.should_receive(:code).twice.and_return("400") - http = mock("http") + http = double("http") http.should_receive(:post).with("/atom/post", subject.toXml(url, comment), subject.wsse("", "")).and_return(res) http.should_receive(:start).and_yield(http) diff --git a/spec/plugins/publish/hipchat_spec.rb b/spec/plugins/publish/hipchat_spec.rb index 2710f11..af35743 100644 --- a/spec/plugins/publish/hipchat_spec.rb +++ b/spec/plugins/publish/hipchat_spec.rb @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Publish::Hipchat # Author:: Kohei Hasegawa -# Created:: Jun 5, 2013 -# Updated:: Jun 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Created:: Jun 5, 2013 +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -33,13 +33,13 @@ context 'when successfully' do it "should passed proper argument to HipChat::Client" do - client = mock('client').as_null_object + client = double('client').as_null_object HipChat::Client.should_receive(:new).with("bogus_api_token").and_return(client) subject.run end it "should post the link in the feed" do - client = mock("client") + client = double("client") client.should_receive(:send).with('bogus_bot', 'description', {"color"=>"yellow", "notify"=>false}) subject.instance_variable_set(:@client, client) subject.run.should have(1).feed @@ -48,7 +48,7 @@ context 'when raise an error during post' do it do - client = mock("client") + client = double("client") client.stub(:send).and_raise subject.instance_variable_set(:@client, client) Automatic::Log.should_receive(:puts).twice diff --git a/spec/plugins/publish/instapaper_spec.rb b/spec/plugins/publish/instapaper_spec.rb index b421d3a..cd6c529 100644 --- a/spec/plugins/publish/instapaper_spec.rb +++ b/spec/plugins/publish/instapaper_spec.rb @@ -2,9 +2,9 @@ # Name:: Automatic::Plugin::Publish::Instapaper # Author:: soramugi # 774 -# Created:: Feb 9, 2013 -# Updated:: Mar 22, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Created:: Feb 9, 2013 +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -25,7 +25,7 @@ })} it "should post the link in the feed" do - instapaper = mock("instapaper") + instapaper = double("instapaper") instapaper.should_receive(:add).with("http://github.com", nil, '') subject.instance_variable_set(:@instapaper, instapaper) subject.run.should have(1).feed @@ -72,7 +72,7 @@ it 'raise error' do lambda{ - res = mock("res") + res = double("res") res.should_receive(:code).twice.and_return("403") subject.should_receive(:request).and_return(res) subject.add(url, title, description) diff --git a/spec/plugins/publish/memcached_spec.rb b/spec/plugins/publish/memcached_spec.rb index 993f641..3e12775 100644 --- a/spec/plugins/publish/memcached_spec.rb +++ b/spec/plugins/publish/memcached_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Memcached # Author:: 774 # Created:: Jun 25, 2013 -# Updated:: Jun 25, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -54,7 +54,7 @@ } its (:run) { - fluentd = mock("memcached") + fluentd = double("memcached") subject.run.should have(2).feed } end diff --git a/spec/plugins/publish/pocket_spec.rb b/spec/plugins/publish/pocket_spec.rb index 3940408..cd57a08 100644 --- a/spec/plugins/publish/pocket_spec.rb +++ b/spec/plugins/publish/pocket_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Pocket # Author:: soramugi # Created:: May 15, 2013 -# Updated:: May 15, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -24,7 +24,7 @@ })} it "should post the link in the feed" do - client = mock("client") + client = double("client") client.should_receive(:add).with(:url => 'http://github.com') subject.instance_variable_set(:@client, client) subject.run.should have(1).feed diff --git a/spec/plugins/publish/twitter_spec.rb b/spec/plugins/publish/twitter_spec.rb index 64afb71..d34c351 100644 --- a/spec/plugins/publish/twitter_spec.rb +++ b/spec/plugins/publish/twitter_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Twitter # Author:: soramugi # Created:: May 5, 2013 -# Updated:: May 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -21,7 +21,7 @@ })} its (:run) { - twitter = mock("twitter") + twitter = double("twitter") twitter.should_receive(:update).with(" http://github.com") subject.instance_variable_set(:@twitter, twitter) subject.run.should have(1).feed @@ -37,7 +37,7 @@ })} its (:run) { - twitter = mock("twitter") + twitter = double("twitter") twitter.should_receive(:update).with("publish-twitter") subject.instance_variable_set(:@twitter, twitter) subject.run.should have(1).feed diff --git a/spec/plugins/subscription/pocket_spec.rb b/spec/plugins/subscription/pocket_spec.rb index 420dd16..39307dd 100644 --- a/spec/plugins/subscription/pocket_spec.rb +++ b/spec/plugins/subscription/pocket_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::Pocket # Author:: soramugi # Created:: May 21, 2013 -# Updated:: May 21, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -44,7 +44,7 @@ def pocket(config = {}, pipeline = []) 'given_title' => 'GitHub', 'excerpt' => 'github' }}} - client = mock("client") + client = double("client") client.should_receive(:retrieve). with(config['optional']). and_return(retrieve) diff --git a/spec/plugins/subscription/twitter_search_spec.rb b/spec/plugins/subscription/twitter_search_spec.rb index 88b7161..88773a5 100644 --- a/spec/plugins/subscription/twitter_search_spec.rb +++ b/spec/plugins/subscription/twitter_search_spec.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Subscription::TwitterSearch # Author:: soramugi # Created:: May 30, 2013 -# Updated:: May 30, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -44,7 +44,7 @@ def twitter_search(config = {}, pipeline = []) status.created_at = Time.now search = Hashie::Mash.new search.results = [status] - client = mock("client") + client = double("client") client.should_receive(:search) .with(config['search'],config['opt']) .and_return(search) From a1d5a99ae2b785653f2b2285b587222b8dbb3b54 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 11:33:05 +0900 Subject: [PATCH 120/188] #65 Fluentd test mode --- plugins/provide/fluentd.rb | 9 +++++---- plugins/publish/fluentd.rb | 4 ++-- spec/plugins/provide/fluentd_spec.rb | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/provide/fluentd.rb b/plugins/provide/fluentd.rb index 6707aa1..fe580a7 100644 --- a/plugins/provide/fluentd.rb +++ b/plugins/provide/fluentd.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Provide::Fluentd # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Jul 12, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -14,9 +14,10 @@ class ProvideFluentd def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + @mode = @config['mode'] @fluentd = Fluent::Logger::FluentLogger.open(nil, host = @config['host'], - port = @config['port']) + port = @config['port']) unless @mode == 'test' end def run @@ -24,7 +25,7 @@ def run unless feeds.nil? feeds.items.each {|feed| begin - @fluentd.post(@config['tag'], feed.content_encoded) + @fluentd.post(@config['tag'], feed.content_encoded) unless @mode == 'test' rescue Automatic::Log.puts("error", "Fluent::Logger.post failed, the content_encoded of item may be not kind of Hash.") end diff --git a/plugins/publish/fluentd.rb b/plugins/publish/fluentd.rb index 6ecfe96..8fea52a 100644 --- a/plugins/publish/fluentd.rb +++ b/plugins/publish/fluentd.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Publish::Fluentd # Author:: 774 # Created:: Jun 21, 2013 -# Updated:: Jun 25, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 25, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin diff --git a/spec/plugins/provide/fluentd_spec.rb b/spec/plugins/provide/fluentd_spec.rb index 9e78a06..1b07a26 100644 --- a/spec/plugins/provide/fluentd_spec.rb +++ b/spec/plugins/provide/fluentd_spec.rb @@ -30,7 +30,8 @@ { 'host' => "localhost", 'port' => "10000", - 'tag' => "automatic_spec.provide_fluentd" + 'tag' => "automatic_spec.provide_fluentd", + 'mode' => "test" }, feeds ) From 36be624df0b2675f58425e6ed7b9260a9b3c9a7f Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 13:17:28 +0900 Subject: [PATCH 121/188] #90 Use 'double' instead of 'stub' for rspec-mocks --- spec/plugins/notify/ikachan_spec.rb | 2 +- spec/plugins/publish/hatena_bookmark_spec.rb | 4 ++-- spec/plugins/publish/instapaper_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/plugins/notify/ikachan_spec.rb b/spec/plugins/notify/ikachan_spec.rb index a693030..bb03f55 100644 --- a/spec/plugins/notify/ikachan_spec.rb +++ b/spec/plugins/notify/ikachan_spec.rb @@ -44,7 +44,7 @@ link = "http://www.google.com" require 'net/http' - res = stub("res") + res = double("res") res.should_receive(:code).and_return("200") http = double("http") http.should_receive(:post).with("/join", "channel=#room") diff --git a/spec/plugins/publish/hatena_bookmark_spec.rb b/spec/plugins/publish/hatena_bookmark_spec.rb index 01e985d..5bf062f 100644 --- a/spec/plugins/publish/hatena_bookmark_spec.rb +++ b/spec/plugins/publish/hatena_bookmark_spec.rb @@ -106,7 +106,7 @@ comment = "Can we trust them ?" require 'net/http' - res = stub("res") + res = double("res") res.should_receive(:code).and_return("201") http = double("http") http.should_receive(:post).with("/atom/post", subject.toXml(url, comment), @@ -121,7 +121,7 @@ comment = "Can we trust them ?" require 'net/http' - res = stub("res") + res = double("res") res.should_receive(:code).twice.and_return("400") http = double("http") http.should_receive(:post).with("/atom/post", subject.toXml(url, comment), diff --git a/spec/plugins/publish/instapaper_spec.rb b/spec/plugins/publish/instapaper_spec.rb index cd6c529..fd2cb20 100644 --- a/spec/plugins/publish/instapaper_spec.rb +++ b/spec/plugins/publish/instapaper_spec.rb @@ -63,7 +63,7 @@ description = "automatic test" specify { - res = stub("res") + res = double("res") res.should_receive(:code).and_return("201") subject.should_receive(:request).and_return(res) subject.add(url, title, description) From 7b31400e527c7e146059180a167d7b6d35c63428 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 14:02:50 +0900 Subject: [PATCH 122/188] #71 Refactoring --- plugins/store/file.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/store/file.rb b/plugins/store/file.rb index b3b3447..29ea22c 100644 --- a/plugins/store/file.rb +++ b/plugins/store/file.rb @@ -8,6 +8,7 @@ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'open-uri' +require 'uri' module Automatic::Plugin class StoreFile @@ -46,17 +47,19 @@ def run end private + def wget(url) - filename = url.split(/\//).last + uri = URI.parse(url) + filename = File.basename(uri.path) filepath = File.join(@config['path'], filename) open(url) {|source| open(filepath, "w+b") { |o| o.print source.read } } - uri_scheme = "file://" + filepath - Automatic::Log.puts("info", "Saved: #{uri_scheme}") - uri_scheme + return_uri = URI.join("file://" + filepath) + Automatic::Log.puts("info", "Saved: #{return_uri.path}") + return_uri.path end end end From cbaec6da1288d29b7ac81cbbb6951b356d93f0c2 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 25 Feb 2014 17:48:15 +0900 Subject: [PATCH 123/188] #93 Store::File enable get file from Amazon S3 --- plugins/store/file.rb | 46 +++++++++++++++++++++++++++------ spec/plugins/store/file_spec.rb | 6 ++--- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/plugins/store/file.rb b/plugins/store/file.rb index 29ea22c..a8d58be 100644 --- a/plugins/store/file.rb +++ b/plugins/store/file.rb @@ -3,12 +3,13 @@ # Name:: Automatic::Plugin::Store::File # Author:: 774 # Created:: Feb 28, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Feb 25, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'open-uri' require 'uri' +require 'aws-sdk' module Automatic::Plugin class StoreFile @@ -16,6 +17,13 @@ class StoreFile def initialize(config, pipeline=[]) @config = config @pipeline = pipeline + unless @config['bucket_name'].nil? + s3 = AWS::S3.new( + :access_key_id => @config['access_key'], + :secret_access_key => @config['secret_key'] + ) + @bucket = s3.buckets[@config['bucket_name']] + end @return_feeds = [] end @@ -30,9 +38,9 @@ def run retry_max = @config['retry'].to_i || 0 begin retries += 1 - feed.link = wget(feed.link) + feed.link = get_file(feed.link) sleep ||= @config['interval'].to_i - @return_feeds << Automatic::FeedMaker.generate_feed(feed) + @return_feeds << feed rescue Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault during file download.") sleep ||= @config['interval'].to_i @@ -42,24 +50,46 @@ def run } end } + @pipeline = [] @pipeline << Automatic::FeedMaker.create_pipeline(@return_feeds) if @return_feeds.length > 0 @pipeline end private - def wget(url) + def get_file(url) uri = URI.parse(url) + case uri.scheme + when "s3n" + return_path = get_aws(uri) + else + return_path = wget(uri, url) + end + Automatic::Log.puts("info", "Saved: #{return_path}") + "file://" + return_path + end + + def wget(uri, url) filename = File.basename(uri.path) filepath = File.join(@config['path'], filename) open(url) {|source| open(filepath, "w+b") { |o| - o.print source.read + o.print(source.read) } } - return_uri = URI.join("file://" + filepath) - Automatic::Log.puts("info", "Saved: #{return_uri.path}") - return_uri.path + filepath + end + + def get_aws(uri) + filename = File.basename(uri.path) + filepath = File.join(@config['path'], filename) + object = @bucket.objects[uri.path] + File.open(filepath, 'wb') do |file| + object.read do |chunk| + file.write(chunk) + end + end + filepath end end end diff --git a/spec/plugins/store/file_spec.rb b/spec/plugins/store/file_spec.rb index efaa9e7..87de791 100644 --- a/spec/plugins/store/file_spec.rb +++ b/spec/plugins/store/file_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 4, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Feb 25, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -35,7 +35,7 @@ feed { item "aaa" } } ) - instance.run.should have(1).feed + instance.run.should have(0).feed end end @@ -51,7 +51,7 @@ feed { item "aaa" } } ) - instance.run.should have(1).feed + instance.run.should have(0).feed end end From 7ce143f2d3c49ca18f48ad48fff95e5c99b26d8f Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 10:18:44 +0900 Subject: [PATCH 124/188] #74 Update docs for plugins improvements --- doc/PLUGINS | 29 ++++++++++++++++++++++++++++- doc/PLUGINS.ja | 29 +++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index 3fbe2bd..fee70b6 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -140,6 +140,7 @@ SubscriptionText [Abstract] Create new feeds from urls, titles, feeds on text. + Reading data from TSV (sep = '\t') formatted files. [Syntax] - module: SubscriptionText @@ -155,6 +156,9 @@ SubscriptionText - title: 'title' url: 'url' + files: + - 'somefile1.tsv' + - 'somefile2.tsv' SubscriptionPocket @@ -416,7 +420,9 @@ StoreFile [Abstract] Store target to local file system. - This emulate "Right click to save". + This emulate "Right click to save" + If scheme begin with "s3n://", get file from Amazon S3. + Re-write URI scheme to file URI scheme and return feeds. [Syntax] - Module: StoreFile @@ -438,6 +444,27 @@ PublishConsole - module: PublishConsole +PublishAmazonS3 +--------------- +[Path] + /plugins/publish/amazon_s3.rb + +[Abstract] + Upload file to Amazon S3. + +[Description] + Read file URI scheme and upload it to aws. + Postulate feed link must be file URI scheme. + +[Syntax] + - module: PublishAmazonS3 + config: + access_key: ACCESS_KEY_ID + secret_key: SECRET_ACCESS_KEY + bucket_name: AMAZONS3_BUCKET_NAME + target_path: PATH_ON_BUCKET + + PublishFluentd -------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 714e5ea..3c0d92c 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -141,6 +141,7 @@ SubscriptionText [概要] テキストベースの urls, titles, feeds から新規のフィードを作成する + タブ区切りの TSV 形式のファイルからフィードの情報を読み込む [レシピ記法] - module: SubscriptionText @@ -154,8 +155,9 @@ SubscriptionText - title: TITLE url: URL ... - interval: スクレイピングの間隔 (秒数, 省略可) - retry: エラー時のリトライ回数 (回数, 省略時 0) + files: + - 'somefile1.tsv' + - 'somefile2.tsv' ... SubscriptionPocket @@ -419,6 +421,8 @@ StoreFile [概要] リンク先のコンテンツをローカルファイルシステムに保存する + s3n:// で始まる場合は Amazon S3 からファイルを取得する + リンクを保存したファイルのパス (file スキーム) に書き換えてフィードを返す [レシピ記法] - module: StoreFile @@ -440,6 +444,27 @@ PublishConsole - module: PublishConsole +PublishAmazonS3 +--------------- +[パス] + /plugins/publish/amazon_s3.rb + +[概要] + Amazon S3 にファイルをアップロードする + +[説明] + フィードのリンクにあるファイルを Amazon S3 にアップする + リンクが file URI スキームであることが前提である + +[レシピ記法] + - module: PublishAmazonS3 + config: + access_key: アクセスキー + secret_key: シークレットアクセスキー + bucket_name: S3 のバケット名 + target_path: バケット上でのファイルのパス + + PublishFluentd -------------- [パス] From a52cd7f066b2f8add4a5f388018ebd5c3c7c1dc3 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 10:22:06 +0900 Subject: [PATCH 125/188] #74 Update docs for plugins improvements --- doc/PLUGINS | 3 +++ doc/PLUGINS.ja | 3 +++ 2 files changed, 6 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index fee70b6..01c9eaf 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -430,6 +430,9 @@ StoreFile path: SAVE_TO_PATH retry: RETRY_COUNT interval: INTERVAL_FOR_DOWNLOAD (in seconds.) + access_key: ACCESS_KEY_ID (Only using S3) + secret_key: SECRET_ACCESS_KEY (Only using S3) + bucket_name: AMAZONS3_BUCKET_NAME (Only using S3) PublishConsole diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 3c0d92c..dfc14fe 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -430,6 +430,9 @@ StoreFile path: 保存先のフォルダ retry: エラー時のリトライ回数 (回数, 省略時 0) interval: 保存する間隔 (秒) + access_key: アクセスキー (S3 使用時のみ) + secret_key: シークレットアクセスキー (S3 使用時のみ) + bucket_name: S3 のバケット名 (S3 使用時のみ) PublishConsole From d242a45f20cffcb879bc44bd6d1de181f6380654 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 11:11:01 +0900 Subject: [PATCH 126/188] #79 Improvement Log messages --- lib/automatic/feed_maker.rb | 4 ++-- lib/automatic/feed_parser.rb | 4 ++-- lib/automatic/recipe.rb | 2 +- plugins/publish/amazon_s3.rb | 2 +- plugins/publish/google_calendar.rb | 4 ++-- plugins/publish/hipchat.rb | 2 +- plugins/publish/twitter.rb | 2 +- plugins/store/database.rb | 2 +- plugins/store/file.rb | 4 ++-- plugins/store/full_text.rb | 2 +- plugins/store/permalink.rb | 2 +- plugins/subscription/link.rb | 2 +- plugins/subscription/tumblr.rb | 2 +- plugins/subscription/twitter.rb | 2 +- plugins/subscription/xml.rb | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/automatic/feed_maker.rb b/lib/automatic/feed_maker.rb index 4e2fba4..eacacad 100644 --- a/lib/automatic/feed_maker.rb +++ b/lib/automatic/feed_maker.rb @@ -2,7 +2,7 @@ # Name:: Automatic::FeedMaker # Author:: 774 # Created:: Feb 21, 2014 -# Updated:: Feb 21, 2014 +# Updated:: Feb 26, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -44,7 +44,7 @@ def self.create_pipeline(feeds = []) unless feeds.nil? feeds.each {|feed| unless feed.link.nil? - Automatic::Log.puts("info", "Feed: #{feed.link}") + Automatic::Log.puts("info", "Create Pipeline: #{feed.link}") item = maker.items.new_item item.title = feed.title item.link = feed.link diff --git a/lib/automatic/feed_parser.rb b/lib/automatic/feed_parser.rb index 61697f3..15c749b 100644 --- a/lib/automatic/feed_parser.rb +++ b/lib/automatic/feed_parser.rb @@ -2,7 +2,7 @@ # Name:: Automatic::FeedParser # Author:: 774 # Created:: Feb 19, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Feb 26, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -15,7 +15,7 @@ module FeedParser def self.get_url(url) begin unless url.nil? - Automatic::Log.puts("info", "Parsing: #{url}") + Automatic::Log.puts("info", "Parsing Feed: #{url}") feed = URI.parse(url).normalize open(feed) {|http| response = http.read diff --git a/lib/automatic/recipe.rb b/lib/automatic/recipe.rb index bd55833..bfc4242 100644 --- a/lib/automatic/recipe.rb +++ b/lib/automatic/recipe.rb @@ -24,7 +24,7 @@ def load_recipe(path) @procedure = Hashie::Mash.new(YAML.load(File.read(path))) log_level = @procedure.global && @procedure.global.log && @procedure.global.log.level Automatic::Log.level(log_level) - Automatic::Log.puts("info", "Loading: #{path}") + Automatic::Log.puts("info", "Loading Recipe: #{path}") @procedure end diff --git a/plugins/publish/amazon_s3.rb b/plugins/publish/amazon_s3.rb index 9631d63..b36a50e 100644 --- a/plugins/publish/amazon_s3.rb +++ b/plugins/publish/amazon_s3.rb @@ -51,7 +51,7 @@ def upload_amazons3(filename, target_path) object = @bucket.objects[target] source = Pathname.new(filename) object.write(source) unless @mode == "test" - Automatic::Log.puts("info", "Uploaded file #{source} to the bucket #{target} on #{@bucket.name}.") + Automatic::Log.puts("info", "Uploaded: file #{source} to the bucket #{target} on #{@bucket.name}.") return source, target end end diff --git a/plugins/publish/google_calendar.rb b/plugins/publish/google_calendar.rb index d1d03b2..83c6118 100644 --- a/plugins/publish/google_calendar.rb +++ b/plugins/publish/google_calendar.rb @@ -37,8 +37,8 @@ def add(arg) end end - Automatic::Log.puts("info", "日付 : #{date}") - Automatic::Log.puts("info", "タイトル : #{text}") + Automatic::Log.puts("info", "Date : #{date}") + Automatic::Log.puts("info", "Title : #{text}") # Register to calendar require 'rubygems' diff --git a/plugins/publish/hipchat.rb b/plugins/publish/hipchat.rb index 15c6db5..419e038 100644 --- a/plugins/publish/hipchat.rb +++ b/plugins/publish/hipchat.rb @@ -29,7 +29,7 @@ def run retry_max = @config['retry'].to_i || 0 begin @client.send(@config['username'], feed.description, @options) - Automatic::Log.puts("info", "post: #{feed.description.gsub(/[\r\n]/,'')[0..50]}...") rescue nil + Automatic::Log.puts("info", "Hipchat post: #{feed.description.gsub(/[\r\n]/,'')[0..50]}...") rescue nil rescue => e retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, #{e.message}") diff --git a/plugins/publish/twitter.rb b/plugins/publish/twitter.rb index b01d068..286b2fc 100644 --- a/plugins/publish/twitter.rb +++ b/plugins/publish/twitter.rb @@ -34,7 +34,7 @@ def run @pipeline.each {|feeds| unless feeds.nil? feeds.items.each {|feed| - Automatic::Log.puts("info", "tweet: #{feed.link}") + Automatic::Log.puts("info", "Publish Tweet: #{feed.link}") retries = 0 retry_max = @config['retry'].to_i || 0 begin diff --git a/plugins/store/database.rb b/plugins/store/database.rb index 1c9f3d5..3ace97f 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -54,7 +54,7 @@ def db_dir def prepare_database db = File.join(db_dir, @config['db']) - Automatic::Log.puts("info", "Database: #{db}") + Automatic::Log.puts("info", "Using Database: #{db}") ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :database => db) diff --git a/plugins/store/file.rb b/plugins/store/file.rb index a8d58be..e72509b 100644 --- a/plugins/store/file.rb +++ b/plugins/store/file.rb @@ -32,7 +32,7 @@ def run unless feeds.nil? feeds.items.each {|feed| unless feed.link.nil? - Automatic::Log.puts("info", "Downloading: #{feed.link}") + Automatic::Log.puts("info", "Downloading File: #{feed.link}") FileUtils.mkdir_p(@config['path']) unless FileTest.exist?(@config['path']) retries = 0 retry_max = @config['retry'].to_i || 0 @@ -65,7 +65,7 @@ def get_file(url) else return_path = wget(uri, url) end - Automatic::Log.puts("info", "Saved: #{return_path}") + Automatic::Log.puts("info", "Saved File: #{return_path}") "file://" + return_path end diff --git a/plugins/store/full_text.rb b/plugins/store/full_text.rb index 1b63075..a0632d1 100644 --- a/plugins/store/full_text.rb +++ b/plugins/store/full_text.rb @@ -40,7 +40,7 @@ def model_class def run for_each_new_feed {|feed| - Automatic::Log.puts("info", "Saving: #{feed.link}") + Automatic::Log.puts("info", "Saving FullText: #{feed.link}") begin Blog.create( :title => feed.title, diff --git a/plugins/store/permalink.rb b/plugins/store/permalink.rb index 76d5e79..f777d78 100644 --- a/plugins/store/permalink.rb +++ b/plugins/store/permalink.rb @@ -42,7 +42,7 @@ def run Permalink.create( :url => feed.link, :created_at => Time.now.strftime("%Y/%m/%d %X")) - Automatic::Log.puts("info", "Saving: #{feed.link}") + Automatic::Log.puts("info", "Saving Permalink: #{feed.link}") end } end diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index 66c0c80..8c87a24 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -36,7 +36,7 @@ def run private def create_rss(url) - Automatic::Log.puts("info", "Parsing: #{url}") + Automatic::Log.puts("info", "Parsing Link: #{url}") html = open(url).read unless html.nil? rss = Automatic::FeedParser.parse_html(html) diff --git a/plugins/subscription/tumblr.rb b/plugins/subscription/tumblr.rb index 2dfbdae..18a30d5 100644 --- a/plugins/subscription/tumblr.rb +++ b/plugins/subscription/tumblr.rb @@ -42,7 +42,7 @@ def run private def create_rss(url) - Automatic::Log.puts("info", "Parsing: #{url}") + Automatic::Log.puts("info", "Parsing Tumblr: #{url}") html = open(url).read unless html.nil? uri = URI.parse(url) diff --git a/plugins/subscription/twitter.rb b/plugins/subscription/twitter.rb index ac732a4..abc4cdf 100644 --- a/plugins/subscription/twitter.rb +++ b/plugins/subscription/twitter.rb @@ -37,7 +37,7 @@ def run private def create_rss(url) - Automatic::Log.puts("info", "Parsing: #{url}") + Automatic::Log.puts("info", "Parsing Twitter: #{url}") html = open(url).read unless html.nil? rss = RSS::Maker.make("2.0") {|maker| diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index fc27794..daaded9 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -38,7 +38,7 @@ def run private def create_rss(url) - Automatic::Log.puts("info", "Parsing: #{url}") + Automatic::Log.puts("info", "Parsing XML: #{url}") hash = Hash.from_xml(open(url).read) json = hash.to_json data = ActiveSupport::JSON.decode(json) From cc1f042972b6563199cb9b65d2c8845e254cad00 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 11:50:33 +0900 Subject: [PATCH 127/188] #97 ChangeLog for 14.2.0 --- README.md | 2 +- VERSION | 2 +- doc/ChangeLog | 27 +++++++++++++++++++++++++++ doc/README | 2 +- doc/README.ja | 2 +- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 6 +++--- 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dbfe39e..1cfacd5 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ For more info, refer to the document (doc/README). Environment ----------- -Ruby 1.9 - 2.1. See Gemfile. +After Ruby 1.9. See Gemfile. Development diff --git a/VERSION b/VERSION index 7b3b6e0..07ea9fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.1.0 +14.2.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index 92b8af7..f293f35 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,30 @@ +=== 14.2.0 / 2014-02-26 + +* Added new plugins. + + * Publish::AmazonS3 + +* Improvement File Saving Plugin + + * Store::TargetLink rename to Store::File. + * Store::File rewrite link to file URI scheme. + * Enable file URI scheme in RSS 2.0 Feed. + * Store::File enable get file from Amazon S3. + +* Improvement Subscription::Text + + * Read text from TSV formatted files. + * Add fields description, author, comments to RSS 2.0 Feed. + +* Into details Log messages. + +* Use 'double' instead of 'mock', 'stub' for rspec-mocks. + +* Improvement CI with network connection. + +* Refactoring to divide Feed::Parser to Feed::Maker. + + === 14.1.0 / 2014-01-24 * Fix dependency conflict. diff --git a/doc/README b/doc/README index 4ee53dc..f19fa39 100644 --- a/doc/README +++ b/doc/README @@ -496,7 +496,7 @@ TODO Environment =========== - Ruby 1.9 - 2.1. + After Ruby 1.9. Depend on the packages that described in Gemfile. diff --git a/doc/README.ja b/doc/README.ja index e6def5e..3e4875f 100644 --- a/doc/README.ja +++ b/doc/README.ja @@ -504,7 +504,7 @@ TODO 動作環境 ======== -Ruby 1.9 - 2.1 +Ruby 1.9 以降 Gemfile に記述された gem パッケージに依存 diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 4e72ba1..f804928 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.1.0-devel" + VERSION = "14.2.0" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 4681618..3be49d9 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,8 +3,8 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jan 25, 2014 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Feb 26, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.1.0-devel" } + it { expect(subject).to eq "14.2.0" } end describe "#(root)_dir" do From d0614c9e7fd8896829abf8aefc90dac52bc6e4b6 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 14:03:06 +0900 Subject: [PATCH 128/188] #79 Fix log message --- plugins/filter/image_source.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/filter/image_source.rb b/plugins/filter/image_source.rb index d29c32f..fe22c3a 100644 --- a/plugins/filter/image_source.rb +++ b/plugins/filter/image_source.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::ImageSource # Author:: 774 # Created:: Feb 28, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Feb 26, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -25,7 +25,7 @@ def run arr = rewrite_link(feed) if arr.length > 0 arr.each {|link| - Automatic::Log.puts("info", "Parsing: #{link}") + Automatic::Log.puts("info", "Extract Image: #{link}") hashie = Hashie::Mash.new hashie.title = 'FilterImageSource' hashie.link = link From 6061906e1a49b3555b458ee339b6ea32742cb6be Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 14:33:05 +0900 Subject: [PATCH 129/188] Regenerate gemspec for version 14.2.0 --- automatic.gemspec | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 9b15815..15520e3 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,17 +2,17 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.1.0 ruby lib +# stub: automatic 14.2.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.1.0" + s.version = "14.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-01-24" - s.description = "Ruby General Automation Framework" + s.date = "2014-02-26" + s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] s.extra_rdoc_files = [ @@ -37,6 +37,7 @@ Gem::Specification.new do |s| "doc/README.ja", "lib/automatic.rb", "lib/automatic/environment.rb", + "lib/automatic/feed_maker.rb", "lib/automatic/feed_parser.rb", "lib/automatic/log.rb", "lib/automatic/opml.rb", @@ -58,6 +59,7 @@ Gem::Specification.new do |s| "plugins/filter/tumblr_resize.rb", "plugins/notify/ikachan.rb", "plugins/provide/fluentd.rb", + "plugins/publish/amazon_s3.rb", "plugins/publish/console.rb", "plugins/publish/console_link.rb", "plugins/publish/eject.rb", @@ -70,9 +72,9 @@ Gem::Specification.new do |s| "plugins/publish/pocket.rb", "plugins/publish/twitter.rb", "plugins/store/database.rb", + "plugins/store/file.rb", "plugins/store/full_text.rb", "plugins/store/permalink.rb", - "plugins/store/target_link.rb", "plugins/subscription/chan_toru.rb", "plugins/subscription/feed.rb", "plugins/subscription/g_guide.rb", @@ -85,6 +87,8 @@ Gem::Specification.new do |s| "plugins/subscription/weather.rb", "plugins/subscription/xml.rb", "script/build", + "spec/fixtures/sampleFeeds.tsv", + "spec/fixtures/sampleFeeds2.tsv", "spec/fixtures/sampleRecipe.yml", "spec/lib/automatic/log_spec.rb", "spec/lib/automatic/pipeline_spec.rb", @@ -105,6 +109,7 @@ Gem::Specification.new do |s| "spec/plugins/filter/tumblr_resize_spec.rb", "spec/plugins/notify/ikachan_spec.rb", "spec/plugins/provide/fluentd_spec.rb", + "spec/plugins/publish/amazon_s3_spec.rb", "spec/plugins/publish/console_spec.rb", "spec/plugins/publish/eject_spec.rb", "spec/plugins/publish/fluentd_spec.rb", @@ -115,9 +120,9 @@ Gem::Specification.new do |s| "spec/plugins/publish/memcached_spec.rb", "spec/plugins/publish/pocket_spec.rb", "spec/plugins/publish/twitter_spec.rb", + "spec/plugins/store/file_spec.rb", "spec/plugins/store/full_text_spec.rb", "spec/plugins/store/permalink_spec.rb", - "spec/plugins/store/target_link_spec.rb", "spec/plugins/subscription/chan_toru_spec.rb", "spec/plugins/subscription/feed_spec.rb", "spec/plugins/subscription/g_guide_spec.rb", @@ -167,7 +172,7 @@ Gem::Specification.new do |s| s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 1.8.1"]) + s.add_runtime_dependency(%q, ["~> 1.7.7"]) s.add_runtime_dependency(%q, ["~> 1.3.8"]) s.add_runtime_dependency(%q, ["~> 4.0.2"]) s.add_runtime_dependency(%q, ["~> 4.0.2"]) @@ -184,12 +189,13 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, ["~> 1.0.1"]) s.add_runtime_dependency(%q, ["~> 0.4.7"]) s.add_runtime_dependency(%q, ["~> 2.7.0"]) + s.add_runtime_dependency(%q, ["~> 1.33.0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, ["~> 1.3.8"]) s.add_dependency(%q, ["~> 4.0.2"]) s.add_dependency(%q, ["~> 4.0.2"]) @@ -206,13 +212,14 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 1.0.1"]) s.add_dependency(%q, ["~> 0.4.7"]) s.add_dependency(%q, ["~> 2.7.0"]) + s.add_dependency(%q, ["~> 1.33.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, ["~> 1.3.8"]) s.add_dependency(%q, ["~> 4.0.2"]) s.add_dependency(%q, ["~> 4.0.2"]) @@ -229,6 +236,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 1.0.1"]) s.add_dependency(%q, ["~> 0.4.7"]) s.add_dependency(%q, ["~> 2.7.0"]) + s.add_dependency(%q, ["~> 1.33.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From f7b66e94ebbb4c01fe4b21f97115cc36d98c937a Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 26 Feb 2014 18:16:43 +0900 Subject: [PATCH 130/188] Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index f804928..cbab11b 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.2.0" + VERSION = "14.2.0-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 3be49d9..e011b8a 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.2.0" } + it { expect(subject).to eq "14.2.0-devel" } end describe "#(root)_dir" do From 47cf6eac1607a32c0d176affb6e6f34c1b40afee Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 18 Mar 2014 00:48:03 +0900 Subject: [PATCH 131/188] #103 Donwgrade nokogiri to v1.5.11 for OS X --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 168b9d5..6ae5c74 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20140224 +# Version:20140318 source "http://rubygems.org" source "http://gems.github.com" @@ -11,7 +11,7 @@ gem 'hashie', '~> 2.0.5' gem 'gcalapi', '~> 0.1.2' gem 'xml-simple', '~> 1.1.3' gem 'feedbag', '~> 0.9.2' -gem 'nokogiri', '~> 1.6.1' +gem 'nokogiri', '~> 1.5.11' gem 'sanitize', '~> 2.1.0' gem 'faraday', '~> 0.8.9' gem 'twitter', '~> 4.8.1' From 4adcced927f001661b667d8cf84367d49217f598 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 21 Mar 2014 14:36:41 +0900 Subject: [PATCH 132/188] 369 Version bump to v14.3.0 --- VERSION | 2 +- doc/ChangeLog | 4 ++++ lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 07ea9fa..32f02f1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.2.0 +14.3.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index f293f35..9fe31d6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +=== 14.3.0 / 2014-03-22 + +* Downgrade nokogiri version for OS X. + === 14.2.0 / 2014-02-26 * Added new plugins. diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index cbab11b..ebd401b 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.2.0-devel" + VERSION = "14.3.0" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index e011b8a..300977b 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Feb 26, 2014 +# Updated:: Mar 21, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.2.0-devel" } + it { expect(subject).to eq "14.3.0" } end describe "#(root)_dir" do From 927be93503c7d7077714e9e8868d23f17c8e6dcd Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 22 Mar 2014 13:03:38 +0900 Subject: [PATCH 133/188] 370 Fix doc --- doc/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9fe31d6..e90b5e1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,8 @@ -=== 14.3.0 / 2014-03-22 +=== 14.3.0 / 2014-03-23 * Downgrade nokogiri version for OS X. + === 14.2.0 / 2014-02-26 * Added new plugins. From b8bef565ff13dc3fd948a4252e03e8d9da727656 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 23 Mar 2014 17:34:47 +0900 Subject: [PATCH 134/188] Regenerate gemspec for version 14.3.0 --- automatic.gemspec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 15520e3..5e9b7c2 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.2.0 ruby lib +# stub: automatic 14.3.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.2.0" + s.version = "14.3.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-02-26" + s.date = "2014-03-23" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -165,7 +165,7 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] - s.rubygems_version = "2.2.0" + s.rubygems_version = "2.2.2" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then @@ -180,7 +180,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, ["~> 0.1.2"]) s.add_runtime_dependency(%q, ["~> 1.1.3"]) s.add_runtime_dependency(%q, ["~> 0.9.2"]) - s.add_runtime_dependency(%q, ["~> 1.6.1"]) + s.add_runtime_dependency(%q, ["~> 1.5.11"]) s.add_runtime_dependency(%q, ["~> 2.1.0"]) s.add_runtime_dependency(%q, ["~> 0.8.9"]) s.add_runtime_dependency(%q, ["~> 4.8.1"]) @@ -203,7 +203,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 0.1.2"]) s.add_dependency(%q, ["~> 1.1.3"]) s.add_dependency(%q, ["~> 0.9.2"]) - s.add_dependency(%q, ["~> 1.6.1"]) + s.add_dependency(%q, ["~> 1.5.11"]) s.add_dependency(%q, ["~> 2.1.0"]) s.add_dependency(%q, ["~> 0.8.9"]) s.add_dependency(%q, ["~> 4.8.1"]) @@ -227,7 +227,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 0.1.2"]) s.add_dependency(%q, ["~> 1.1.3"]) s.add_dependency(%q, ["~> 0.9.2"]) - s.add_dependency(%q, ["~> 1.6.1"]) + s.add_dependency(%q, ["~> 1.5.11"]) s.add_dependency(%q, ["~> 2.1.0"]) s.add_dependency(%q, ["~> 0.8.9"]) s.add_dependency(%q, ["~> 4.8.1"]) From 27a444a4fe3d7926a574237e923f8421094bb4a0 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 29 Mar 2014 12:25:01 +0900 Subject: [PATCH 135/188] 371 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index ebd401b..fc71d39 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.3.0" + VERSION = "14.3.0-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 300977b..866e5a4 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Mar 21, 2014 +# Updated:: Mar 29, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.3.0" } + it { expect(subject).to eq "14.3.0-devel" } end describe "#(root)_dir" do From 8428040d48f40284af7a2506c81b11f154b3c053 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 9 May 2014 13:59:44 +0900 Subject: [PATCH 136/188] 372 Update to activesupport/record 4.1.x --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 6ae5c74..50d75da 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ -# Version:20140318 +# Version:20140509 source "http://rubygems.org" source "http://gems.github.com" gem 'json', '~> 1.7.7' gem 'sqlite3', '~> 1.3.8' -gem 'activesupport', '~> 4.0.2' -gem 'activerecord', '~> 4.0.2' +gem 'activesupport', '~> 4.1.1' +gem 'activerecord', '~> 4.1.1' gem 'hashie', '~> 2.0.5' gem 'gcalapi', '~> 0.1.2' gem 'xml-simple', '~> 1.1.3' From eec1ccaf57901792722466b923dde74ad9295c6d Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 12 May 2014 14:22:39 +0900 Subject: [PATCH 137/188] 372 Update to activesupport/record 4.1.x --- plugins/notify/ikachan.rb | 3 ++- plugins/subscription/xml.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/notify/ikachan.rb b/plugins/notify/ikachan.rb index 796096f..ad34be7 100644 --- a/plugins/notify/ikachan.rb +++ b/plugins/notify/ikachan.rb @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -require 'active_support/core_ext' +require 'active_support' +require 'active_support/deprecation' module Automatic::Plugin class Ikachan diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index daaded9..641a7f5 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -10,7 +10,7 @@ module Automatic::Plugin class SubscriptionXml require 'open-uri' require 'active_support' - require 'active_support/core_ext' + require 'active_support/deprecation' require 'rss' def initialize(config, pipeline=[]) From 698cab36c60186de227fc180055e6c4ff3438354 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 13 May 2014 11:23:35 +0900 Subject: [PATCH 138/188] 372 Update to activesupport/record 4.1.x --- lib/automatic/pipeline.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/automatic/pipeline.rb b/lib/automatic/pipeline.rb index 8af779c..4f37dcc 100644 --- a/lib/automatic/pipeline.rb +++ b/lib/automatic/pipeline.rb @@ -6,7 +6,8 @@ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. -require 'active_support/core_ext' +require 'active_support' +require 'active_support/deprecation' module Automatic module Plugin end From 940abfd2765e0c674eccd1a80024302e169761c8 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 16 May 2014 14:13:56 +0900 Subject: [PATCH 139/188] 373 Change find-out-command from type to which --- plugins/publish/eject.rb | 7 ++++--- script/build | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/publish/eject.rb b/plugins/publish/eject.rb index 4334a72..5bd6cf8 100644 --- a/plugins/publish/eject.rb +++ b/plugins/publish/eject.rb @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Publish::Eject # Author:: soramugi +# 774 # Created:: Jun 9, 2013 -# Updated:: Jan 15, 2014 +# Updated:: May 16, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -32,9 +33,9 @@ def run end def eject_cmd - if `type -P eject` != '' # linux + if `which eject` != '' # linux 'eject ; eject -t' - elsif `type -P drutil` != '' # mac + elsif `which drutil` != '' # mac 'drutil tray eject ; drutil tray close' end end diff --git a/script/build b/script/build index aaf7139..f26f34c 100755 --- a/script/build +++ b/script/build @@ -23,14 +23,14 @@ kickstart() { export RACK_ROOT="." export RACK_ENV="test" - export DATABASE_URL="$RACK_ROOT/db" + #export DATABASE_URL="$RACK_ROOT/db" ruby -v test_subcommand log info started. } exec_rspec() { $RACK_ROOT/bin/automatic -v - bundle install --path vendor/gems + #bundle install --path vendor/gems bundle update bundle exec rake simplecov } From 3cc1d9ce663a78762b00a9a3362192865ddc55c5 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 16 May 2014 17:48:38 +0900 Subject: [PATCH 140/188] 374 ActiveSupport core ext --- lib/automatic/pipeline.rb | 5 +++-- plugins/notify/ikachan.rb | 1 + plugins/provide/fluentd.rb | 3 +-- plugins/subscription/xml.rb | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/automatic/pipeline.rb b/lib/automatic/pipeline.rb index 4f37dcc..6f29e4d 100644 --- a/lib/automatic/pipeline.rb +++ b/lib/automatic/pipeline.rb @@ -2,11 +2,12 @@ # Name:: Automatic::Pipeline # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Mar 10, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Mar 16, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'active_support' +require 'active_support/core_ext' require 'active_support/deprecation' module Automatic diff --git a/plugins/notify/ikachan.rb b/plugins/notify/ikachan.rb index ad34be7..c33b706 100644 --- a/plugins/notify/ikachan.rb +++ b/plugins/notify/ikachan.rb @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- require 'active_support' +require 'active_support/core_ext' require 'active_support/deprecation' module Automatic::Plugin diff --git a/plugins/provide/fluentd.rb b/plugins/provide/fluentd.rb index fe580a7..b0256c1 100644 --- a/plugins/provide/fluentd.rb +++ b/plugins/provide/fluentd.rb @@ -2,14 +2,13 @@ # Name:: Automatic::Plugin::Provide::Fluentd # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Feb 25, 2014 +# Updated:: May 16, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin class ProvideFluentd require 'fluent-logger' - require 'active_support' def initialize(config, pipeline=[]) @config = config diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index 641a7f5..c10fdf3 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Xml # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: Feb 21, 2014 +# Updated:: May 16, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -10,6 +10,7 @@ module Automatic::Plugin class SubscriptionXml require 'open-uri' require 'active_support' + require 'active_support/core_ext' require 'active_support/deprecation' require 'rss' From c6700f31b40b4747be095b3cdcc37c9d11b42b42 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 31 May 2014 12:20:11 +0900 Subject: [PATCH 141/188] 375 Version bump to v14.5.0 --- VERSION | 2 +- doc/ChangeLog | 5 +++++ lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 32f02f1..d184537 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.3.0 +14.5.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index e90b5e1..c9a45e7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +=== 14.5.0 / 2014-05-31 + +* Update to activesupport/record 4.1. + + === 14.3.0 / 2014-03-23 * Downgrade nokogiri version for OS X. diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index fc71d39..779fd6f 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.3.0-devel" + VERSION = "14.5.0" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 866e5a4..6f58e85 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Mar 29, 2014 +# Updated:: May 31, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.3.0-devel" } + it { expect(subject).to eq "14.5.0" } end describe "#(root)_dir" do From 9a8708d12f6789d2c15e5f94360024aa0187e020 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 31 May 2014 12:29:23 +0900 Subject: [PATCH 142/188] Regenerate gemspec for version 14.5.0 --- automatic.gemspec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 5e9b7c2..01feffb 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.3.0 ruby lib +# stub: automatic 14.5.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.3.0" + s.version = "14.5.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-03-23" + s.date = "2014-05-31" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -174,8 +174,8 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 1.7.7"]) s.add_runtime_dependency(%q, ["~> 1.3.8"]) - s.add_runtime_dependency(%q, ["~> 4.0.2"]) - s.add_runtime_dependency(%q, ["~> 4.0.2"]) + s.add_runtime_dependency(%q, ["~> 4.1.1"]) + s.add_runtime_dependency(%q, ["~> 4.1.1"]) s.add_runtime_dependency(%q, ["~> 2.0.5"]) s.add_runtime_dependency(%q, ["~> 0.1.2"]) s.add_runtime_dependency(%q, ["~> 1.1.3"]) @@ -197,8 +197,8 @@ Gem::Specification.new do |s| else s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, ["~> 1.3.8"]) - s.add_dependency(%q, ["~> 4.0.2"]) - s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 4.1.1"]) + s.add_dependency(%q, ["~> 4.1.1"]) s.add_dependency(%q, ["~> 2.0.5"]) s.add_dependency(%q, ["~> 0.1.2"]) s.add_dependency(%q, ["~> 1.1.3"]) @@ -221,8 +221,8 @@ Gem::Specification.new do |s| else s.add_dependency(%q, ["~> 1.7.7"]) s.add_dependency(%q, ["~> 1.3.8"]) - s.add_dependency(%q, ["~> 4.0.2"]) - s.add_dependency(%q, ["~> 4.0.2"]) + s.add_dependency(%q, ["~> 4.1.1"]) + s.add_dependency(%q, ["~> 4.1.1"]) s.add_dependency(%q, ["~> 2.0.5"]) s.add_dependency(%q, ["~> 0.1.2"]) s.add_dependency(%q, ["~> 1.1.3"]) From 3b788469f01f7930cc6f2c485535ad251b43f2f5 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 1 Jun 2014 15:45:04 +0900 Subject: [PATCH 143/188] 376 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 779fd6f..74925c1 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.5.0" + VERSION = "14.5.0-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 6f58e85..d9b2688 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: May 31, 2014 +# Updated:: Jun 1, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.5.0" } + it { expect(subject).to eq "14.5.0-devel" } end describe "#(root)_dir" do From 48eee6fde9c32e691e68c709876a195f40ccac3f Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 3 Oct 2014 13:00:05 +0900 Subject: [PATCH 144/188] #116 Create Plugin Filter::DescriptionLink --- plugins/filter/description_link.rb | 41 +++++++++++++++++++ spec/plugins/filter/description_link_spec.rb | 42 ++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 plugins/filter/description_link.rb create mode 100644 spec/plugins/filter/description_link_spec.rb diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb new file mode 100644 index 0000000..7993834 --- /dev/null +++ b/plugins/filter/description_link.rb @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::DescriptionLink +# Author:: 774 +# Created:: Oct 03, 2014 +# Updated:: Oct 03, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class FilterDescriptionLink + require 'uri' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + @return_feeds = [] + @pipeline.each {|feeds| + new_feeds = [] + unless feeds.nil? + feeds.items.each {|feed| + new_feeds << rewrite_link(feed) + } + end + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) + } + @return_feeds + end + + private + + def rewrite_link(feed) + new_link = URI.extract(feed.description, %w{http https}).uniq.last + feed.link = new_link unless new_link.nil? + feed + end + end +end + diff --git a/spec/plugins/filter/description_link_spec.rb b/spec/plugins/filter/description_link_spec.rb new file mode 100644 index 0000000..a97ad85 --- /dev/null +++ b/spec/plugins/filter/description_link_spec.rb @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::DescriptionLink +# Author:: 774 +# Created:: Oct 03, 2014 +# Updated:: Oct 03, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'filter/description_link' + +describe Automatic::Plugin::FilterDescriptionLink do + + context "It should be rewrite link based on the description" do + + subject { + Automatic::Plugin::FilterDescriptionLink.new( + {}, + AutomaticSpec.generate_pipeline { + feed { + item "http://test1.id774.net", + "dummy title", + "aaa bbb ccc http://test2.id774.net", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://test2.id774.net" + } + end + end + +end From f3a9a5ca6bb127358a5f40a1d2d6bb5e3d2be0e5 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 3 Oct 2014 13:20:21 +0900 Subject: [PATCH 145/188] #116 Create Plugin Filter::DescriptionLink --- test/integration/test_descriptionlink.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/integration/test_descriptionlink.yml diff --git a/test/integration/test_descriptionlink.yml b/test/integration/test_descriptionlink.yml new file mode 100644 index 0000000..6a50d64 --- /dev/null +++ b/test/integration/test_descriptionlink.yml @@ -0,0 +1,21 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionFeed + config: + feeds: + - http://reblog.id774.net/rss + + - module: FilterDescriptionLink + + - module: StorePermalink + config: + db: test_description_link.db + + #- module: PublishConsole + From 22cad0451f83c6b45391302b110a633b1db75e09 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 3 Oct 2014 14:31:30 +0900 Subject: [PATCH 146/188] #116 Option clear_description enabled --- plugins/filter/description_link.rb | 5 +++ spec/plugins/filter/description_link_spec.rb | 32 ++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index 7993834..43a4f6b 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -34,6 +34,11 @@ def run def rewrite_link(feed) new_link = URI.extract(feed.description, %w{http https}).uniq.last feed.link = new_link unless new_link.nil? + + if @config['clear_description'] == 1 + feed.description = "" + end + feed end end diff --git a/spec/plugins/filter/description_link_spec.rb b/spec/plugins/filter/description_link_spec.rb index a97ad85..add5068 100644 --- a/spec/plugins/filter/description_link_spec.rb +++ b/spec/plugins/filter/description_link_spec.rb @@ -35,6 +35,38 @@ subject.run subject.instance_variable_get(:@pipeline)[0].items[0].link. should == "http://test2.id774.net" + subject.instance_variable_get(:@pipeline)[0].items[0].description. + should == "aaa bbb ccc http://test2.id774.net" + } + end + end + + context "It should be empty description if clear_description specified" do + + subject { + Automatic::Plugin::FilterDescriptionLink.new({ + 'clear_description' => 1, + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://test1.id774.net", + "dummy title", + "aaa bbb ccc http://test2.id774.net", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://test2.id774.net" + subject.instance_variable_get(:@pipeline)[0].items[0].description. + should == "" } end end From c14e5e163cd5379cf846c7c55771c6e18e0986e9 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 3 Oct 2014 15:05:12 +0900 Subject: [PATCH 147/188] #116 Option get_title enabled --- plugins/filter/description_link.rb | 15 +++++ spec/plugins/filter/description_link_spec.rb | 70 +++++++++++++++++++- 2 files changed, 82 insertions(+), 3 deletions(-) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index 43a4f6b..eaeda76 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -31,6 +31,12 @@ def run private + def get_title(url) + url.gsub!(Regexp.new("[^#{URI::PATTERN::ALNUM}\/\:\?\=&~,\.\(\)#]")) {|match| ERB::Util.url_encode(match)} + read_data = NKF.nkf("--utf8", open(url).read) + Nokogiri::HTML.parse(read_data, nil, 'utf8').xpath('//title').text + end + def rewrite_link(feed) new_link = URI.extract(feed.description, %w{http https}).uniq.last feed.link = new_link unless new_link.nil? @@ -39,6 +45,15 @@ def rewrite_link(feed) feed.description = "" end + if @config['get_title'] == 1 + begin + new_title = get_title(feed.link) + feed.title = new_title unless new_title.nil? + rescue OpenURI::HTTPError + Automatic::Log.puts("warn", "404 Not Found in get title process.") + end + end + feed end end diff --git a/spec/plugins/filter/description_link_spec.rb b/spec/plugins/filter/description_link_spec.rb index add5068..3afe13e 100644 --- a/spec/plugins/filter/description_link_spec.rb +++ b/spec/plugins/filter/description_link_spec.rb @@ -21,7 +21,7 @@ feed { item "http://test1.id774.net", "dummy title", - "aaa bbb ccc http://test2.id774.net", + "aaa bbb ccc http://test2.id774.net ddd eee", "Mon, 07 Mar 2011 15:54:11 +0900" } } @@ -36,7 +36,7 @@ subject.instance_variable_get(:@pipeline)[0].items[0].link. should == "http://test2.id774.net" subject.instance_variable_get(:@pipeline)[0].items[0].description. - should == "aaa bbb ccc http://test2.id774.net" + should == "aaa bbb ccc http://test2.id774.net ddd eee" } end end @@ -51,7 +51,7 @@ feed { item "http://test1.id774.net", "dummy title", - "aaa bbb ccc http://test2.id774.net", + "aaa bbb ccc http://test2.id774.net ddd eee", "Mon, 07 Mar 2011 15:54:11 +0900" } } @@ -71,4 +71,68 @@ end end + context "It should be got title if get_title specified" do + + subject { + Automatic::Plugin::FilterDescriptionLink.new({ + 'get_title' => 1, + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://test1.id774.net", + "dummy title", + "aaa bbb ccc http://blog.id774.net/post/2014/10/01/531/ ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://blog.id774.net/post/2014/10/01/531/" + subject.instance_variable_get(:@pipeline)[0].items[0].title. + should == "二穂様は俺の嫁 | 774::Blog" + subject.instance_variable_get(:@pipeline)[0].items[0].description. + should == "aaa bbb ccc http://blog.id774.net/post/2014/10/01/531/ ddd eee" + } + end + end + + context "It should be handling error if 404 Not Found" do + + subject { + Automatic::Plugin::FilterDescriptionLink.new({ + 'get_title' => 1, + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://test1.id774.net", + "dummy title", + "aaa bbb ccc http://blog.id774.net/post/2014/10/01/532/ ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://blog.id774.net/post/2014/10/01/532/" + subject.instance_variable_get(:@pipeline)[0].items[0].title. + should == "dummy title" + subject.instance_variable_get(:@pipeline)[0].items[0].description. + should == "aaa bbb ccc http://blog.id774.net/post/2014/10/01/532/ ddd eee" + } + end + end + end From 09ea99f4e11a0c93b5626c97f5bd346e00ffcac2 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 4 Oct 2014 15:21:59 +0900 Subject: [PATCH 148/188] 116 Docs for Filter::DescriptionLink --- doc/PLUGINS | 16 ++++++++++++++++ doc/PLUGINS.ja | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/doc/PLUGINS b/doc/PLUGINS index 01c9eaf..a241ea0 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -381,6 +381,22 @@ FilterTumblrResize - module: FilterTumblrResize +FilterDescriptionLink +--------------------- +[Path] + /plugins/filter/sort.rb + +[Abstract] + Pickup http or https URL from description. + Re-write link to the URL. + +[Syntax] + - module: FilterDescriptionLink + config: + clear_description: 1 # Set empty to description. + get_title: 1 # Get title after re-write link. + + StorePermalink -------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index dfc14fe..9581ec2 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -382,6 +382,22 @@ FilterTumblrResize - module: FilterTumblrResize +FilterDescriptionLink +--------------------- +[パス] + /plugins/filter/description_link.rb + +[概要] + 日付の昇順にソートする + もし config で sort に desc が指定されると + 昇順ではなく降順にソートする + +[レシピ記法] + - module: FilterSort + config: + sort: asc or desc + + StorePermalink -------------- [パス] From f1c7d1860ac81adf0f7fcaf87cc03fa4dbe23299 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 8 Oct 2014 19:22:32 +0900 Subject: [PATCH 149/188] 377 Fix typo --- plugins/filter/description_link.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index eaeda76..03fd45a 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -9,6 +9,7 @@ module Automatic::Plugin class FilterDescriptionLink require 'uri' + require 'nkf' def initialize(config, pipeline=[]) @config = config From adb3665f7b73a9985f5e0eaf76e4a29f15b0ad28 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 9 Oct 2014 15:23:02 +0900 Subject: [PATCH 150/188] #125 Multiple unique keys --- plugins/store/database.rb | 7 ++++++- plugins/store/full_text.rb | 4 ++-- plugins/store/permalink.rb | 4 ++-- spec/plugins/store/full_text_spec.rb | 7 ++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/store/database.rb b/plugins/store/database.rb index 3ace97f..eb7ece6 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -21,7 +21,12 @@ def for_each_new_feed new_feeds = [] feeds.items.each {|feed| unless feed.link.nil? - unless existing_records.detect {|b| b.try(unique_key) == feed.link } + if unique_keys.length > 1 + detection = existing_records.detect {|b| b.try(unique_keys[0]) == feed.link || b.try(unique_keys[1]) == feed.title } + else + detection = existing_records.detect {|b| b.try(unique_keys[0]) == feed.link } + end + unless detection yield(feed) new_feeds << feed end diff --git a/plugins/store/full_text.rb b/plugins/store/full_text.rb index a0632d1..989d600 100644 --- a/plugins/store/full_text.rb +++ b/plugins/store/full_text.rb @@ -30,8 +30,8 @@ def column_definition } end - def unique_key - :link + def unique_keys + [:link, :title] end def model_class diff --git a/plugins/store/permalink.rb b/plugins/store/permalink.rb index f777d78..e810712 100644 --- a/plugins/store/permalink.rb +++ b/plugins/store/permalink.rb @@ -28,8 +28,8 @@ def column_definition } end - def unique_key - :url + def unique_keys + [:url] end def model_class diff --git a/spec/plugins/store/full_text_spec.rb b/spec/plugins/store/full_text_spec.rb index 62fd03a..0605aae 100644 --- a/spec/plugins/store/full_text_spec.rb +++ b/spec/plugins/store/full_text_spec.rb @@ -26,7 +26,12 @@ it "should store 1 record for the new blog entry" do instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, AutomaticSpec.generate_pipeline { - feed { item "http://blog.id774.net/blogs/feed/" } + feed { + item "http://blog.id774.net/blogs/feed/", + "dummy title", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } } ) From c2fd99fdd242d0918d30ee14dffef325f0e9e9eb Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 9 Oct 2014 18:55:04 +0900 Subject: [PATCH 151/188] #124 Using Logger --- lib/automatic/log.rb | 17 +++++++++++------ spec/lib/automatic/log_spec.rb | 5 +++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/automatic/log.rb b/lib/automatic/log.rb index 64a1a66..248d0be 100644 --- a/lib/automatic/log.rb +++ b/lib/automatic/log.rb @@ -2,10 +2,12 @@ # Name:: Automatic::Log # Author:: 774 # Created:: Feb 20, 2012 -# Updated:: Mar 11, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 09, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. +require 'logger' + module Automatic module Log LOG_LEVELS = ['info', 'warn', 'error', 'none'] @@ -14,13 +16,16 @@ def self.level(level) @level = level end - def self.puts(level, message) + def self.logger + @logger ||= Logger.new(STDOUT) + end + + def self.puts(level = :info, message) if LOG_LEVELS.index(@level).to_i > LOG_LEVELS.index(level).to_i return end - t = Time.now.strftime("%Y/%m/%d %X") - print log = "#{t} [#{level}] #{message}\n" - return log + logger.send(level, message) end + end end diff --git a/spec/lib/automatic/log_spec.rb b/spec/lib/automatic/log_spec.rb index 9d69716..5bd38d5 100644 --- a/spec/lib/automatic/log_spec.rb +++ b/spec/lib/automatic/log_spec.rb @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # Name:: Auaotmatic::Log # Author:: soramugi +# 774 # Created:: May 19, 2013 -# Updated:: May 19, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 09, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper')) From b4bfe8be099e8fbaaa9368edb9d21ab0d4d85205 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 9 Oct 2014 18:57:43 +0900 Subject: [PATCH 152/188] 378 Update Timestamp --- plugins/store/database.rb | 2 +- plugins/store/full_text.rb | 4 ++-- plugins/store/permalink.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/store/database.rb b/plugins/store/database.rb index eb7ece6..7c6165d 100644 --- a/plugins/store/database.rb +++ b/plugins/store/database.rb @@ -4,7 +4,7 @@ # 774 # soramugi # Created:: Feb 27, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Oct 09, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. diff --git a/plugins/store/full_text.rb b/plugins/store/full_text.rb index 989d600..63e7e28 100644 --- a/plugins/store/full_text.rb +++ b/plugins/store/full_text.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Store::FullText # Author:: 774 # Created:: Feb 26, 2012 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 09, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'plugins/store/database' diff --git a/plugins/store/permalink.rb b/plugins/store/permalink.rb index e810712..acd8c70 100644 --- a/plugins/store/permalink.rb +++ b/plugins/store/permalink.rb @@ -3,8 +3,8 @@ # Name:: Automatic::Plugin::Store::Permalink # Author:: 774 # Created:: Feb 22, 2012 -# Updated:: Sep 18, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 09, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require 'plugins/store/database' From 1c200871683cceed50e7428c255f9b088d96d208 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 12 Oct 2014 00:42:25 +0900 Subject: [PATCH 153/188] #130 Create Plugin Filter::GoogleNews --- plugins/filter/google_news.rb | 48 +++++++++++++++++ spec/plugins/filter/google_news_spec.rb | 69 +++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 plugins/filter/google_news.rb create mode 100644 spec/plugins/filter/google_news_spec.rb diff --git a/plugins/filter/google_news.rb b/plugins/filter/google_news.rb new file mode 100644 index 0000000..5c2832b --- /dev/null +++ b/plugins/filter/google_news.rb @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::GoogleNews +# Author:: 774 +# Created:: Oct 12, 2014 +# Updated:: Oct 12, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class FilterGoogleNews + require 'uri' + require 'nkf' + + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + @return_feeds = [] + @pipeline.each {|feeds| + new_feeds = [] + unless feeds.nil? + feeds.items.each {|feed| + new_feeds << rewrite_link(feed) unless feed.link.nil? + } + end + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) + } + @return_feeds + end + + private + + def rewrite_link(feed) + if feed.link.index("http://news.google.com") + matched = feed.link.match(/(&url=)/) + unless matched.nil? + new_link = matched.post_match + feed.link = new_link unless new_link.nil? + end + end + + feed + end + end +end + diff --git a/spec/plugins/filter/google_news_spec.rb b/spec/plugins/filter/google_news_spec.rb new file mode 100644 index 0000000..6ed249a --- /dev/null +++ b/spec/plugins/filter/google_news_spec.rb @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::GoogleNews +# Author:: 774 +# Created:: Oct 12, 2014 +# Updated:: Oct 12, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'filter/google_news' + +describe Automatic::Plugin::FilterGoogleNews do + + context "It should be not rewrite link other urls" do + + subject { + Automatic::Plugin::FilterGoogleNews.new( + {}, + AutomaticSpec.generate_pipeline { + feed { + item "http://test1.id774.net", + "dummy title", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://test1.id774.net" + } + end + end + + context "It should be rewrite link for google news urls" do + + subject { + Automatic::Plugin::FilterGoogleNews.new( + {}, + AutomaticSpec.generate_pipeline { + feed { + 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", + "dummy title", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + } + + describe "#run" do + its(:run) { should have(1).feeds } + + specify { + subject.run + subject.instance_variable_get(:@pipeline)[0].items[0].link. + should == "http://www.yomiuri.co.jp/world/20141010-OYT1T50090.html" + } + end + end + +end From 743b90d9a8520e41b197c9d99a59160a42ad6fae Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 12 Oct 2014 01:06:50 +0900 Subject: [PATCH 154/188] #130 Test for Filter::GoogleNews --- test/integration/test_google_news.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/integration/test_google_news.yml diff --git a/test/integration/test_google_news.yml b/test/integration/test_google_news.yml new file mode 100644 index 0000000..bcd8b43 --- /dev/null +++ b/test/integration/test_google_news.yml @@ -0,0 +1,21 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionFeed + config: + feeds: + - http://news.google.com/news?hl=ja&ned=us&ie=UTF-8&oe=UTF-8&output=rss + + - module: FilterGoogleNews + + - module: StorePermalink + config: + db: test_google_news.db + + - module: PublishConsole + From 16a780f999b19e8a3298ad5bf7a8e85282925396 Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 13 Oct 2014 21:37:21 +0900 Subject: [PATCH 155/188] #130 Docs for Filter::GoogleNews --- doc/PLUGINS | 14 +++++++++++++- doc/PLUGINS.ja | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/PLUGINS b/doc/PLUGINS index a241ea0..b2e40e0 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -384,7 +384,7 @@ FilterTumblrResize FilterDescriptionLink --------------------- [Path] - /plugins/filter/sort.rb + /plugins/filter/description_link.rb [Abstract] Pickup http or https URL from description. @@ -397,6 +397,18 @@ FilterDescriptionLink get_title: 1 # Get title after re-write link. +FilterGoogleNews +---------------- +[Path] + /plugins/filter/google_news.rb + +[Abstract] + Re-write Google News link to a new link of the redirect. + +[Syntax] + - module: FilterGoogleNews + + StorePermalink -------------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 9581ec2..9485356 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -393,9 +393,23 @@ FilterDescriptionLink 昇順ではなく降順にソートする [レシピ記法] - - module: FilterSort + - module: FilterDescriptionLink config: - sort: asc or desc + clear_description: 1 # Set empty to description. + get_title: 1 # Get title after re-write link. + + +FilterGoogleNews +---------------- +[パス] + /plugins/filter/google_news.rb + +[概要] + Google News のリンクを + リダイレクト先のものに書き換える + +[レシピ記法] + - module: FilterGoogleNews StorePermalink From f51e469230f369ea4d9a5991fcdf7c4a5a58af98 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 14 Oct 2014 01:26:08 +0900 Subject: [PATCH 156/188] #130 Check class of feedlink --- plugins/filter/google_news.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/filter/google_news.rb b/plugins/filter/google_news.rb index 5c2832b..826e224 100644 --- a/plugins/filter/google_news.rb +++ b/plugins/filter/google_news.rb @@ -34,10 +34,12 @@ def run def rewrite_link(feed) if feed.link.index("http://news.google.com") - matched = feed.link.match(/(&url=)/) - unless matched.nil? - new_link = matched.post_match - feed.link = new_link unless new_link.nil? + if feed.link.class == String + matched = feed.link.match(/(&url=)/) + unless matched.nil? + new_link = matched.post_match + feed.link = new_link unless new_link.nil? + end end end From c2890972c76b9b0f9accbd28a54a564f71cf8c75 Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 14 Oct 2014 02:14:23 +0900 Subject: [PATCH 157/188] 116 Error handling for get title --- plugins/filter/description_link.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index 03fd45a..6c94cd4 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::DescriptionLink # Author:: 774 # Created:: Oct 03, 2014 -# Updated:: Oct 03, 2014 +# Updated:: Oct 14, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -33,9 +33,17 @@ def run private def get_title(url) - url.gsub!(Regexp.new("[^#{URI::PATTERN::ALNUM}\/\:\?\=&~,\.\(\)#]")) {|match| ERB::Util.url_encode(match)} - read_data = NKF.nkf("--utf8", open(url).read) - Nokogiri::HTML.parse(read_data, nil, 'utf8').xpath('//title').text + if url.class == String + url.gsub!(Regexp.new("[^#{URI::PATTERN::ALNUM}\/\:\?\=&~,\.\(\)#]")) {|match| ERB::Util.url_encode(match)} + begin + read_data = NKF.nkf("--utf8", open(url).read) + Nokogiri::HTML.parse(read_data, nil, 'utf8').xpath('//title').text + rescue + Automatic::Log.puts("warn", "Failed in get title for: #{url}") + end + else + nil + end end def rewrite_link(feed) From cb173d5fb75b65f31b6fe9340ad951b44940b29e Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 14 Oct 2014 10:09:48 +0900 Subject: [PATCH 158/188] #116 Check class of feedlink --- plugins/filter/google_news.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/filter/google_news.rb b/plugins/filter/google_news.rb index 826e224..8bd5ec7 100644 --- a/plugins/filter/google_news.rb +++ b/plugins/filter/google_news.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::GoogleNews # Author:: 774 # Created:: Oct 12, 2014 -# Updated:: Oct 12, 2014 +# Updated:: Oct 14, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -33,8 +33,8 @@ def run private def rewrite_link(feed) - if feed.link.index("http://news.google.com") - if feed.link.class == String + if feed.link.class == String + if feed.link.index("http://news.google.com") matched = feed.link.match(/(&url=)/) unless matched.nil? new_link = matched.post_match From 367a56e8b0219d763588c81797b7e7bf092db74b Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 15 Oct 2014 12:13:44 +0900 Subject: [PATCH 159/188] #116 Avoid if get_title returns true class --- plugins/filter/description_link.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index 6c94cd4..e552a65 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::DescriptionLink # Author:: 774 # Created:: Oct 03, 2014 -# Updated:: Oct 14, 2014 +# Updated:: Oct 15, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -57,7 +57,11 @@ def rewrite_link(feed) if @config['get_title'] == 1 begin new_title = get_title(feed.link) - feed.title = new_title unless new_title.nil? + unless new_title.nil? + if new_title.class == String + feed.title = new_title + end + end rescue OpenURI::HTTPError Automatic::Log.puts("warn", "404 Not Found in get title process.") end From 94aac7f3f1077126a43c3e1f04982da47a45204c Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 15 Oct 2014 18:53:24 +0900 Subject: [PATCH 160/188] 379 Append tests for Store::FullText --- spec/plugins/store/full_text_spec.rb | 51 ++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/spec/plugins/store/full_text_spec.rb b/spec/plugins/store/full_text_spec.rb index 0605aae..b74612a 100644 --- a/spec/plugins/store/full_text_spec.rb +++ b/spec/plugins/store/full_text_spec.rb @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Store::FullText # Author:: 774 -# Updated:: Jun 14, 2012 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 15, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') @@ -35,9 +35,11 @@ } ) + Automatic::Plugin::Blog.count.should eq 0 lambda { instance.run.should have(1).feed }.should change(Automatic::Plugin::Blog, :count).by(1) + Automatic::Plugin::Blog.count.should eq 1 end it "should not store record for the existent blog entry" do @@ -47,10 +49,55 @@ } ) + Automatic::Plugin::Blog.count.should eq 0 instance.run.should have(1).feed lambda { instance.run.should have(0).feed }.should change(Automatic::Plugin::Blog, :count).by(0) + instance.run.should have(0).feed + Automatic::Plugin::Blog.count.should eq 1 + end + + it "should not store record for the existent blog link" do + instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/100", + "#{rand(10000000)}", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + + Automatic::Plugin::Blog.count.should eq 0 + instance.run.should have(1).feed + lambda { + instance.run.should have(0).feed + }.should change(Automatic::Plugin::Blog, :count).by(0) + instance.run.should have(0).feed + Automatic::Plugin::Blog.count.should eq 1 + end + + it "should not store record for the existent blog title" do + instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/#{rand(1000000)}", + "dummy", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + + Automatic::Plugin::Blog.count.should eq 0 + instance.run.should have(1).feed + lambda { + instance.run.should have(0).feed + }.should change(Automatic::Plugin::Blog, :count).by(0) + instance.run.should have(0).feed + Automatic::Plugin::Blog.count.should eq 1 end end From 87440a61b1bab149976b603c0a58f35120b42157 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 13:39:24 +0900 Subject: [PATCH 161/188] 379 Append tests for Store::FullText --- spec/plugins/store/full_text_spec.rb | 65 ++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/spec/plugins/store/full_text_spec.rb b/spec/plugins/store/full_text_spec.rb index b74612a..f2e5f2b 100644 --- a/spec/plugins/store/full_text_spec.rb +++ b/spec/plugins/store/full_text_spec.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Name:: Automatic::Plugin::Store::FullText # Author:: 774 -# Updated:: Oct 15, 2014 +# Updated:: Oct 16, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -63,7 +63,17 @@ AutomaticSpec.generate_pipeline { feed { item "http://blog.id774.net/post/100", - "#{rand(10000000)}", + "dummy title 1", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/100", + "dummy title 2", "aaa bbb ccc http://test2.id774.net ddd eee", "Mon, 07 Mar 2011 15:54:11 +0900" } @@ -73,9 +83,9 @@ Automatic::Plugin::Blog.count.should eq 0 instance.run.should have(1).feed lambda { - instance.run.should have(0).feed + instance2.run.should have(0).feed }.should change(Automatic::Plugin::Blog, :count).by(0) - instance.run.should have(0).feed + instance2.run.should have(0).feed Automatic::Plugin::Blog.count.should eq 1 end @@ -83,8 +93,18 @@ instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, AutomaticSpec.generate_pipeline { feed { - item "http://blog.id774.net/post/#{rand(1000000)}", - "dummy", + item "http://blog.id774.net/post/100", + "dummy title 1", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/200", + "dummy title 1", "aaa bbb ccc http://test2.id774.net ddd eee", "Mon, 07 Mar 2011 15:54:11 +0900" } @@ -94,10 +114,39 @@ Automatic::Plugin::Blog.count.should eq 0 instance.run.should have(1).feed lambda { - instance.run.should have(0).feed + instance2.run.should have(0).feed }.should change(Automatic::Plugin::Blog, :count).by(0) - instance.run.should have(0).feed + instance2.run.should have(0).feed Automatic::Plugin::Blog.count.should eq 1 end + it "should store 2 records for the independent entries" do + instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/100", + "dummy title 1", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + instance2 = Automatic::Plugin::StoreFullText.new({"db" => @db_filename}, + AutomaticSpec.generate_pipeline { + feed { + item "http://blog.id774.net/post/200", + "dummy title 2", + "aaa bbb ccc http://test2.id774.net ddd eee", + "Mon, 07 Mar 2011 15:54:11 +0900" + } + } + ) + + Automatic::Plugin::Blog.count.should eq 0 + instance.run.should have(1).feed + lambda { + instance2.run.should have(1).feed + }.should change(Automatic::Plugin::Blog, :count).by(1) + Automatic::Plugin::Blog.count.should eq 2 + end end From b195f41f1cd5c06bdc33d46bd68b0c8128ae1e5d Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 16:30:29 +0900 Subject: [PATCH 162/188] #130 Return original feeds --- plugins/filter/google_news.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/filter/google_news.rb b/plugins/filter/google_news.rb index 8bd5ec7..9348313 100644 --- a/plugins/filter/google_news.rb +++ b/plugins/filter/google_news.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::GoogleNews # Author:: 774 # Created:: Oct 12, 2014 -# Updated:: Oct 14, 2014 +# Updated:: Oct 16, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -25,7 +25,7 @@ def run new_feeds << rewrite_link(feed) unless feed.link.nil? } end - @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) + @return_feeds << new_feeds } @return_feeds end From 79d77da755f3b563a5e00a1fc13df7481ed17f5f Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 16:49:18 +0900 Subject: [PATCH 163/188] #116 Refactoring Filter::DescriptionLink --- plugins/filter/description_link.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index e552a65..9fbe4e9 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::DescriptionLink # Author:: 774 # Created:: Oct 03, 2014 -# Updated:: Oct 15, 2014 +# Updated:: Oct 16, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -33,17 +33,19 @@ def run private def get_title(url) + new_title = nil if url.class == String url.gsub!(Regexp.new("[^#{URI::PATTERN::ALNUM}\/\:\?\=&~,\.\(\)#]")) {|match| ERB::Util.url_encode(match)} begin read_data = NKF.nkf("--utf8", open(url).read) - Nokogiri::HTML.parse(read_data, nil, 'utf8').xpath('//title').text + get_text = Nokogiri::HTML.parse(read_data, nil, 'utf8').xpath('//title').text + new_title = get_text if get_text.class == String rescue Automatic::Log.puts("warn", "Failed in get title for: #{url}") end - else - nil end + + new_title end def rewrite_link(feed) @@ -57,11 +59,7 @@ def rewrite_link(feed) if @config['get_title'] == 1 begin new_title = get_title(feed.link) - unless new_title.nil? - if new_title.class == String - feed.title = new_title - end - end + feed.title = new_title unless new_title.nil? rescue OpenURI::HTTPError Automatic::Log.puts("warn", "404 Not Found in get title process.") end From 71b921b3dadad5aeb8026c13b5e5e6fa578c6f3d Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 18:28:30 +0900 Subject: [PATCH 164/188] 380 ChangeLog for v14.10.0 --- doc/ChangeLog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index c9a45e7..b5fd0df 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,17 @@ +=== 14.10.0 / 2014-10-xx + +* Using Logger + +* Improvement File Saving Plugin + + * Store::FullText will ignore duplicated titled entry. + +* Added new plugins. + + * Filter::GoogleNews + * Filter::DescriptionLink + + === 14.5.0 / 2014-05-31 * Update to activesupport/record 4.1. From 93d2c05f31e44fd8fdbade673e790a47a99d99c0 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 19:13:51 +0900 Subject: [PATCH 165/188] Revert "#130 Return original feeds" This reverts commit b195f41f1cd5c06bdc33d46bd68b0c8128ae1e5d. --- plugins/filter/google_news.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/filter/google_news.rb b/plugins/filter/google_news.rb index 9348313..8bd5ec7 100644 --- a/plugins/filter/google_news.rb +++ b/plugins/filter/google_news.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Filter::GoogleNews # Author:: 774 # Created:: Oct 12, 2014 -# Updated:: Oct 16, 2014 +# Updated:: Oct 14, 2014 # Copyright:: Copyright (c) 2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -25,7 +25,7 @@ def run new_feeds << rewrite_link(feed) unless feed.link.nil? } end - @return_feeds << new_feeds + @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) } @return_feeds end From da3b03c0ab1ad11847cc7adad48c2ba91c07d8bc Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Oct 2014 19:41:40 +0900 Subject: [PATCH 166/188] #116 Enable blank config --- plugins/filter/description_link.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/plugins/filter/description_link.rb b/plugins/filter/description_link.rb index 9fbe4e9..7f10b44 100644 --- a/plugins/filter/description_link.rb +++ b/plugins/filter/description_link.rb @@ -52,16 +52,18 @@ def rewrite_link(feed) new_link = URI.extract(feed.description, %w{http https}).uniq.last feed.link = new_link unless new_link.nil? - if @config['clear_description'] == 1 - feed.description = "" - end + if @config.class == Hash + if @config['clear_description'] == 1 + feed.description = "" + end - if @config['get_title'] == 1 - begin - new_title = get_title(feed.link) - feed.title = new_title unless new_title.nil? - rescue OpenURI::HTTPError - Automatic::Log.puts("warn", "404 Not Found in get title process.") + if @config['get_title'] == 1 + begin + new_title = get_title(feed.link) + feed.title = new_title unless new_title.nil? + rescue OpenURI::HTTPError + Automatic::Log.puts("warn", "404 Not Found in get title process.") + end end end From 800a1d9d177e61b051de99498854d308d96cab3e Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 20 Oct 2014 17:58:12 +0900 Subject: [PATCH 167/188] #145 Add Plugin Filter::Clear --- plugins/filter/clear.rb | 20 +++++++++++++ spec/plugins/filter/clear_spec.rb | 49 +++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 plugins/filter/clear.rb create mode 100644 spec/plugins/filter/clear_spec.rb diff --git a/plugins/filter/clear.rb b/plugins/filter/clear.rb new file mode 100644 index 0000000..6c3951d --- /dev/null +++ b/plugins/filter/clear.rb @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::Clear +# Author:: 774 +# Created:: Oct 20, 2014 +# Updated:: Oct 20, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +module Automatic::Plugin + class FilterClear + def initialize(config, pipeline=[]) + @config = config + @pipeline = pipeline + end + + def run + [] + end + end +end diff --git a/spec/plugins/filter/clear_spec.rb b/spec/plugins/filter/clear_spec.rb new file mode 100644 index 0000000..fbbe207 --- /dev/null +++ b/spec/plugins/filter/clear_spec.rb @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Name:: Automatic::Plugin::Filter::Clear +# Author:: 774 +# Created:: Oct 20, 2014 +# Updated:: Oct 20, 2014 +# Copyright:: Copyright (c) 2014 Automatic Ruby Developers. +# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. + +require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') + +require 'filter/clear' + +describe Automatic::Plugin::FilterClear do + + context "should be cleared" do + subject { + Automatic::Plugin::FilterClear.new({ + }, + AutomaticSpec.generate_pipeline { + feed { + item "http://hogefuga.com", "", + "aaaabbbccc" + } + feed { + item "http://aaaabbbccc.com", "", + "hogefugahoge" + } + feed { + item "http://aaabbbccc.com", "", + "aaaaaaaaaacccdd" + } + feed { + item "http://aaccc.com", "", + "aaaabbbccc" + item "http://aabbccc.com", "", + "aabbbccc" + } + feed { + item "http://cccddd.com", "", + "aabbbcccdd" + } + } + )} + + describe "#run" do + its(:run) { should have(0).feeds } + end + end +end From d9c2ee5c4a82fa8224404f99977edca08e7df22a Mon Sep 17 00:00:00 2001 From: id774 Date: Mon, 20 Oct 2014 18:02:56 +0900 Subject: [PATCH 168/188] #145 Docs for Filter::Clear --- doc/ChangeLog | 1 + doc/PLUGINS | 12 ++++++++++++ doc/PLUGINS.ja | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index b5fd0df..3f64ba9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,6 +8,7 @@ * Added new plugins. + * Filter::Clear * Filter::GoogleNews * Filter::DescriptionLink diff --git a/doc/PLUGINS b/doc/PLUGINS index b2e40e0..03ae7f7 100644 --- a/doc/PLUGINS +++ b/doc/PLUGINS @@ -216,6 +216,18 @@ SubscriptionChanToru retry: RETRY_COUNT +FilterClear +----------- +[Path] + /plugins/filter/clear.rb + +[Abstract] + Clear Pipeline. + +[Syntax] + - module: FilterClear + + FilterSort ---------- [Path] diff --git a/doc/PLUGINS.ja b/doc/PLUGINS.ja index 9485356..6826bc8 100644 --- a/doc/PLUGINS.ja +++ b/doc/PLUGINS.ja @@ -216,6 +216,18 @@ SubscriptionChanToru retry: エラー時のリトライ回数 (回数, 省略時 0) +FilterClear +----------- +[パス] + /plugins/filter/clear.rb + +[概要] + パイプラインをカラにする + +[レシピ記法] + - module: FilterClear + + FilterSort ---------- [パス] From 1664d3189dc05b1a4794392dab1658854203aa0f Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 23 Oct 2014 14:19:18 +0900 Subject: [PATCH 169/188] 381 Version bump to v14.10.0 --- VERSION | 2 +- doc/ChangeLog | 2 +- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index d184537..6242bb4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.5.0 +14.10.0 diff --git a/doc/ChangeLog b/doc/ChangeLog index 3f64ba9..a90f898 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,4 @@ -=== 14.10.0 / 2014-10-xx +=== 14.10.0 / 2014-10-23 * Using Logger diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 74925c1..f676806 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.5.0-devel" + VERSION = "14.10.0" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index d9b2688..3f98966 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jun 1, 2014 +# Updated:: Oct 23, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.5.0-devel" } + it { expect(subject).to eq "14.10.0" } end describe "#(root)_dir" do From 2c6024425af38802ad4e32e1ac08de0375412664 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 23 Oct 2014 14:19:36 +0900 Subject: [PATCH 170/188] Regenerate gemspec for version 14.10.0 --- automatic.gemspec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 01feffb..12bf807 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.5.0 ruby lib +# stub: automatic 14.10.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.5.0" + s.version = "14.10.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-05-31" + s.date = "2014-10-23" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -47,8 +47,11 @@ Gem::Specification.new do |s| "plugins/custom_feed/svn_log.rb", "plugins/filter/absolute_uri.rb", "plugins/filter/accept.rb", + "plugins/filter/clear.rb", + "plugins/filter/description_link.rb", "plugins/filter/full_feed.rb", "plugins/filter/github_feed.rb", + "plugins/filter/google_news.rb", "plugins/filter/ignore.rb", "plugins/filter/image.rb", "plugins/filter/image_source.rb", @@ -97,8 +100,11 @@ Gem::Specification.new do |s| "spec/plugins/custom_feed/svn_log_spec.rb", "spec/plugins/filter/absolute_uri_spec.rb", "spec/plugins/filter/accept_spec.rb", + "spec/plugins/filter/clear_spec.rb", + "spec/plugins/filter/description_link_spec.rb", "spec/plugins/filter/full_feed_spec.rb", "spec/plugins/filter/github_feed_spec.rb", + "spec/plugins/filter/google_news_spec.rb", "spec/plugins/filter/ignore_spec.rb", "spec/plugins/filter/image_source_spec.rb", "spec/plugins/filter/image_spec.rb", @@ -141,8 +147,10 @@ Gem::Specification.new do |s| "test/integration/test_activerecord.yml", "test/integration/test_add_pocket.yml", "test/integration/test_chan_toru.yml", + "test/integration/test_descriptionlink.yml", "test/integration/test_fluentd.yml", "test/integration/test_fulltext.yml", + "test/integration/test_google_news.yml", "test/integration/test_googlealert.yml", "test/integration/test_hatenabookmark.yml", "test/integration/test_ignore.yml", From 7fc7c7369c462a77efebc01c7769cf83fd56a697 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 23 Oct 2014 14:51:43 +0900 Subject: [PATCH 171/188] 382 Version bump to v14.10.1 --- VERSION | 2 +- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 6242bb4..05bf2c6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.10.0 +14.10.1 diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index f676806..17f7527 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.10.0" + VERSION = "14.10.1" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 3f98966..e845794 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.10.0" } + it { expect(subject).to eq "14.10.1" } end describe "#(root)_dir" do From 7308fab94338aa29d3f0ecdfdd522316169fe5c1 Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 23 Oct 2014 14:51:52 +0900 Subject: [PATCH 172/188] Regenerate gemspec for version 14.10.1 --- automatic.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 12bf807..8170a78 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,11 +2,11 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.10.0 ruby lib +# stub: automatic 14.10.1 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.10.0" + s.version = "14.10.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] From 24b07f15239b69ffcbd33603956cf9a3144c79c4 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 26 Oct 2014 22:59:51 +0900 Subject: [PATCH 173/188] 383 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 17f7527..0b31d75 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.10.1" + VERSION = "14.10.1-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index e845794..4945f43 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Oct 23, 2014 +# Updated:: Oct 26, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.10.1" } + it { expect(subject).to eq "14.10.1-devel" } end describe "#(root)_dir" do From f738ef62ab26e78ee0366963b31b2af4864b15b1 Mon Sep 17 00:00:00 2001 From: id774 Date: Wed, 29 Oct 2014 13:32:47 +0900 Subject: [PATCH 174/188] #149 Using URI::Parser --- plugins/filter/absolute_uri.rb | 6 +++--- plugins/subscription/g_guide.rb | 4 ++-- plugins/subscription/link.rb | 4 ++-- plugins/subscription/xml.rb | 4 ++-- spec/plugins/subscription/g_guide_spec.rb | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/filter/absolute_uri.rb b/plugins/filter/absolute_uri.rb index 267b84f..12f9a4d 100644 --- a/plugins/filter/absolute_uri.rb +++ b/plugins/filter/absolute_uri.rb @@ -2,8 +2,8 @@ # Name:: Automatic::Plugin::Filter::AbsoluteURI # Author:: 774 # Created:: Jun 20, 2012 -# Updated:: Apr 5, 2013 -# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers. +# Updated:: Oct 29, 2014 +# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Automatic::Plugin @@ -37,7 +37,7 @@ def rewrite(string) @config['url'] = @config['url'] + '/' end string = @config['url'] + string.sub(/^\./,'').sub(/^\//,'') - string = URI.encode(string) + string = URI::Parser.new.escape(string) return string end end diff --git a/plugins/subscription/g_guide.rb b/plugins/subscription/g_guide.rb index f343a06..99a6c0a 100644 --- a/plugins/subscription/g_guide.rb +++ b/plugins/subscription/g_guide.rb @@ -3,7 +3,7 @@ # Author:: soramugi # 774 # Created:: Jun 28, 2013 -# Updated:: Feb 21, 2014 +# Updated:: Oct 29, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -43,7 +43,7 @@ def feed_url keyword = nil feed += "condition.keyword=#{keyword}&" end feed += station_param - URI.encode(feed) + URI::Parser.new.escape(feed) end def station_param diff --git a/plugins/subscription/link.rb b/plugins/subscription/link.rb index 8c87a24..f4c859f 100644 --- a/plugins/subscription/link.rb +++ b/plugins/subscription/link.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Link # Author:: 774 # Created:: Sep 18, 2012 -# Updated:: Feb 21, 2014 +# Updated:: Oct 29, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -22,7 +22,7 @@ def run retries = 0 retry_max = @config['retry'].to_i || 0 begin - create_rss(URI.encode(url)) + create_rss(URI::Parser.new.escape(url)) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") diff --git a/plugins/subscription/xml.rb b/plugins/subscription/xml.rb index c10fdf3..6b74bf0 100644 --- a/plugins/subscription/xml.rb +++ b/plugins/subscription/xml.rb @@ -2,7 +2,7 @@ # Name:: Automatic::Plugin::Subscription::Xml # Author:: 774 # Created:: Jul 12, 2013 -# Updated:: May 16, 2014 +# Updated:: Oct 29, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -25,7 +25,7 @@ def run retries = 0 retry_max = @config['retry'].to_i || 0 begin - create_rss(URI.encode(url)) + create_rss(URI::Parser.new.escape(url)) rescue retries += 1 Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}") diff --git a/spec/plugins/subscription/g_guide_spec.rb b/spec/plugins/subscription/g_guide_spec.rb index 3a72cb2..46c7ef3 100644 --- a/spec/plugins/subscription/g_guide_spec.rb +++ b/spec/plugins/subscription/g_guide_spec.rb @@ -29,7 +29,7 @@ def g_guide(config = {}, pipeline = []) subject { g_guide(config) } it 'feed_url' do - subject.feed_url(config['keyword']).should == URI.encode( + subject.feed_url(config['keyword']).should == URI::Parser.new.escape( Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + "condition.keyword=#{config['keyword']}&" + 'stationPlatformId=0&') @@ -40,7 +40,7 @@ def g_guide(config = {}, pipeline = []) subject { g_guide(config) } its(:feed_url) { - should == URI.encode( + should == URI::Parser.new.escape( Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS + 'stationPlatformId=1&') } From b4869cd6536a285c493681e215546dabcb05b131 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 26 Dec 2014 16:06:41 +0900 Subject: [PATCH 175/188] 384 Renew Gemfile for Ruby 2.2 --- Gemfile | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index 50d75da..29dc761 100644 --- a/Gemfile +++ b/Gemfile @@ -1,33 +1,33 @@ -# Version:20140509 +# Version:20141226 source "http://rubygems.org" source "http://gems.github.com" -gem 'json', '~> 1.7.7' -gem 'sqlite3', '~> 1.3.8' -gem 'activesupport', '~> 4.1.1' -gem 'activerecord', '~> 4.1.1' -gem 'hashie', '~> 2.0.5' -gem 'gcalapi', '~> 0.1.2' -gem 'xml-simple', '~> 1.1.3' -gem 'feedbag', '~> 0.9.2' -gem 'nokogiri', '~> 1.5.11' -gem 'sanitize', '~> 2.1.0' -gem 'faraday', '~> 0.8.9' -gem 'twitter', '~> 4.8.1' -gem 'pocket-ruby', '~> 0.0.4' -gem 'weather_hacker', '~> 0.1.7' -gem 'hipchat', '~> 1.0.1' -gem 'fluent-logger', '~> 0.4.7' -gem 'dalli', '~> 2.7.0' -gem 'aws-sdk', '~> 1.33.0' +gem 'json' +gem 'sqlite3' +gem 'activesupport' +gem 'activerecord' +gem 'hashie' +gem 'gcalapi' +gem 'xml-simple' +gem 'feedbag' +gem 'nokogiri' +gem 'sanitize' +gem 'faraday' +gem 'twitter', '~> 4.8' +gem 'pocket-ruby' +gem 'weather_hacker' +gem 'hipchat' +gem 'fluent-logger', '~> 0.4' +gem 'dalli' +gem 'aws-sdk' group :test do - gem 'rspec', '~> 2.14.1' + gem 'rspec', '~> 2.14' gem 'rcov', :platforms => :mri_18 - gem 'simplecov', '~> 0.8.2' - gem 'simplecov-rcov', '~> 0.2.3' - gem 'koseki-mocksmtpd', '~> 0.0.3' + gem 'simplecov', '~> 0.8' + gem 'simplecov-rcov', '~> 0.2' + gem 'koseki-mocksmtpd', '~> 0.0' end group :development do From ffff8b6aa8f2296b6ff07e79d48d8e953f7b6b98 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 27 Dec 2014 12:46:01 +0900 Subject: [PATCH 176/188] 385 Version bump to v14.12.0 --- Gemfile | 6 +++--- VERSION | 2 +- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 29dc761..f11c14e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -# Version:20141226 +# Version:20141227 source "http://rubygems.org" source "http://gems.github.com" @@ -14,11 +14,11 @@ gem 'feedbag' gem 'nokogiri' gem 'sanitize' gem 'faraday' -gem 'twitter', '~> 4.8' +gem 'twitter', '~> 4.8' gem 'pocket-ruby' gem 'weather_hacker' gem 'hipchat' -gem 'fluent-logger', '~> 0.4' +gem 'fluent-logger', '~> 0.4' gem 'dalli' gem 'aws-sdk' diff --git a/VERSION b/VERSION index 05bf2c6..27fbdeb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.10.1 +14.12.0 diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 0b31d75..2ac5365 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.10.1-devel" + VERSION = "14.12.0" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 4945f43..0bfde14 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Oct 26, 2014 +# Updated:: Dec 27, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.10.1-devel" } + it { expect(subject).to eq "14.12.0" } end describe "#(root)_dir" do From c806f854cb16090d6b4cffc3a788018a46727c09 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 27 Dec 2014 19:43:05 +0900 Subject: [PATCH 177/188] 386 ChangeLog for v14.12.0 --- doc/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index a90f898..755dd80 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +=== 14.12.0 / 2014-12-27 + +* Rewrite obsolete methods. + +* Update Gemfile. + + === 14.10.0 / 2014-10-23 * Using Logger From 66beba914558b73eb4ab7add023dcb794351b59b Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 27 Dec 2014 19:44:16 +0900 Subject: [PATCH 178/188] Regenerate gemspec for version 14.12.0 --- automatic.gemspec | 116 +++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index 8170a78..d46d5fd 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.10.1 ruby lib +# stub: automatic 14.12.0 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.10.1" + s.version = "14.12.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-10-23" + s.date = "2014-12-27" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -173,78 +173,78 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/automaticruby/automaticruby" s.licenses = ["GPL"] - s.rubygems_version = "2.2.2" + s.rubygems_version = "2.4.5" s.summary = "Automatic Ruby" if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 1.7.7"]) - s.add_runtime_dependency(%q, ["~> 1.3.8"]) - s.add_runtime_dependency(%q, ["~> 4.1.1"]) - s.add_runtime_dependency(%q, ["~> 4.1.1"]) - s.add_runtime_dependency(%q, ["~> 2.0.5"]) - s.add_runtime_dependency(%q, ["~> 0.1.2"]) - s.add_runtime_dependency(%q, ["~> 1.1.3"]) - s.add_runtime_dependency(%q, ["~> 0.9.2"]) - s.add_runtime_dependency(%q, ["~> 1.5.11"]) - s.add_runtime_dependency(%q, ["~> 2.1.0"]) - s.add_runtime_dependency(%q, ["~> 0.8.9"]) - s.add_runtime_dependency(%q, ["~> 4.8.1"]) - s.add_runtime_dependency(%q, ["~> 0.0.4"]) - s.add_runtime_dependency(%q, ["~> 0.1.7"]) - s.add_runtime_dependency(%q, ["~> 1.0.1"]) - s.add_runtime_dependency(%q, ["~> 0.4.7"]) - s.add_runtime_dependency(%q, ["~> 2.7.0"]) - s.add_runtime_dependency(%q, ["~> 1.33.0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 4.8"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 0.4"]) + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, ["~> 1.7.7"]) - s.add_dependency(%q, ["~> 1.3.8"]) - s.add_dependency(%q, ["~> 4.1.1"]) - s.add_dependency(%q, ["~> 4.1.1"]) - s.add_dependency(%q, ["~> 2.0.5"]) - s.add_dependency(%q, ["~> 0.1.2"]) - s.add_dependency(%q, ["~> 1.1.3"]) - s.add_dependency(%q, ["~> 0.9.2"]) - s.add_dependency(%q, ["~> 1.5.11"]) - s.add_dependency(%q, ["~> 2.1.0"]) - s.add_dependency(%q, ["~> 0.8.9"]) - s.add_dependency(%q, ["~> 4.8.1"]) - s.add_dependency(%q, ["~> 0.0.4"]) - s.add_dependency(%q, ["~> 0.1.7"]) - s.add_dependency(%q, ["~> 1.0.1"]) - s.add_dependency(%q, ["~> 0.4.7"]) - s.add_dependency(%q, ["~> 2.7.0"]) - s.add_dependency(%q, ["~> 1.33.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.8"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.4"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, ["~> 1.7.7"]) - s.add_dependency(%q, ["~> 1.3.8"]) - s.add_dependency(%q, ["~> 4.1.1"]) - s.add_dependency(%q, ["~> 4.1.1"]) - s.add_dependency(%q, ["~> 2.0.5"]) - s.add_dependency(%q, ["~> 0.1.2"]) - s.add_dependency(%q, ["~> 1.1.3"]) - s.add_dependency(%q, ["~> 0.9.2"]) - s.add_dependency(%q, ["~> 1.5.11"]) - s.add_dependency(%q, ["~> 2.1.0"]) - s.add_dependency(%q, ["~> 0.8.9"]) - s.add_dependency(%q, ["~> 4.8.1"]) - s.add_dependency(%q, ["~> 0.0.4"]) - s.add_dependency(%q, ["~> 0.1.7"]) - s.add_dependency(%q, ["~> 1.0.1"]) - s.add_dependency(%q, ["~> 0.4.7"]) - s.add_dependency(%q, ["~> 2.7.0"]) - s.add_dependency(%q, ["~> 1.33.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.8"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.4"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From 6e6c11272c31d1daab6bb66b28c5c17c43b406fa Mon Sep 17 00:00:00 2001 From: id774 Date: Tue, 30 Dec 2014 03:17:39 +0900 Subject: [PATCH 179/188] 387 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 2ac5365..72fc1f9 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.12.0" + VERSION = "14.12.0-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 0bfde14..a5597e1 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Dec 27, 2014 +# Updated:: Dec 30, 2014 # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.12.0" } + it { expect(subject).to eq "14.12.0-devel" } end describe "#(root)_dir" do From a3e8c767b598c39558afef02767e946eedf1f47f Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 3 Jan 2015 15:43:06 +0900 Subject: [PATCH 180/188] 388 Automatic Ruby depends on activerecord 4.1 --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f11c14e..a89b7fe 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ -# Version:20141227 +# Version:20150103 source "http://rubygems.org" source "http://gems.github.com" gem 'json' gem 'sqlite3' -gem 'activesupport' -gem 'activerecord' +gem 'activesupport', '~> 4.1.0' +gem 'activerecord', '~> 4.1.0' gem 'hashie' gem 'gcalapi' gem 'xml-simple' From 361e8137fa30b1b8f5983ee537319edfea4ecdb2 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 3 Jan 2015 15:49:46 +0900 Subject: [PATCH 181/188] 389 Version bump to v14.12.1 --- VERSION | 2 +- doc/ChangeLog | 5 +++++ lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 27fbdeb..bb7f359 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.12.0 +14.12.1 diff --git a/doc/ChangeLog b/doc/ChangeLog index 755dd80..23ff079 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +=== 14.12.1 / 2015-01-03 + +* Fix Gemfile problem + + === 14.12.0 / 2014-12-27 * Rewrite obsolete methods. diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 72fc1f9..85f1543 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.12.0-devel" + VERSION = "14.12.1" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index a5597e1..64eb680 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,8 +3,8 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Dec 30, 2014 -# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers. +# Updated:: Jan 3, 2015 +# Copyright:: Copyright (c) 2012-2015 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.12.0-devel" } + it { expect(subject).to eq "14.12.1" } end describe "#(root)_dir" do From 2b9e45016e0637655cdbe7be3457d2a0cd506175 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 3 Jan 2015 15:50:53 +0900 Subject: [PATCH 182/188] Regenerate gemspec for version 14.12.1 --- automatic.gemspec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index d46d5fd..fbe1cb7 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.12.0 ruby lib +# stub: automatic 14.12.1 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.12.0" + s.version = "14.12.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2014-12-27" + s.date = "2015-01-03" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -182,8 +182,8 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 4.1.0"]) + s.add_runtime_dependency(%q, ["~> 4.1.0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) @@ -205,8 +205,8 @@ Gem::Specification.new do |s| else s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.1.0"]) + s.add_dependency(%q, ["~> 4.1.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) @@ -229,8 +229,8 @@ Gem::Specification.new do |s| else s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.1.0"]) + s.add_dependency(%q, ["~> 4.1.0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From 12b5ecc7975be1e1730e6e34117f45556f442ff4 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 4 Jan 2015 13:48:12 +0900 Subject: [PATCH 183/188] 390 Update Gemfile --- Gemfile | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index a89b7fe..3b77fdc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,33 +1,33 @@ -# Version:20150103 +# Version:20150104 source "http://rubygems.org" source "http://gems.github.com" -gem 'json' -gem 'sqlite3' -gem 'activesupport', '~> 4.1.0' -gem 'activerecord', '~> 4.1.0' -gem 'hashie' -gem 'gcalapi' -gem 'xml-simple' -gem 'feedbag' -gem 'nokogiri' -gem 'sanitize' -gem 'faraday' -gem 'twitter', '~> 4.8' -gem 'pocket-ruby' -gem 'weather_hacker' -gem 'hipchat' -gem 'fluent-logger', '~> 0.4' -gem 'dalli' -gem 'aws-sdk' +gem 'json', '~> 1.8.1' +gem 'sqlite3', '~> 1.3.10' +gem 'activesupport', '~> 4.1.8' +gem 'activerecord', '~> 4.1.8' +gem 'hashie', '~> 3.3.2' +gem 'gcalapi', '~> 0.1.2' +gem 'xml-simple', '~> 1.1.4' +gem 'feedbag', '~> 0.9.5' +gem 'nokogiri', '~> 1.6.5' +gem 'sanitize', '~> 3.1.0' +gem 'faraday', '~> 0.8.9' +gem 'twitter', '~> 4.8.0' +gem 'pocket-ruby', '~> 0.0.5' +gem 'weather_hacker', '~> 0.1.7' +gem 'hipchat', '~> 1.4.0' +gem 'fluent-logger', '~> 0.4.7' +gem 'dalli', '~> 2.7.2' +gem 'aws-sdk', '~> 1.60.2' group :test do - gem 'rspec', '~> 2.14' + gem 'rspec', '~> 2.14.1' gem 'rcov', :platforms => :mri_18 - gem 'simplecov', '~> 0.8' - gem 'simplecov-rcov', '~> 0.2' - gem 'koseki-mocksmtpd', '~> 0.0' + gem 'simplecov', '~> 0.9.1' + gem 'simplecov-rcov', '~> 0.2.3' + gem 'koseki-mocksmtpd', '~> 0.0.3' end group :development do From b89000bdb5e9ba7597617c63ba0495e8453e3f1e Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 4 Jan 2015 14:06:59 +0900 Subject: [PATCH 184/188] 391 Version bump to v14.12.2 --- VERSION | 2 +- doc/ChangeLog | 5 ----- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index bb7f359..f16c023 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -14.12.1 +14.12.2 diff --git a/doc/ChangeLog b/doc/ChangeLog index 23ff079..755dd80 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,8 +1,3 @@ -=== 14.12.1 / 2015-01-03 - -* Fix Gemfile problem - - === 14.12.0 / 2014-12-27 * Rewrite obsolete methods. diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index 85f1543..f356727 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.12.1" + VERSION = "14.12.2" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 64eb680..9291941 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jan 3, 2015 +# Updated:: Jan 4, 2015 # Copyright:: Copyright (c) 2012-2015 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.12.1" } + it { expect(subject).to eq "14.12.2" } end describe "#(root)_dir" do From 6f62addb152e800ce5b71c151d85fbb3d44c84f0 Mon Sep 17 00:00:00 2001 From: id774 Date: Sun, 4 Jan 2015 14:10:14 +0900 Subject: [PATCH 185/188] Regenerate gemspec for version 14.12.2 --- automatic.gemspec | 114 +++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/automatic.gemspec b/automatic.gemspec index fbe1cb7..4757f0f 100644 --- a/automatic.gemspec +++ b/automatic.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: automatic 14.12.1 ruby lib +# stub: automatic 14.12.2 ruby lib Gem::Specification.new do |s| s.name = "automatic" - s.version = "14.12.1" + s.version = "14.12.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["id774"] - s.date = "2015-01-03" + s.date = "2015-01-04" s.description = "Ruby framework for the general-purpose automatic processing" s.email = "idnanashi@gmail.com" s.executables = ["automatic"] @@ -180,71 +180,71 @@ Gem::Specification.new do |s| s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 4.1.0"]) - s.add_runtime_dependency(%q, ["~> 4.1.0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 4.8"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 0.4"]) - s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 1.8.1"]) + s.add_runtime_dependency(%q, ["~> 1.3.10"]) + s.add_runtime_dependency(%q, ["~> 4.1.8"]) + s.add_runtime_dependency(%q, ["~> 4.1.8"]) + s.add_runtime_dependency(%q, ["~> 3.3.2"]) + s.add_runtime_dependency(%q, ["~> 0.1.2"]) + s.add_runtime_dependency(%q, ["~> 1.1.4"]) + s.add_runtime_dependency(%q, ["~> 0.9.5"]) + s.add_runtime_dependency(%q, ["~> 1.6.5"]) + s.add_runtime_dependency(%q, ["~> 3.1.0"]) + s.add_runtime_dependency(%q, ["~> 0.8.9"]) + s.add_runtime_dependency(%q, ["~> 4.8.0"]) + s.add_runtime_dependency(%q, ["~> 0.0.5"]) + s.add_runtime_dependency(%q, ["~> 0.1.7"]) + s.add_runtime_dependency(%q, ["~> 1.4.0"]) + s.add_runtime_dependency(%q, ["~> 0.4.7"]) + s.add_runtime_dependency(%q, ["~> 2.7.2"]) + s.add_runtime_dependency(%q, ["~> 1.60.2"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.1.0"]) - s.add_dependency(%q, ["~> 4.1.0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.8"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 0.4"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.3.10"]) + s.add_dependency(%q, ["~> 4.1.8"]) + s.add_dependency(%q, ["~> 4.1.8"]) + s.add_dependency(%q, ["~> 3.3.2"]) + s.add_dependency(%q, ["~> 0.1.2"]) + s.add_dependency(%q, ["~> 1.1.4"]) + s.add_dependency(%q, ["~> 0.9.5"]) + s.add_dependency(%q, ["~> 1.6.5"]) + s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, ["~> 0.8.9"]) + s.add_dependency(%q, ["~> 4.8.0"]) + s.add_dependency(%q, ["~> 0.0.5"]) + s.add_dependency(%q, ["~> 0.1.7"]) + s.add_dependency(%q, ["~> 1.4.0"]) + s.add_dependency(%q, ["~> 0.4.7"]) + s.add_dependency(%q, ["~> 2.7.2"]) + s.add_dependency(%q, ["~> 1.60.2"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.1.0"]) - s.add_dependency(%q, ["~> 4.1.0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 4.8"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 0.4"]) - s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.8.1"]) + s.add_dependency(%q, ["~> 1.3.10"]) + s.add_dependency(%q, ["~> 4.1.8"]) + s.add_dependency(%q, ["~> 4.1.8"]) + s.add_dependency(%q, ["~> 3.3.2"]) + s.add_dependency(%q, ["~> 0.1.2"]) + s.add_dependency(%q, ["~> 1.1.4"]) + s.add_dependency(%q, ["~> 0.9.5"]) + s.add_dependency(%q, ["~> 1.6.5"]) + s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, ["~> 0.8.9"]) + s.add_dependency(%q, ["~> 4.8.0"]) + s.add_dependency(%q, ["~> 0.0.5"]) + s.add_dependency(%q, ["~> 0.1.7"]) + s.add_dependency(%q, ["~> 1.4.0"]) + s.add_dependency(%q, ["~> 0.4.7"]) + s.add_dependency(%q, ["~> 2.7.2"]) + s.add_dependency(%q, ["~> 1.60.2"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) From 5157b4f77db098d87c767e59866ea21e1e5bcb59 Mon Sep 17 00:00:00 2001 From: id774 Date: Sat, 24 Jan 2015 23:48:55 +0900 Subject: [PATCH 186/188] 392 Version bump to the next release --- lib/automatic/version.rb | 2 +- spec/lib/automatic_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/automatic/version.rb b/lib/automatic/version.rb index f356727..791778c 100644 --- a/lib/automatic/version.rb +++ b/lib/automatic/version.rb @@ -1,3 +1,3 @@ module Automatic - VERSION = "14.12.2" + VERSION = "14.12.2-devel" end diff --git a/spec/lib/automatic_spec.rb b/spec/lib/automatic_spec.rb index 9291941..3c033f4 100644 --- a/spec/lib/automatic_spec.rb +++ b/spec/lib/automatic_spec.rb @@ -3,7 +3,7 @@ # Author:: kzgs # 774 # Created:: Mar 9, 2012 -# Updated:: Jan 4, 2015 +# Updated:: Jan 24, 2015 # Copyright:: Copyright (c) 2012-2015 Automatic Ruby Developers. # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. @@ -27,7 +27,7 @@ describe "#version" do subject { Automatic.const_get(:VERSION) } - it { expect(subject).to eq "14.12.2" } + it { expect(subject).to eq "14.12.2-devel" } end describe "#(root)_dir" do From 542fc66c579d42fc39a00e08ba186c1383f43aee Mon Sep 17 00:00:00 2001 From: id774 Date: Thu, 16 Apr 2015 16:35:28 +0900 Subject: [PATCH 187/188] 393 Add test recipe --- test/integration/test_pdf2local.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/integration/test_pdf2local.yml diff --git a/test/integration/test_pdf2local.yml b/test/integration/test_pdf2local.yml new file mode 100644 index 0000000..f66b078 --- /dev/null +++ b/test/integration/test_pdf2local.yml @@ -0,0 +1,22 @@ +global: + timezone: Asia/Tokyo + cache: + base: /tmp + log: + level: info + +plugins: + - module: SubscriptionFeed + config: + feeds: + - http://webapi.yanoshin.jp/webapi/tdnet/list/recent.rss + + - module: FilterSort + config: + sort: desc + + - module: StoreFile + config: + path: /tmp + retry: 3 + interval: 3 From 4a910e319546ca091fceba64f573a2c1e929c0a0 Mon Sep 17 00:00:00 2001 From: id774 Date: Fri, 17 Apr 2015 12:55:21 +0900 Subject: [PATCH 188/188] 393 Add test recipe --- test/integration/test_pdf2local.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/integration/test_pdf2local.yml b/test/integration/test_pdf2local.yml index f66b078..ea1a3f1 100644 --- a/test/integration/test_pdf2local.yml +++ b/test/integration/test_pdf2local.yml @@ -15,6 +15,10 @@ plugins: config: sort: desc + - module: StorePermalink + config: + db: test_pdf2local.db + - module: StoreFile config: path: /tmp