automatic 14.1.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +2 -2
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/automatic.gemspec +17 -9
  7. data/bin/automatic +4 -4
  8. data/doc/ChangeLog +27 -0
  9. data/doc/PLUGINS +36 -6
  10. data/doc/PLUGINS.ja +35 -7
  11. data/doc/README +4 -4
  12. data/doc/README.ja +3 -3
  13. data/lib/automatic.rb +2 -1
  14. data/lib/automatic/feed_maker.rb +80 -0
  15. data/lib/automatic/feed_parser.rb +6 -50
  16. data/lib/automatic/recipe.rb +1 -1
  17. data/lib/automatic/version.rb +1 -1
  18. data/plugins/filter/accept.rb +4 -3
  19. data/plugins/filter/github_feed.rb +12 -11
  20. data/plugins/filter/ignore.rb +3 -3
  21. data/plugins/filter/image_source.rb +10 -10
  22. data/plugins/filter/one.rb +4 -3
  23. data/plugins/filter/rand.rb +3 -3
  24. data/plugins/filter/sanitize.rb +2 -3
  25. data/plugins/provide/fluentd.rb +5 -4
  26. data/plugins/publish/amazon_s3.rb +58 -0
  27. data/plugins/publish/fluentd.rb +5 -4
  28. data/plugins/publish/google_calendar.rb +2 -2
  29. data/plugins/publish/hipchat.rb +1 -1
  30. data/plugins/publish/twitter.rb +1 -1
  31. data/plugins/store/database.rb +4 -4
  32. data/plugins/store/file.rb +95 -0
  33. data/plugins/store/full_text.rb +1 -1
  34. data/plugins/store/permalink.rb +1 -1
  35. data/plugins/subscription/feed.rb +2 -2
  36. data/plugins/subscription/g_guide.rb +3 -2
  37. data/plugins/subscription/link.rb +4 -3
  38. data/plugins/subscription/pocket.rb +12 -11
  39. data/plugins/subscription/text.rb +35 -44
  40. data/plugins/subscription/tumblr.rb +3 -3
  41. data/plugins/subscription/twitter.rb +1 -1
  42. data/plugins/subscription/twitter_search.rb +11 -12
  43. data/plugins/subscription/weather.rb +7 -6
  44. data/plugins/subscription/xml.rb +4 -3
  45. data/spec/fixtures/sampleFeeds.tsv +1 -0
  46. data/spec/fixtures/sampleFeeds2.tsv +2 -0
  47. data/spec/lib/automatic/pipeline_spec.rb +4 -4
  48. data/spec/lib/automatic_spec.rb +3 -3
  49. data/spec/plugins/filter/github_feed_spec.rb +9 -8
  50. data/spec/plugins/filter/image_source_spec.rb +7 -7
  51. data/spec/plugins/notify/ikachan_spec.rb +3 -3
  52. data/spec/plugins/provide/fluentd_spec.rb +6 -5
  53. data/spec/plugins/publish/amazon_s3_spec.rb +40 -0
  54. data/spec/plugins/publish/console_spec.rb +3 -3
  55. data/spec/plugins/publish/fluentd_spec.rb +5 -4
  56. data/spec/plugins/publish/google_calendar_spec.rb +5 -5
  57. data/spec/plugins/publish/hatena_bookmark_spec.rb +10 -10
  58. data/spec/plugins/publish/hipchat_spec.rb +6 -6
  59. data/spec/plugins/publish/instapaper_spec.rb +6 -6
  60. data/spec/plugins/publish/memcached_spec.rb +3 -3
  61. data/spec/plugins/publish/pocket_spec.rb +3 -3
  62. data/spec/plugins/publish/twitter_spec.rb +4 -4
  63. data/spec/plugins/store/{target_link_spec.rb → file_spec.rb} +10 -10
  64. data/spec/plugins/subscription/pocket_spec.rb +3 -3
  65. data/spec/plugins/subscription/text_spec.rb +32 -2
  66. data/spec/plugins/subscription/twitter_search_spec.rb +3 -3
  67. data/test/integration/test_fluentd.yml +1 -0
  68. data/test/integration/test_image2local.yml +6 -2
  69. data/test/integration/test_text2feed.yml +8 -0
  70. data/test/integration/test_tumblr2local.yml +6 -0
  71. metadata +26 -7
  72. data/plugins/store/target_link.rb +0 -55
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 18, 2012
5
- # Updated:: Jan 24, 2014
5
+ # Updated:: Feb 21, 2014
6
6
  # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -12,6 +12,7 @@ module Automatic
12
12
  require 'automatic/pipeline'
13
13
  require 'automatic/log'
14
14
  require 'automatic/feed_parser'
15
+ require 'automatic/feed_maker'
15
16
  require 'automatic/version'
16
17
 
17
18
  USER_DIR = "/.automatic"
@@ -0,0 +1,80 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::FeedMaker
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Feb 21, 2014
5
+ # Updated:: Feb 26, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ module Automatic
10
+ module FeedMaker
11
+ require 'rss'
12
+ require 'uri'
13
+ require 'nokogiri'
14
+
15
+ class FeedObject
16
+ attr_accessor :title, :link, :description, :author, :comments
17
+ def initialize
18
+ @link = 'http://dummy'
19
+ @title = 'dummy'
20
+ @description = ''
21
+ @author = ''
22
+ @comments = ''
23
+ end
24
+ end
25
+
26
+ def self.generate_feed(feed)
27
+ feed_object = FeedObject.new
28
+ feed_object.title = feed['title'] unless feed['title'].nil?
29
+ feed_object.link = feed['url'] unless feed['url'].nil?
30
+ feed_object.description = feed['description'] unless feed['description'].nil?
31
+ feed_object.author = feed['author'] unless feed['author'].nil?
32
+ feed_object.comments = feed['comments'] unless feed['comments'].nil?
33
+ feed_object
34
+ end
35
+
36
+ def self.create_pipeline(feeds = [])
37
+ RSS::Maker.make("2.0") {|maker|
38
+ xss = maker.xml_stylesheets.new_xml_stylesheet
39
+ maker.channel.title = "Automatic Ruby"
40
+ maker.channel.description = "Automatic::FeedMaker"
41
+ maker.channel.link = "https://github.com/automaticruby/automaticruby"
42
+ maker.items.do_sort = true
43
+
44
+ unless feeds.nil?
45
+ feeds.each {|feed|
46
+ unless feed.link.nil?
47
+ Automatic::Log.puts("info", "Create Pipeline: #{feed.link}")
48
+ item = maker.items.new_item
49
+ item.title = feed.title
50
+ item.link = feed.link
51
+ begin
52
+ item.description = feed.description
53
+ item.author = feed.author
54
+ item.comments = feed.comments
55
+ item.date = feed.pubDate || Time.now
56
+ rescue NoMethodError
57
+ Automatic::Log.puts("warn", "Undefined field detected in feed.")
58
+ end
59
+ end
60
+ }
61
+ end
62
+ }
63
+ end
64
+
65
+ def self.content_provide(url, data)
66
+ RSS::Maker.make("2.0") {|maker|
67
+ xss = maker.xml_stylesheets.new_xml_stylesheet
68
+ maker.channel.title = "Automatic Ruby"
69
+ maker.channel.description = "Automatic::FeedMaker"
70
+ maker.channel.link = "https://github.com/automaticruby/automaticruby"
71
+ maker.items.do_sort = true
72
+ item = maker.items.new_item
73
+ item.title = "Automatic Ruby"
74
+ item.link = url
75
+ item.content_encoded = data
76
+ item.date = Time.now
77
+ }
78
+ end
79
+ end
80
+ end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::FeedParser
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 19, 2012
5
- # Updated:: Jul 12, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 26, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic
@@ -12,10 +12,10 @@ module Automatic
12
12
  require 'uri'
13
13
  require 'nokogiri'
14
14
 
15
- def self.get(url)
15
+ def self.get_url(url)
16
16
  begin
17
17
  unless url.nil?
18
- Automatic::Log.puts("info", "Parsing: #{url}")
18
+ Automatic::Log.puts("info", "Parsing Feed: #{url}")
19
19
  feed = URI.parse(url).normalize
20
20
  open(feed) {|http|
21
21
  response = http.read
@@ -27,40 +27,11 @@ module Automatic
27
27
  end
28
28
  end
29
29
 
30
- def self.create(feeds = [])
30
+ def self.parse_html(html)
31
31
  RSS::Maker.make("2.0") {|maker|
32
32
  xss = maker.xml_stylesheets.new_xml_stylesheet
33
33
  maker.channel.title = "Automatic Ruby"
34
- maker.channel.description = "Automatic Ruby"
35
- maker.channel.link = "https://github.com/automaticruby/automaticruby"
36
- maker.items.do_sort = true
37
-
38
- unless feeds.nil?
39
- feeds.each {|feed|
40
- unless feed.link.nil?
41
- Automatic::Log.puts("info", "Feed: #{feed.link}")
42
- item = maker.items.new_item
43
- item.title = feed.title
44
- item.link = feed.link
45
- begin
46
- item.description = feed.description
47
- item.author = feed.author
48
- item.comments = feed.comments
49
- item.date = feed.pubDate || Time.now
50
- rescue NoMethodError
51
- Automatic::Log.puts("warn", "Undefined field detected in feed.")
52
- end
53
- end
54
- }
55
- end
56
- }
57
- end
58
-
59
- def self.parse(html)
60
- RSS::Maker.make("2.0") {|maker|
61
- xss = maker.xml_stylesheets.new_xml_stylesheet
62
- maker.channel.title = "Automatic Ruby"
63
- maker.channel.description = "Automatic Ruby"
34
+ maker.channel.description = "Automatic::FeedParser"
64
35
  maker.channel.link = "https://github.com/automaticruby/automaticruby"
65
36
  maker.items.do_sort = true
66
37
 
@@ -76,20 +47,5 @@ module Automatic
76
47
  }
77
48
  }
78
49
  end
79
-
80
- def self.content_provide(url, data)
81
- RSS::Maker.make("2.0") {|maker|
82
- xss = maker.xml_stylesheets.new_xml_stylesheet
83
- maker.channel.title = "Automatic Ruby"
84
- maker.channel.description = "Automatic Ruby"
85
- maker.channel.link = "https://github.com/automaticruby/automaticruby"
86
- maker.items.do_sort = true
87
- item = maker.items.new_item
88
- item.title = "Automatic Ruby"
89
- item.link = url
90
- item.content_encoded = data
91
- item.date = Time.now
92
- }
93
- end
94
50
  end
95
51
  end
@@ -24,7 +24,7 @@ module Automatic
24
24
  @procedure = Hashie::Mash.new(YAML.load(File.read(path)))
25
25
  log_level = @procedure.global && @procedure.global.log && @procedure.global.log.level
26
26
  Automatic::Log.level(log_level)
27
- Automatic::Log.puts("info", "Loading: #{path}")
27
+ Automatic::Log.puts("info", "Loading Recipe: #{path}")
28
28
  @procedure
29
29
  end
30
30
 
@@ -1,3 +1,3 @@
1
1
  module Automatic
2
- VERSION = "14.1.0"
2
+ VERSION = "14.2.0"
3
3
  end
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Filter::Accept
3
3
  # Author:: soramugi <http://soramugi.net>
4
+ # 774 <http://id774.net>
4
5
  # Created:: Jun 4, 2013
5
- # Updated:: Jun 4, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
9
10
  module Automatic::Plugin
@@ -22,7 +23,7 @@ module Automatic::Plugin
22
23
  new_feeds << items if contain(items) == true
23
24
  }
24
25
  end
25
- @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0
26
+ @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) if new_feeds.length > 0
26
27
  }
27
28
  @return_feeds
28
29
  end
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Filter::GithubFeed
3
3
  # Author:: Kohei Hasegawa <http://github.com/banyan>
4
- # Created:: Jun 6, 2013
5
- # Updated:: Jun 6, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
4
+ # 774 <http://id774.net>
5
+ # Created:: Jun 6, 2013
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
9
10
  module Automatic::Plugin
@@ -17,20 +18,20 @@ module Automatic::Plugin
17
18
  def run
18
19
  @return_feeds = []
19
20
  @pipeline.each {|feeds|
20
- dummyFeeds = []
21
+ new_feeds = []
21
22
  unless feeds.nil?
22
23
  feeds.items.each {|feed|
23
24
  Automatic::Log.puts("info", "Invoked: FilterGithubFeed")
24
- dummy = Hashie::Mash.new
25
- dummy.title = feed.title.content
26
- dummy.link = feed.id.content
27
- dummy.description = feed.content.content
28
- dummyFeeds << dummy
25
+ hashie = Hashie::Mash.new
26
+ hashie.title = feed.title.content
27
+ hashie.link = feed.id.content
28
+ hashie.description = feed.content.content
29
+ new_feeds << hashie
29
30
  }
30
31
  end
31
- @return_feeds << Automatic::FeedParser.create(dummyFeeds)
32
+ @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds)
32
33
  }
33
- @pipeline = @return_feeds
34
+ @return_feeds
34
35
  end
35
36
  end
36
37
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Filter::Ignore
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 22, 2012
5
- # Updated:: Oct 15, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 21, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -22,7 +22,7 @@ module Automatic::Plugin
22
22
  new_feeds << items if exclude(items) == false
23
23
  }
24
24
  end
25
- @return_feeds << Automatic::FeedParser.create(new_feeds) if new_feeds.length > 0
25
+ @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds) if new_feeds.length > 0
26
26
  }
27
27
  @return_feeds
28
28
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Filter::ImageSource
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 28, 2012
5
- # Updated:: Apr 5, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 26, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -19,24 +19,24 @@ module Automatic::Plugin
19
19
  def run
20
20
  @return_feeds = []
21
21
  @pipeline.each {|feeds|
22
- dummyFeeds = Array.new
22
+ new_feeds = Array.new
23
23
  unless feeds.nil?
24
24
  feeds.items.each {|feed|
25
25
  arr = rewrite_link(feed)
26
26
  if arr.length > 0
27
27
  arr.each {|link|
28
- Automatic::Log.puts("info", "Parsing: #{link}")
29
- dummy = Hashie::Mash.new
30
- dummy.title = 'FilterImageSource'
31
- dummy.link = link
32
- dummyFeeds << dummy
28
+ Automatic::Log.puts("info", "Extract Image: #{link}")
29
+ hashie = Hashie::Mash.new
30
+ hashie.title = 'FilterImageSource'
31
+ hashie.link = link
32
+ new_feeds << hashie
33
33
  }
34
34
  end
35
35
  }
36
36
  end
37
- @return_feeds << Automatic::FeedParser.create(dummyFeeds)
37
+ @return_feeds << Automatic::FeedMaker.create_pipeline(new_feeds)
38
38
  }
39
- @pipeline = @return_feeds
39
+ @return_feeds
40
40
  end
41
41
 
42
42
  private
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Plugin::Filter::One
3
3
  # Author:: soramugi <http://soramugi.net>
4
+ # 774 <http://id774.net>
4
5
  # Created:: May 8, 2013
5
- # Updated:: May 8, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
9
 
9
10
  module Automatic::Plugin
@@ -27,7 +28,7 @@ module Automatic::Plugin
27
28
  if item.count == 0
28
29
  item << feed.items.shift
29
30
  end
30
- @return_feeds << Automatic::FeedParser.create(item)
31
+ @return_feeds << Automatic::FeedMaker.create_pipeline(item)
31
32
  end
32
33
  }
33
34
  @return_feeds
@@ -3,8 +3,8 @@
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 6, 2013
6
- # Updated:: Mar 7, 2013
7
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
+ # Updated:: Feb 21, 2014
7
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  module Automatic::Plugin
@@ -19,7 +19,7 @@ module Automatic::Plugin
19
19
  @return_feeds = []
20
20
  @pipeline.each {|feed|
21
21
  unless feed.nil?
22
- @return_feeds << Automatic::FeedParser.create(feed.items.shuffle)
22
+ @return_feeds << Automatic::FeedMaker.create_pipeline(feed.items.shuffle)
23
23
  end
24
24
  }
25
25
  @return_feeds
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Filter::Sanitize
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jun 20, 2013
5
- # Updated:: Jun 24, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 21, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -26,7 +26,6 @@ module Automatic::Plugin
26
26
  def run
27
27
  @return_feeds = []
28
28
  @pipeline.each {|feeds|
29
- return_feed_items = []
30
29
  unless feeds.nil?
31
30
  feeds.items.each {|feed|
32
31
  feed = sanitize(feed)
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Provide::Fluentd
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Jul 12, 2013
5
- # Updated:: Jul 12, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Feb 25, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic::Plugin
@@ -14,9 +14,10 @@ module Automatic::Plugin
14
14
  def initialize(config, pipeline=[])
15
15
  @config = config
16
16
  @pipeline = pipeline
17
+ @mode = @config['mode']
17
18
  @fluentd = Fluent::Logger::FluentLogger.open(nil,
18
19
  host = @config['host'],
19
- port = @config['port'])
20
+ port = @config['port']) unless @mode == 'test'
20
21
  end
21
22
 
22
23
  def run
@@ -24,7 +25,7 @@ module Automatic::Plugin
24
25
  unless feeds.nil?
25
26
  feeds.items.each {|feed|
26
27
  begin
27
- @fluentd.post(@config['tag'], feed.content_encoded)
28
+ @fluentd.post(@config['tag'], feed.content_encoded) unless @mode == 'test'
28
29
  rescue
29
30
  Automatic::Log.puts("error", "Fluent::Logger.post failed, the content_encoded of item may be not kind of Hash.")
30
31
  end
@@ -0,0 +1,58 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Publish::AmazonS3
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Feb 24, 2014
5
+ # Updated:: Feb 24, 2014
6
+ # Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ module Automatic::Plugin
10
+ class PublishAmazonS3
11
+ require 'uri'
12
+ require 'aws-sdk'
13
+
14
+ def initialize(config, pipeline=[])
15
+ @config = config
16
+ @pipeline = pipeline
17
+ s3 = AWS::S3.new(
18
+ :access_key_id => @config['access_key'],
19
+ :secret_access_key => @config['secret_key']
20
+ )
21
+ @bucket = s3.buckets[@config['bucket_name']]
22
+ @mode = @config['mode']
23
+ end
24
+
25
+ def run
26
+ @pipeline.each {|feeds|
27
+ unless feeds.nil?
28
+ feeds.items.each {|feed|
29
+ unless feed.link.nil?
30
+ begin
31
+ uri = URI.parse(feed.link)
32
+ if uri.scheme == 'file'
33
+ upload_amazons3(uri.path, @config['target_path'])
34
+ else
35
+ Automatic::Log.puts("warn", "Skip feed due to uri scheme is not file.")
36
+ end
37
+ rescue
38
+ Automatic::Log.puts("error", "Error detected with #{feed.link} in uploading AmazonS3.")
39
+ end
40
+ end
41
+ }
42
+ end
43
+ }
44
+ @pipeline
45
+ end
46
+
47
+ private
48
+
49
+ def upload_amazons3(filename, target_path)
50
+ target = File.join(target_path, File.basename(filename))
51
+ object = @bucket.objects[target]
52
+ source = Pathname.new(filename)
53
+ object.write(source) unless @mode == "test"
54
+ Automatic::Log.puts("info", "Uploaded: file #{source} to the bucket #{target} on #{@bucket.name}.")
55
+ return source, target
56
+ end
57
+ end
58
+ end