automatic 13.12.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Pocket
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # Created:: May 21, 2013
5
- # Updated:: May 21, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Jan 15, 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,14 +22,15 @@ module Automatic::Plugin
22
22
 
23
23
  def run
24
24
  retries = 0
25
+ retry_max = @config['retry'].to_i || 0
25
26
  begin
26
27
  dummyfeeds = cleate_dummy_feed(@client.retrieve(@config['optional']))
27
28
  @pipeline << Automatic::FeedParser.create(dummyfeeds)
28
29
  rescue
29
30
  retries += 1
30
31
  Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
31
- sleep @config['interval'].to_i unless @config['interval'].nil?
32
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
32
+ sleep ||= @config['interval'].to_i
33
+ retry if retries <= retry_max
33
34
  end
34
35
  @pipeline
35
36
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Tumblr
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Oct 16, 2012
5
- # Updated:: Apr 5, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Jan 15, 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,6 +19,7 @@ module Automatic::Plugin
19
19
  @return_feeds = []
20
20
  @config['urls'].each {|url|
21
21
  retries = 0
22
+ retry_max = @config['retry'].to_i || 0
22
23
  begin
23
24
  create_rss(url)
24
25
  unless @config['pages'].nil?
@@ -32,8 +33,8 @@ module Automatic::Plugin
32
33
  rescue
33
34
  retries += 1
34
35
  Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
35
- sleep @config['interval'].to_i unless @config['interval'].nil?
36
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
36
+ sleep ||= @config['interval'].to_i
37
+ retry if retries <= retry_max
37
38
  end
38
39
  }
39
40
  @return_feeds
@@ -51,7 +52,7 @@ module Automatic::Plugin
51
52
  item.link = nil
52
53
  end
53
54
  }
54
- sleep @config['interval'].to_i unless @config['interval'].nil?
55
+ sleep ||= @config['interval'].to_i
55
56
  @return_feeds << rss
56
57
  end
57
58
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Twitter
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 9, 2012
5
- # Updated:: Apr 5, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Jan 15, 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
@@ -21,19 +21,21 @@ module Automatic::Plugin
21
21
  @return_feeds = []
22
22
  @config['urls'].each {|url|
23
23
  retries = 0
24
+ retry_max = @config['retry'].to_i || 0
24
25
  begin
25
26
  create_rss(url)
26
27
  rescue
27
28
  retries += 1
28
29
  Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
29
- sleep @config['interval'].to_i unless @config['interval'].nil?
30
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
30
+ sleep ||= @config['interval'].to_i
31
+ retry if retries <= retry_max
31
32
  end
32
33
  }
33
34
  @return_feeds
34
35
  end
35
36
 
36
37
  private
38
+
37
39
  def create_rss(url)
38
40
  Automatic::Log.puts("info", "Parsing: #{url}")
39
41
  html = open(url).read
@@ -59,7 +61,7 @@ module Automatic::Plugin
59
61
  item.description = content.search('[@class="js-tweet-text"]').text.to_s
60
62
  }
61
63
  }
62
- sleep @config['interval'].to_i unless @config['interval'].nil?
64
+ sleep ||= @config['interval'].to_i
63
65
  @return_feeds << rss
64
66
  end
65
67
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Subscription::TwitterSearch
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # Created:: May 30, 2013
5
- # Updated:: May 30, 2013
6
- # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
5
+ # Updated:: Jan 15, 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
@@ -24,6 +24,7 @@ module Automatic::Plugin
24
24
  def run
25
25
  @pipeline = []
26
26
  retries = 0
27
+ retry_max = @config['retry'].to_i || 0
27
28
  begin
28
29
  feeds = []
29
30
  @client.search(@config['search'],@config['opt']).results.each do |status|
@@ -41,8 +42,8 @@ module Automatic::Plugin
41
42
  rescue
42
43
  retries += 1
43
44
  Automatic::Log.puts("error", "ErrorCount: #{retries}")
44
- sleep @config['interval'].to_i unless @config['interval'].nil?
45
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
45
+ sleep ||= @config['interval'].to_i
46
+ retry if retries <= retry_max
46
47
  end
47
48
  @pipeline
48
49
  end
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Xml
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:: Jan 15, 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,13 +22,14 @@ module Automatic::Plugin
22
22
  @return_feeds = []
23
23
  @config['urls'].each {|url|
24
24
  retries = 0
25
+ retry_max = @config['retry'].to_i || 0
25
26
  begin
26
27
  create_rss(URI.encode(url))
27
28
  rescue
28
29
  retries += 1
29
30
  Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
30
- sleep @config['interval'].to_i unless @config['interval'].nil?
31
- retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
31
+ sleep ||= @config['interval'].to_i
32
+ retry if retries <= retry_max
32
33
  end
33
34
  }
34
35
  @return_feeds
@@ -42,7 +43,7 @@ module Automatic::Plugin
42
43
  data = ActiveSupport::JSON.decode(json)
43
44
  unless data.nil?
44
45
  rss = Automatic::FeedParser.content_provide(url, data)
45
- sleep @config['interval'].to_i unless @config['interval'].nil?
46
+ sleep ||= @config['interval'].to_i
46
47
  @return_feeds << rss
47
48
  end
48
49
  end
@@ -20,14 +20,19 @@ describe Automatic::Recipe do
20
20
  Automatic.user_dir = nil
21
21
  end
22
22
 
23
- describe "with a normal recipe" do
24
- it "correctly load recipe" do
23
+ context "with a normal recipe" do
24
+ subject {
25
25
  recipe = Automatic::Recipe.new(TEST_RECIPE)
26
- expect =[{"module"=>"SubscriptionFeed",
27
- "config"=>{"feeds"=>["http://blog.id774.net/post/feed/"]}},
28
- {"module"=>"FilterIgnore", "config"=>{"link"=>["hoge"]}},
29
- {"module"=>"StorePermalink", "config"=>{"db"=>"test_permalink.db"}}]
30
- recipe.each_plugin{recipe}.should == expect
26
+ recipe.each_plugin{recipe}
27
+ }
28
+ let(:expected) { [{"module"=>"SubscriptionFeed",
29
+ "config"=>{"feeds"=>["http://blog.id774.net/post/feed/"]}},
30
+ {"module"=>"FilterIgnore", "config"=>{"link"=>["hoge"]}},
31
+ {"module"=>"StorePermalink", "config"=>{"db"=>"test_permalink.db"}}]
32
+ }
33
+
34
+ it "correctly load recipe" do
35
+ expect(subject).to eq expected
31
36
  end
32
37
  end
33
38
 
@@ -3,7 +3,7 @@
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 9, 2012
6
- # Updated:: Dec 17, 2013
6
+ # Updated:: Jan 24, 2014
7
7
  # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
@@ -27,7 +27,7 @@ describe Automatic do
27
27
  describe "#version" do
28
28
  subject { Automatic.const_get(:VERSION) }
29
29
 
30
- it { expect(subject).to eq "13.12.0" }
30
+ it { expect(subject).to eq "14.1.0" }
31
31
  end
32
32
 
33
33
  describe "#(root)_dir" do
@@ -19,6 +19,8 @@ plugins:
19
19
  config:
20
20
  consumer_key: consumer_key
21
21
  access_token: access_token
22
+ interval: 2
23
+ retry: 2
22
24
 
23
25
  #- module: PublishConsole
24
26
 
@@ -8,8 +8,10 @@ global:
8
8
  plugins:
9
9
  - module: SubscriptionChanToru
10
10
  config:
11
- keyword: 'アニメ'
12
- station: '地上波'
11
+ keyword: 'アニメ'
12
+ station: '地上波'
13
+ interval: 2
14
+ retry: 2
13
15
 
14
16
  - module: StorePermalink
15
17
  config:
@@ -23,7 +23,7 @@ plugins:
23
23
  config:
24
24
  path: /tmp
25
25
  retry: 2
26
- interval: 4
26
+ interval: 2
27
27
 
28
28
  #- module: PublishConsole
29
29
 
@@ -19,7 +19,8 @@ plugins:
19
19
  config:
20
20
  email: your_email
21
21
  password: your_pass
22
- interval: 5
22
+ interval: 2
23
+ retry: 2
23
24
 
24
25
  #- module: PublishConsole
25
26
 
@@ -21,8 +21,8 @@ plugins:
21
21
  config:
22
22
  urls:
23
23
  - http://reblog.id774.net
24
- interval: 5
25
- retry: 5
24
+ interval: 2
25
+ retry: 2
26
26
 
27
27
  - module: FilterImage
28
28
 
@@ -11,7 +11,7 @@ plugins:
11
11
  consumer_key: 'consumer_key'
12
12
  access_token: 'access_token'
13
13
  optional:
14
- favorite: 1
14
+ favorite: 3
15
15
  count: 2
16
16
 
17
17
  - module: StorePermalink
@@ -20,4 +20,3 @@ plugins:
20
20
 
21
21
  #- module: PublishConsole
22
22
 
23
-
@@ -21,8 +21,8 @@ plugins:
21
21
  config:
22
22
  feeds:
23
23
  - http://blog.id774.net/post/feed/
24
- interval: 5
25
- retry: 5
24
+ interval: 2
25
+ retry: 2
26
26
 
27
27
  - module: FilterSort
28
28
  config:
@@ -24,8 +24,8 @@ plugins:
24
24
  urls:
25
25
  - http://reblog.id774.net
26
26
  pages: 1
27
- interval: 5
28
- retry: 5
27
+ interval: 2
28
+ retry: 2
29
29
 
30
30
  - module: FilterImage
31
31