automatic 13.5.0 → 13.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Gemfile +11 -5
  2. data/README.md +4 -6
  3. data/VERSION +1 -1
  4. data/automatic.gemspec +61 -18
  5. data/doc/ChangeLog +25 -0
  6. data/doc/PLUGINS +202 -12
  7. data/doc/PLUGINS.ja +221 -30
  8. data/doc/README +1 -1
  9. data/doc/README.ja +1 -1
  10. data/lib/automatic.rb +3 -3
  11. data/lib/automatic/feed_parser.rb +2 -2
  12. data/lib/automatic/log.rb +12 -2
  13. data/lib/automatic/pipeline.rb +1 -1
  14. data/lib/automatic/recipe.rb +5 -2
  15. data/plugins/custom_feed/svn_log.rb +3 -3
  16. data/plugins/filter/absolute_uri.rb +8 -4
  17. data/plugins/filter/accept.rb +61 -0
  18. data/plugins/filter/full_feed.rb +4 -5
  19. data/plugins/filter/github_feed.rb +36 -0
  20. data/plugins/filter/ignore.rb +1 -1
  21. data/plugins/filter/image.rb +1 -1
  22. data/plugins/filter/image_source.rb +34 -10
  23. data/plugins/filter/one.rb +1 -1
  24. data/plugins/filter/rand.rb +1 -1
  25. data/plugins/filter/sanitize.rb +50 -0
  26. data/plugins/filter/sort.rb +1 -1
  27. data/plugins/filter/tumblr_resize.rb +1 -1
  28. data/plugins/publish/console.rb +3 -3
  29. data/plugins/publish/console_link.rb +30 -0
  30. data/plugins/publish/eject.rb +42 -0
  31. data/plugins/publish/fluentd.rb +42 -0
  32. data/plugins/publish/google_calendar.rb +3 -3
  33. data/plugins/publish/hatena_bookmark.rb +1 -1
  34. data/plugins/publish/hipchat.rb +45 -0
  35. data/plugins/publish/instapaper.rb +2 -1
  36. data/plugins/publish/memcached.rb +44 -0
  37. data/plugins/publish/pocket.rb +1 -1
  38. data/plugins/publish/twitter.rb +1 -1
  39. data/plugins/store/database.rb +3 -3
  40. data/plugins/store/full_text.rb +2 -2
  41. data/plugins/store/permalink.rb +1 -1
  42. data/plugins/store/target_link.rb +3 -2
  43. data/plugins/subscription/chan_toru.rb +56 -0
  44. data/plugins/subscription/feed.rb +1 -1
  45. data/plugins/subscription/g_guide.rb +48 -0
  46. data/plugins/subscription/google_reader_star.rb +3 -3
  47. data/plugins/subscription/link.rb +2 -2
  48. data/plugins/subscription/pocket.rb +49 -0
  49. data/plugins/subscription/text.rb +3 -12
  50. data/plugins/subscription/tumblr.rb +7 -1
  51. data/plugins/subscription/twitter.rb +1 -1
  52. data/plugins/subscription/twitter_search.rb +50 -0
  53. data/plugins/subscription/weather.rb +7 -41
  54. data/script/build +3 -0
  55. data/spec/fixtures/sampleRecipe.yml +1 -1
  56. data/spec/lib/automatic/log_spec.rb +31 -0
  57. data/spec/lib/automatic/pipeline_spec.rb +1 -1
  58. data/spec/lib/automatic/recipe_spec.rb +1 -1
  59. data/spec/lib/automatic_spec.rb +3 -3
  60. data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
  61. data/spec/plugins/filter/absolute_uri_spec.rb +1 -1
  62. data/spec/plugins/filter/accept_spec.rb +331 -0
  63. data/spec/plugins/filter/full_feed_spec.rb +4 -6
  64. data/spec/plugins/filter/github_feed_spec.rb +54 -0
  65. data/spec/plugins/filter/ignore_spec.rb +1 -1
  66. data/spec/plugins/filter/image_source_spec.rb +17 -3
  67. data/spec/plugins/filter/image_spec.rb +1 -1
  68. data/spec/plugins/filter/one_spec.rb +1 -1
  69. data/spec/plugins/filter/rand_spec.rb +1 -1
  70. data/spec/plugins/filter/sanitize_spec.rb +153 -0
  71. data/spec/plugins/filter/sort_spec.rb +1 -1
  72. data/spec/plugins/filter/tumblr_resize_spec.rb +1 -1
  73. data/spec/plugins/notify/ikachan_spec.rb +1 -1
  74. data/spec/plugins/publish/console_spec.rb +1 -1
  75. data/spec/plugins/publish/eject_spec.rb +40 -0
  76. data/spec/plugins/publish/fluentd_spec.rb +39 -0
  77. data/spec/plugins/publish/google_calendar_spec.rb +1 -1
  78. data/spec/plugins/publish/hatena_bookmark_spec.rb +1 -1
  79. data/spec/plugins/publish/hipchat_spec.rb +69 -0
  80. data/spec/plugins/publish/instapaper_spec.rb +42 -28
  81. data/spec/plugins/publish/memcached_spec.rb +63 -0
  82. data/spec/plugins/publish/pocket_spec.rb +33 -33
  83. data/spec/plugins/publish/twitter_spec.rb +57 -19
  84. data/spec/plugins/store/full_text_spec.rb +6 -1
  85. data/spec/plugins/store/permalink_spec.rb +18 -19
  86. data/spec/plugins/store/target_link_spec.rb +1 -1
  87. data/spec/plugins/subscription/chan_toru_spec.rb +56 -0
  88. data/spec/plugins/subscription/feed_spec.rb +1 -1
  89. data/spec/plugins/subscription/g_guide_spec.rb +76 -0
  90. data/spec/plugins/subscription/google_reader_star_spec.rb +1 -1
  91. data/spec/plugins/subscription/link_spec.rb +1 -1
  92. data/spec/plugins/subscription/pocket_spec.rb +57 -0
  93. data/spec/plugins/subscription/text_spec.rb +1 -14
  94. data/spec/plugins/subscription/tumblr_spec.rb +3 -2
  95. data/spec/plugins/subscription/twitter_search_spec.rb +57 -0
  96. data/spec/plugins/subscription/twitter_spec.rb +3 -2
  97. data/spec/plugins/subscription/weather_spec.rb +2 -15
  98. data/spec/spec_helper.rb +1 -0
  99. data/test/integration/test_chan_toru.yml +19 -0
  100. data/test/integration/test_fluentd.yml +20 -0
  101. data/test/integration/test_pocket.yml +21 -0
  102. data/test/integration/test_sanitize.yml +22 -0
  103. data/test/integration/test_twitter_search.yml +21 -0
  104. metadata +145 -24
  105. data/plugins/publish/mail.rb +0 -64
  106. data/plugins/publish/smtp.rb +0 -48
  107. data/spec/plugins/publish/mail_spec.rb +0 -53
  108. data/spec/plugins/publish/smtp_spec.rb +0 -49
@@ -4,7 +4,7 @@
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Mar 4, 2012
6
6
  # Updated:: May 1, 2013
7
- # Copyright:: kzgs Copyright (c) 2012-2013
7
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::ChanToru
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: Jun 28, 2013
5
+ # Updated:: Jun 28, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'subscription/chan_toru'
12
+
13
+ def chan_toru(config = {}, pipeline = [])
14
+ Automatic::Plugin::SubscriptionChanToru.new(config,pipeline)
15
+ end
16
+
17
+ describe 'Automatic::Plugin::SubscriptionChanToru' do
18
+ context 'when feed is empty' do
19
+ describe 'attestation error' do
20
+ subject { chan_toru }
21
+ before do
22
+ subject.should_receive(:g_guide_pipeline).times.and_return([])
23
+ end
24
+ its(:run) { should be_empty }
25
+ end
26
+
27
+ describe 'interval & retry was used error' do
28
+ config = {'interval' => 1, 'retry' => 1}
29
+ subject { chan_toru(config) }
30
+ before do
31
+ subject.
32
+ should_receive(:g_guide_pipeline).
33
+ exactly(2).
34
+ times.and_return('')
35
+ end
36
+ its(:run) { should be_empty }
37
+ end
38
+ end
39
+
40
+ context 'when feed' do
41
+ describe 'config keyword' do
42
+ subject { chan_toru }
43
+ before do
44
+ pipeline = AutomaticSpec.generate_pipeline {
45
+ feed {
46
+ item "http://soramugi.net/images/hugehuge"
47
+ item "http://tv.so-net.ne.jp/schedule/500333201307052330.action?from=rss"
48
+ }}
49
+ subject.
50
+ should_receive(:g_guide_pipeline).
51
+ times.and_return(pipeline)
52
+ end
53
+ its(:run) { should have(1).feed }
54
+ end
55
+ end
56
+ end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::Subscription::Feed
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Updated:: Feb 8, 2013
5
- # Copyright:: 774 Copyright (c) 2012-2013
5
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
6
6
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
7
 
8
8
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -0,0 +1,76 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::GGuide
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: Jun 28, 2013
5
+ # Updated:: Jun 28, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'subscription/g_guide'
12
+
13
+ def g_guide(config = {}, pipeline = [])
14
+ Automatic::Plugin::SubscriptionGGuide.new(config,pipeline)
15
+ end
16
+
17
+ describe 'Automatic::Plugin::SubscriptionGGuide' do
18
+ context 'when config' do
19
+ describe 'is empty' do
20
+ subject { g_guide }
21
+
22
+ its(:feed_url) {
23
+ should == Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS +
24
+ 'stationPlatformId=0&'
25
+ }
26
+ end
27
+ describe 'keyword is anime' do
28
+ config = { 'keyword' => 'anime' }
29
+ subject { g_guide(config) }
30
+
31
+ its(:feed_url) {
32
+ should == URI.encode(
33
+ Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS +
34
+ "condition.keyword=#{config['keyword']}&" +
35
+ 'stationPlatformId=0&')
36
+ }
37
+ end
38
+ describe 'station is 地上波' do
39
+ config = { 'station' => '地上波' }
40
+ subject { g_guide(config) }
41
+
42
+ its(:feed_url) {
43
+ should == URI.encode(
44
+ Automatic::Plugin::SubscriptionGGuide::G_GUIDE_RSS +
45
+ 'stationPlatformId=1&')
46
+ }
47
+ end
48
+ end
49
+
50
+ context 'when feed is empty' do
51
+ describe 'attestation error' do
52
+ subject { g_guide }
53
+ before do
54
+ subject.should_receive(:feed_url).and_return('')
55
+ end
56
+ its(:run) { should be_empty }
57
+ end
58
+
59
+ describe 'interval & retry was used error' do
60
+ config = {'interval' => 1, 'retry' => 1}
61
+ subject { g_guide(config) }
62
+ before do
63
+ subject.should_receive(:feed_url).exactly(2).times.and_return('')
64
+ end
65
+ its(:run) { should be_empty }
66
+ end
67
+ end
68
+
69
+ context 'when feed' do
70
+ describe 'config keyword' do
71
+ config = { 'keyword' => 'アニメ', 'station' => '地上波' }
72
+ subject { g_guide(config) }
73
+ its(:run) { should have(1).feed }
74
+ end
75
+ end
76
+ end
@@ -4,7 +4,7 @@
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Feb 10, 2013
6
6
  # Updated:: Feb 17, 2013
7
- # Copyright:: soramugi Copyright (c) 2013
7
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 18, 2012
5
5
  # Updated:: Feb 8, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::Pocket
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: May 21, 2013
5
+ # Updated:: May 21, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'subscription/pocket'
12
+
13
+ def pocket(config = {}, pipeline = [])
14
+ Automatic::Plugin::SubscriptionPocket.new(config,pipeline)
15
+ end
16
+
17
+ describe 'Automatic::Plugin::SubscriptionPocket' do
18
+ context 'when feed is empty' do
19
+ describe 'attestation error' do
20
+ subject { pocket }
21
+
22
+ its(:run) { should be_empty }
23
+ end
24
+
25
+ describe 'interval & retry was used error' do
26
+ config = {'interval' => 1, 'retry' => 1}
27
+ subject { pocket(config) }
28
+
29
+ its(:run) { should be_empty }
30
+ end
31
+ end
32
+
33
+ context 'when feed' do
34
+ describe 'config optional' do
35
+ config = { 'optional' => {
36
+ 'count' => 1,
37
+ 'favorite' => 1
38
+ }}
39
+ subject { pocket(config) }
40
+ before do
41
+ retrieve = {'list' => {
42
+ 'id' => {
43
+ 'given_url' => 'http://github.com',
44
+ 'given_title' => 'GitHub',
45
+ 'excerpt' => 'github'
46
+ }}}
47
+ client = mock("client")
48
+ client.should_receive(:retrieve).
49
+ with(config['optional']).
50
+ and_return(retrieve)
51
+ subject.instance_variable_set(:@client, client)
52
+ end
53
+
54
+ its(:run) { should have(1).item }
55
+ end
56
+ end
57
+ end
@@ -3,7 +3,7 @@
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # Created:: May 6, 2013
5
5
  # Updated:: May 6, 2013
6
- # Copyright:: soramugi Copyright (c) 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -51,17 +51,4 @@ describe Automatic::Plugin::SubscriptionText do
51
51
  its(:run) { should have(1).feed }
52
52
  end
53
53
 
54
- context "with retry to feeds whose invalid URL" do
55
- subject {
56
- Automatic::Plugin::SubscriptionText.new(
57
- { 'titles' => [],
58
- 'retry' => 1,
59
- 'interval' => 1
60
- }
61
- )
62
- }
63
-
64
- its(:run) { should be_empty }
65
- end
66
-
67
54
  end
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Oct 16, 2012
5
5
  # Updated:: Feb 8, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -14,7 +14,8 @@ describe Automatic::Plugin::SubscriptionTumblr do
14
14
  context "with empty URLs" do
15
15
  subject {
16
16
  Automatic::Plugin::SubscriptionTumblr.new(
17
- { 'urls' => [] })
17
+ { 'urls' => [] }
18
+ )
18
19
  }
19
20
 
20
21
  its(:run) { should be_empty }
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::TwitterSearch
3
+ # Author:: soramugi <http://soramugi.net>
4
+ # Created:: May 30, 2013
5
+ # Updated:: May 30, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
10
+
11
+ require 'subscription/twitter_search'
12
+
13
+ def twitter_search(config = {}, pipeline = [])
14
+ Automatic::Plugin::SubscriptionTwitterSearch.new(config,pipeline)
15
+ end
16
+
17
+ describe 'Automatic::Plugin::SubscriptionTwitterSearch' do
18
+ context 'when feed is empty' do
19
+
20
+ describe 'attestation error' do
21
+ subject { twitter_search }
22
+
23
+ its(:run) { should be_empty }
24
+ end
25
+
26
+ describe 'interval & retry was used error' do
27
+ config = {'interval' => 1, 'retry' => 1}
28
+ subject { twitter_search(config) }
29
+
30
+ its(:run) { should be_empty }
31
+ end
32
+
33
+ end
34
+
35
+ context 'when feed' do
36
+ describe 'config optional' do
37
+ config = { 'search' => 'ruby', 'opt' => { 'lang' => 'ja', 'count' => 1 }}
38
+ subject { twitter_search(config) }
39
+ before do
40
+ status = Hashie::Mash.new
41
+ status.user = {'screen_name' => 'soramugi'}
42
+ status.id = 12345
43
+ status.text = 'twitter_search rspec'
44
+ status.created_at = Time.now
45
+ search = Hashie::Mash.new
46
+ search.results = [status]
47
+ client = mock("client")
48
+ client.should_receive(:search)
49
+ .with(config['search'],config['opt'])
50
+ .and_return(search)
51
+ subject.instance_variable_set(:@client, client)
52
+ end
53
+
54
+ its(:run) { should have(1).item }
55
+ end
56
+ end
57
+ end
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Sep 10, 2012
5
5
  # Updated:: Feb 8, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -14,7 +14,8 @@ describe Automatic::Plugin::SubscriptionTwitter do
14
14
  context "with empty URLs" do
15
15
  subject {
16
16
  Automatic::Plugin::SubscriptionTwitter.new(
17
- { 'urls' => [] })
17
+ { 'urls' => [] }
18
+ )
18
19
  }
19
20
 
20
21
  its(:run) { should be_empty }
@@ -3,7 +3,7 @@
3
3
  # Author:: soramugi <http://soramugi.net>
4
4
  # Created:: May 12, 2013
5
5
  # Updated:: May 12, 2013
6
- # Copyright:: soramugi Copyright (c) 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
@@ -14,7 +14,7 @@ describe Automatic::Plugin::SubscriptionWeather do
14
14
  context "with empty zipcode" do
15
15
  subject {
16
16
  Automatic::Plugin::SubscriptionWeather.new(
17
- { }
17
+ {}
18
18
  )
19
19
  }
20
20
 
@@ -41,17 +41,4 @@ describe Automatic::Plugin::SubscriptionWeather do
41
41
  its(:run) { should have(1).feed }
42
42
  end
43
43
 
44
- context "with retry to feeds whose invalid URL" do
45
- subject {
46
- Automatic::Plugin::SubscriptionWeather.new(
47
- { 'zipcode' => [],
48
- 'retry' => 1,
49
- 'interval' => 1
50
- }
51
- )
52
- }
53
-
54
- its(:run) { should be_empty }
55
- end
56
-
57
44
  end
@@ -23,6 +23,7 @@ if ENV['COVERAGE'] == 'on'
23
23
  end
24
24
 
25
25
  require 'lib/automatic'
26
+ Automatic::Log.level('none')
26
27
 
27
28
  # Requires supporting files with custom matchers and macros, etc,
28
29
  # in ./support/ and its subdirectories.
@@ -0,0 +1,19 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: none
7
+
8
+ plugins:
9
+ - module: SubscriptionChanToru
10
+ config:
11
+ keyword: 'アニメ'
12
+ station: '地上波'
13
+
14
+ - module: StorePermalink
15
+ config:
16
+ db: test_chan_toru.db
17
+
18
+ #- module: PublishConsoleLink
19
+
@@ -0,0 +1,20 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://blog.id774.net/post/feed/
13
+
14
+ - module: PublishFluentd
15
+ config:
16
+ host: localhost
17
+ port: 9999
18
+ tag: automatic.feed
19
+
20
+ # - module: PublishConsole
@@ -0,0 +1,21 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: warn
7
+
8
+ plugins:
9
+ - module: SubscriptionPocket
10
+ config:
11
+ consumer_key: 'consumer_key'
12
+ access_token: 'access_token'
13
+ optional:
14
+ favorite: 1
15
+ count: 2
16
+
17
+ - module: StorePermalink
18
+ config:
19
+ db: test_pocket.db
20
+
21
+ #- module: PublishConsole