automatic 14.1.0 → 14.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/automatic.gemspec +17 -9
- data/bin/automatic +4 -4
- data/doc/ChangeLog +27 -0
- data/doc/PLUGINS +36 -6
- data/doc/PLUGINS.ja +35 -7
- data/doc/README +4 -4
- data/doc/README.ja +3 -3
- data/lib/automatic.rb +2 -1
- data/lib/automatic/feed_maker.rb +80 -0
- data/lib/automatic/feed_parser.rb +6 -50
- data/lib/automatic/recipe.rb +1 -1
- data/lib/automatic/version.rb +1 -1
- data/plugins/filter/accept.rb +4 -3
- data/plugins/filter/github_feed.rb +12 -11
- data/plugins/filter/ignore.rb +3 -3
- data/plugins/filter/image_source.rb +10 -10
- data/plugins/filter/one.rb +4 -3
- data/plugins/filter/rand.rb +3 -3
- data/plugins/filter/sanitize.rb +2 -3
- data/plugins/provide/fluentd.rb +5 -4
- data/plugins/publish/amazon_s3.rb +58 -0
- data/plugins/publish/fluentd.rb +5 -4
- data/plugins/publish/google_calendar.rb +2 -2
- data/plugins/publish/hipchat.rb +1 -1
- data/plugins/publish/twitter.rb +1 -1
- data/plugins/store/database.rb +4 -4
- data/plugins/store/file.rb +95 -0
- data/plugins/store/full_text.rb +1 -1
- data/plugins/store/permalink.rb +1 -1
- data/plugins/subscription/feed.rb +2 -2
- data/plugins/subscription/g_guide.rb +3 -2
- data/plugins/subscription/link.rb +4 -3
- data/plugins/subscription/pocket.rb +12 -11
- data/plugins/subscription/text.rb +35 -44
- data/plugins/subscription/tumblr.rb +3 -3
- data/plugins/subscription/twitter.rb +1 -1
- data/plugins/subscription/twitter_search.rb +11 -12
- data/plugins/subscription/weather.rb +7 -6
- data/plugins/subscription/xml.rb +4 -3
- data/spec/fixtures/sampleFeeds.tsv +1 -0
- data/spec/fixtures/sampleFeeds2.tsv +2 -0
- data/spec/lib/automatic/pipeline_spec.rb +4 -4
- data/spec/lib/automatic_spec.rb +3 -3
- data/spec/plugins/filter/github_feed_spec.rb +9 -8
- data/spec/plugins/filter/image_source_spec.rb +7 -7
- data/spec/plugins/notify/ikachan_spec.rb +3 -3
- data/spec/plugins/provide/fluentd_spec.rb +6 -5
- data/spec/plugins/publish/amazon_s3_spec.rb +40 -0
- data/spec/plugins/publish/console_spec.rb +3 -3
- data/spec/plugins/publish/fluentd_spec.rb +5 -4
- data/spec/plugins/publish/google_calendar_spec.rb +5 -5
- data/spec/plugins/publish/hatena_bookmark_spec.rb +10 -10
- data/spec/plugins/publish/hipchat_spec.rb +6 -6
- data/spec/plugins/publish/instapaper_spec.rb +6 -6
- data/spec/plugins/publish/memcached_spec.rb +3 -3
- data/spec/plugins/publish/pocket_spec.rb +3 -3
- data/spec/plugins/publish/twitter_spec.rb +4 -4
- data/spec/plugins/store/{target_link_spec.rb → file_spec.rb} +10 -10
- data/spec/plugins/subscription/pocket_spec.rb +3 -3
- data/spec/plugins/subscription/text_spec.rb +32 -2
- data/spec/plugins/subscription/twitter_search_spec.rb +3 -3
- data/test/integration/test_fluentd.yml +1 -0
- data/test/integration/test_image2local.yml +6 -2
- data/test/integration/test_text2feed.yml +8 -0
- data/test/integration/test_tumblr2local.yml +6 -0
- metadata +26 -7
- data/plugins/store/target_link.rb +0 -55
@@ -1,55 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# Name:: Automatic::Plugin::Store::TargetLink
|
4
|
-
# Author:: 774 <http://id774.net>
|
5
|
-
# Created:: Feb 28, 2012
|
6
|
-
# Updated:: Jan 15, 2014
|
7
|
-
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
|
8
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
|
-
|
10
|
-
require 'open-uri'
|
11
|
-
|
12
|
-
module Automatic::Plugin
|
13
|
-
class StoreTargetLink
|
14
|
-
|
15
|
-
def initialize(config, pipeline=[])
|
16
|
-
@config = config
|
17
|
-
@pipeline = pipeline
|
18
|
-
end
|
19
|
-
|
20
|
-
def run
|
21
|
-
@pipeline.each {|feeds|
|
22
|
-
unless feeds.nil?
|
23
|
-
feeds.items.each {|feed|
|
24
|
-
unless feed.link.nil?
|
25
|
-
Automatic::Log.puts("info", "Downloading: #{feed.link}")
|
26
|
-
FileUtils.mkdir_p(@config['path']) unless FileTest.exist?(@config['path'])
|
27
|
-
retries = 0
|
28
|
-
retry_max = @config['retry'].to_i || 0
|
29
|
-
begin
|
30
|
-
retries += 1
|
31
|
-
wget(feed.link)
|
32
|
-
sleep ||= @config['interval'].to_i
|
33
|
-
rescue
|
34
|
-
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault during file download.")
|
35
|
-
sleep ||= @config['interval'].to_i
|
36
|
-
retry if retries <= retry_max
|
37
|
-
end
|
38
|
-
end
|
39
|
-
}
|
40
|
-
end
|
41
|
-
}
|
42
|
-
@pipeline
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
def wget(url)
|
47
|
-
filename = url.split(/\//).last
|
48
|
-
open(url) {|source|
|
49
|
-
open(File.join(@config['path'], filename), "w+b") { |o|
|
50
|
-
o.print source.read
|
51
|
-
}
|
52
|
-
}
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|