automatic 12.6.0 → 12.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/VERSION +1 -1
  2. data/automatic.gemspec +10 -22
  3. data/bin/automatic-config +4 -4
  4. data/doc/ChangeLog +30 -1
  5. data/doc/PLUGINS +46 -178
  6. data/doc/PLUGINS.ja +46 -177
  7. data/doc/README +2 -10
  8. data/doc/README.ja +2 -9
  9. data/lib/automatic.rb +2 -3
  10. data/plugins/custom_feed/svn_log.rb +0 -1
  11. data/plugins/filter/absolute_uri.rb +39 -0
  12. data/plugins/filter/image.rb +46 -0
  13. data/plugins/filter/reverse.rb +0 -1
  14. data/plugins/store/database.rb +8 -23
  15. data/plugins/store/full_text.rb +4 -4
  16. data/plugins/store/permalink.rb +12 -9
  17. data/plugins/store/target_link.rb +3 -2
  18. data/plugins/subscription/link.rb +55 -0
  19. data/plugins/subscription/twitter.rb +57 -0
  20. data/script/build +1 -1
  21. data/spec/lib/automatic_spec.rb +3 -2
  22. data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
  23. data/spec/plugins/filter/absolute_uri_spec.rb +61 -0
  24. data/spec/plugins/filter/image_source_spec.rb +1 -1
  25. data/spec/plugins/filter/image_spec.rb +65 -0
  26. data/spec/plugins/publish/google_calendar_spec.rb +1 -1
  27. data/spec/plugins/store/full_text_spec.rb +0 -1
  28. data/spec/plugins/store/permalink_spec.rb +52 -3
  29. data/spec/plugins/store/target_link_spec.rb +1 -2
  30. data/spec/plugins/subscription/feed_spec.rb +0 -1
  31. data/spec/plugins/subscription/{uri_spec.rb → link_spec.rb} +9 -10
  32. data/spec/plugins/subscription/twitter_spec.rb +42 -0
  33. data/spec/spec_helper.rb +12 -26
  34. data/spec/user_dir/plugins/store/mock.rb +1 -1
  35. data/test/integration/test_get_image.yml +4 -6
  36. data/test/integration/test_image2local.yml +1 -1
  37. metadata +10 -22
  38. data/config/html2console.yml +0 -16
  39. data/plugins/extract/link.rb +0 -32
  40. data/plugins/filter/image_link.rb +0 -37
  41. data/plugins/publish/dump.rb +0 -24
  42. data/plugins/store/link.rb +0 -47
  43. data/plugins/store/target.rb +0 -41
  44. data/plugins/subscription/uri.rb +0 -31
  45. data/spec/fixtures/extractLink.html +0 -14
  46. data/spec/fixtures/filterImageLink.html +0 -34
  47. data/spec/fixtures/publishDump.html +0 -14
  48. data/spec/fixtures/storeLink.html +0 -34
  49. data/spec/fixtures/storeLink2.html +0 -36
  50. data/spec/fixtures/storeTarget.html +0 -11
  51. data/spec/fixtures/storeTarget2.html +0 -11
  52. data/spec/plugins/extract/link_spec.rb +0 -38
  53. data/spec/plugins/filter/image_link_spec.rb +0 -51
  54. data/spec/plugins/publish/dump_spec.rb +0 -32
  55. data/spec/plugins/store/link_spec.rb +0 -47
  56. data/spec/plugins/store/target_spec.rb +0 -41
@@ -0,0 +1,65 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Filter::Image
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Sep 18, 2012
5
+ # Updated:: Sep 18, 2012
6
+ # Copyright:: 774 Copyright (c) 2012
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 'filter/image'
12
+
13
+ describe Automatic::Plugin::FilterImage do
14
+ context "with feed contain link tag" do
15
+ subject {
16
+ Automatic::Plugin::FilterImage.new({},
17
+ AutomaticSpec.generate_pipeline {
18
+ feed {
19
+ item "http://id774.net/images/link_1.jpg"
20
+ item "http://id774.net/images/link_2.jpg"
21
+ item "http://id774.net/images/link_3.JPG"
22
+ item "http://id774.net/images/link_4.png"
23
+ item "http://id774.net/images/link_5.jpeg"
24
+ item "http://id774.net/images/link_6.PNG"
25
+ item "http://id774.net/images/link_7.jpega"
26
+ item "http://id774.net/images/link_8.gif"
27
+ item "http://id774.net/images/link_9.GIF"
28
+ item "http://id774.net/images/link_10.tiff"
29
+ item nil
30
+ item "http://id774.net/images/link_11.TIFF"
31
+ }})}
32
+
33
+ describe "#run" do
34
+ its(:run) { should have(1).feeds }
35
+
36
+ specify {
37
+ subject.run
38
+ subject.instance_variable_get(:@return_feeds)[0].items[0].link.
39
+ should == "http://id774.net/images/link_1.jpg"
40
+ subject.instance_variable_get(:@return_feeds)[0].items[1].link.
41
+ should == "http://id774.net/images/link_2.jpg"
42
+ subject.instance_variable_get(:@return_feeds)[0].items[2].link.
43
+ should == "http://id774.net/images/link_3.JPG"
44
+ subject.instance_variable_get(:@return_feeds)[0].items[3].link.
45
+ should == "http://id774.net/images/link_4.png"
46
+ subject.instance_variable_get(:@return_feeds)[0].items[4].link.
47
+ should == "http://id774.net/images/link_5.jpeg"
48
+ subject.instance_variable_get(:@return_feeds)[0].items[5].link.
49
+ should == "http://id774.net/images/link_6.PNG"
50
+ subject.instance_variable_get(:@return_feeds)[0].items[6].link.
51
+ should be_nil
52
+ subject.instance_variable_get(:@return_feeds)[0].items[7].link.
53
+ should == "http://id774.net/images/link_8.gif"
54
+ subject.instance_variable_get(:@return_feeds)[0].items[8].link.
55
+ should == "http://id774.net/images/link_9.GIF"
56
+ subject.instance_variable_get(:@return_feeds)[0].items[9].link.
57
+ should == "http://id774.net/images/link_10.tiff"
58
+ subject.instance_variable_get(:@return_feeds)[0].items[10].link.
59
+ should be_nil
60
+ subject.instance_variable_get(:@return_feeds)[0].items[11].link.
61
+ should == "http://id774.net/images/link_11.TIFF"
62
+ }
63
+ end
64
+ end
65
+ end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::CustomFeed::SVNFLog
3
3
  # Author:: kzgs
4
4
  # Created:: Feb 26, 2012
5
- # Updated:: Mar 3, 2012
5
+ # Updated:: Mar 3, 2012
6
6
  # Copyright:: kzgs Copyright (c) 2012
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -8,7 +8,6 @@
8
8
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
9
9
 
10
10
  require 'store/full_text'
11
-
12
11
  require 'pathname'
13
12
 
14
13
  describe Automatic::Plugin::StoreFullText do
@@ -1,14 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Store::Link
2
+ # Name:: Automatic::Plugin::Store::Permalink
3
3
  # Author:: 774 <http://id774.net>
4
- # Updated:: Jun 14, 2012
4
+ # Updated:: Sep 18, 2012
5
5
  # Copyright:: 774 Copyright (c) 2012
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')
9
9
 
10
10
  require 'store/permalink'
11
-
12
11
  require 'pathname'
13
12
 
14
13
  describe Automatic::Plugin::StorePermalink do
@@ -42,4 +41,54 @@ describe Automatic::Plugin::StorePermalink do
42
41
  instance.run.should have(0).feed
43
42
  }.should change(Automatic::Plugin::Permalink, :count).by(0)
44
43
  end
44
+
45
+ it "should be considered the case of the feed link nil" do
46
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
47
+ AutomaticSpec.generate_pipeline {
48
+ feed {
49
+ item "http://id774.net/images/link_1.jpg"
50
+ item "http://id774.net/images/link_2.jpg"
51
+ item "http://id774.net/images/link_3.JPG"
52
+ item "http://id774.net/images/link_4.png"
53
+ item "http://id774.net/images/link_5.jpeg"
54
+ item "http://id774.net/images/link_6.PNG"
55
+ item nil
56
+ item "http://id774.net/images/link_8.gif"
57
+ item "http://id774.net/images/link_9.GIF"
58
+ item "http://id774.net/images/link_10.tiff"
59
+ item "http://id774.net/images/link_11.TIFF"
60
+ }
61
+ }
62
+ )
63
+
64
+ instance.run.should have(1).feed
65
+ lambda {
66
+ instance.run.should have(0).feed
67
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
68
+ end
69
+
70
+ it "should be considered the case of duplicated links" do
71
+ instance = Automatic::Plugin::StorePermalink.new({"db" => @db_filename},
72
+ AutomaticSpec.generate_pipeline {
73
+ feed {
74
+ item "http://id774.net/images/link_1.jpg"
75
+ item "http://id774.net/images/link_1.jpg"
76
+ item "http://id774.net/images/link_3.JPG"
77
+ item "http://id774.net/images/link_4.png"
78
+ item "http://id774.net/images/link_5.jpeg"
79
+ item "http://id774.net/images/link_6.PNG"
80
+ item nil
81
+ item "http://id774.net/images/link_8.gif"
82
+ item "http://id774.net/images/link_9.GIF"
83
+ item "http://id774.net/images/link_10.tiff"
84
+ item "http://id774.net/images/link_11.TIFF"
85
+ }
86
+ }
87
+ )
88
+
89
+ instance.run.should have(1).feed
90
+ lambda {
91
+ instance.run.should have(0).feed
92
+ }.should change(Automatic::Plugin::Permalink, :count).by(0)
93
+ end
45
94
  end
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Plugin::CustomFeed::SVNFLog
3
3
  # Author:: kzgs
4
4
  # 774 <http://id774.net>
5
- # Created:: Mar 4, 2012
5
+ # Created:: Mar 4, 2012
6
6
  # Updated:: Jun 14, 2012
7
7
  # Copyright:: kzgs Copyright (c) 2012
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
@@ -10,7 +10,6 @@
10
10
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
11
11
 
12
12
  require 'store/target_link'
13
-
14
13
  require 'tmpdir'
15
14
  require 'pathname'
16
15
 
@@ -30,7 +30,6 @@ describe Automatic::Plugin::SubscriptionFeed do
30
30
  its(:run) { should be_empty }
31
31
  end
32
32
 
33
-
34
33
  context "with feeds whose valid URL" do
35
34
  subject {
36
35
  Automatic::Plugin::SubscriptionFeed.new(
@@ -1,19 +1,19 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Name:: Automatic::Plugin::Subscription::URI
2
+ # Name:: Automatic::Plugin::Subscription::Link
3
3
  # Author:: 774 <http://id774.net>
4
- # Created:: Jun 12, 2012
5
- # Updated:: Jun 13, 2012
4
+ # Created:: Sep 18, 2012
5
+ # Updated:: Sep 18, 2012
6
6
  # Copyright:: 774 Copyright (c) 2012
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')
10
10
 
11
- require 'subscription/uri'
11
+ require 'subscription/link'
12
12
 
13
- describe Automatic::Plugin::SubscriptionURI do
13
+ describe Automatic::Plugin::SubscriptionLink do
14
14
  context "with empty URLs" do
15
15
  subject {
16
- Automatic::Plugin::SubscriptionURI.new(
16
+ Automatic::Plugin::SubscriptionLink.new(
17
17
  { 'urls' => [] })
18
18
  }
19
19
  its(:run) { should be_empty }
@@ -21,19 +21,18 @@ describe Automatic::Plugin::SubscriptionURI do
21
21
 
22
22
  context "with URLs whose invalid URL" do
23
23
  subject {
24
- Automatic::Plugin::SubscriptionURI.new(
24
+ Automatic::Plugin::SubscriptionLink.new(
25
25
  { 'urls' => ["invalid_url"] }
26
26
  )
27
27
  }
28
28
  its(:run) { should be_empty }
29
29
  end
30
30
 
31
-
32
31
  context "with URLs whose valid URL" do
33
32
  subject {
34
- Automatic::Plugin::SubscriptionURI.new(
33
+ Automatic::Plugin::SubscriptionLink.new(
35
34
  { 'urls' => [
36
- "https://github.com/id774/automaticruby"]
35
+ "http://id774.net"]
37
36
  }
38
37
  )
39
38
  }
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Subscription::Twitter
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Sep 10, 2012
5
+ # Updated:: Sep 10, 2012
6
+ # Copyright:: 774 Copyright (c) 2012
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'
12
+
13
+ describe Automatic::Plugin::SubscriptionTwitter do
14
+ context "with empty URLs" do
15
+ subject {
16
+ Automatic::Plugin::SubscriptionTwitter.new(
17
+ { 'urls' => [] })
18
+ }
19
+ its(:run) { should be_empty }
20
+ end
21
+
22
+ context "with URLs whose invalid URL" do
23
+ subject {
24
+ Automatic::Plugin::SubscriptionTwitter.new(
25
+ { 'urls' => ["invalid_url"] }
26
+ )
27
+ }
28
+ its(:run) { should be_empty }
29
+ end
30
+
31
+ context "with URLs whose valid URL" do
32
+ subject {
33
+ Automatic::Plugin::SubscriptionTwitter.new(
34
+ { 'urls' => [
35
+ "http://id774.net/test/twitter/favorites.html"]
36
+ }
37
+ )
38
+ }
39
+
40
+ its(:run) { should have(1).item }
41
+ end
42
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Spec
3
- # Updated:: Jun 14, 2012
3
+ # Updated:: Sep 18, 2012
4
4
 
5
5
  APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
6
  $LOAD_PATH.unshift APP_ROOT
@@ -41,19 +41,19 @@ module AutomaticSpec
41
41
  def generate_pipeline(&block)
42
42
  pipeline_generator = StubPipelineGenerator.new
43
43
  pipeline_generator.instance_eval(&block)
44
- return pipeline_generator.pipeline
44
+ pipeline_generator.pipeline
45
45
  end
46
46
 
47
47
  def root_dir
48
- return File.join(__FILE__, "../../")
48
+ File.join(__FILE__, "../../")
49
49
  end
50
50
 
51
51
  def db_dir
52
52
  dir = (File.expand_path('~/.automatic/db'))
53
53
  if File.directory?(dir)
54
- return dir
54
+ dir
55
55
  else
56
- return File.join(root_dir, "db")
56
+ File.join(root_dir, "db")
57
57
  end
58
58
  end
59
59
  end
@@ -70,20 +70,6 @@ module AutomaticSpec
70
70
  generator.instance_eval(&block)
71
71
  @pipeline << generator.feed
72
72
  end
73
-
74
- def html(fixture)
75
- obj = File.read(File.join(APP_ROOT, "spec",
76
- "fixtures", fixture))
77
- @pipeline << obj
78
- end
79
-
80
- def link(fixture)
81
- obj = File.read(File.join(APP_ROOT, "spec",
82
- "fixtures", fixture))
83
- require 'extract/link'
84
- @pipeline << obj
85
- @pipeline.replace Automatic::Plugin::ExtractLink.new(nil, @pipeline).run
86
- end
87
73
  end
88
74
 
89
75
  class StubFeedGenerator
@@ -94,16 +80,16 @@ module AutomaticSpec
94
80
  def feed
95
81
  rss = RSS::Rss.new([])
96
82
  rss.instance_variable_set(:@channel, @channel)
97
- return rss
83
+ rss
98
84
  end
99
85
 
100
86
  def item(url, title="", description="", date="")
101
- itm = RSS::Rss::Channel::Item.new
102
- itm.link = url
103
- itm.title = title unless title.blank?
104
- itm.instance_variable_set(:@description, description)
105
- itm.pubDate = date unless date.blank?
106
- @channel.items << itm
87
+ i = RSS::Rss::Channel::Item.new
88
+ i.link = url
89
+ i.title = title unless title.blank?
90
+ i.instance_variable_set(:@description, description)
91
+ i.pubDate = date unless date.blank?
92
+ @channel.items << i
107
93
  end
108
94
  end
109
95
  end
@@ -10,7 +10,7 @@ module Automatic::Plugin
10
10
  end
11
11
 
12
12
  def run
13
- return @pipeline[0]
13
+ @pipeline[0]
14
14
  end
15
15
  end
16
16
  end
@@ -6,20 +6,18 @@ global:
6
6
  level: info
7
7
 
8
8
  plugins:
9
- - module: SubscriptionURI
9
+ - module: SubscriptionLink
10
10
  config:
11
11
  urls:
12
12
  - http://reblog.id774.net/
13
13
 
14
- - module: ExtractLink
14
+ - module: FilterImage
15
15
 
16
- - module: FilterImageLink
17
-
18
- - module: StoreLink
16
+ - module: StorePermalink
19
17
  config:
20
18
  db: test_link.db
21
19
 
22
- - module: StoreTarget
20
+ - module: StoreTargetLink
23
21
  config:
24
22
  path: /tmp
25
23
  interval: 2
@@ -9,7 +9,7 @@ plugins:
9
9
  - module: SubscriptionFeed
10
10
  config:
11
11
  feeds:
12
- - http://instagram.yuyuweb.cc/rss
12
+ - http://reblog.id774.net/rss
13
13
 
14
14
  - module: StorePermalink
15
15
  config:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.6.0
4
+ version: 12.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-17 00:00:00.000000000 Z
12
+ date: 2012-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -220,7 +220,6 @@ files:
220
220
  - bin/automatic
221
221
  - bin/automatic-config
222
222
  - config/feed2console.yml
223
- - config/html2console.yml
224
223
  - db/.gitkeep
225
224
  - doc/AUTHORS
226
225
  - doc/COPYING
@@ -237,61 +236,50 @@ files:
237
236
  - lib/automatic/pipeline.rb
238
237
  - lib/automatic/recipe.rb
239
238
  - plugins/custom_feed/svn_log.rb
240
- - plugins/extract/link.rb
239
+ - plugins/filter/absolute_uri.rb
241
240
  - plugins/filter/ignore.rb
242
- - plugins/filter/image_link.rb
241
+ - plugins/filter/image.rb
243
242
  - plugins/filter/image_source.rb
244
243
  - plugins/filter/reverse.rb
245
244
  - plugins/filter/tumblr_resize.rb
246
245
  - plugins/notify/ikachan.rb
247
246
  - plugins/publish/console.rb
248
- - plugins/publish/dump.rb
249
247
  - plugins/publish/google_calendar.rb
250
248
  - plugins/publish/hatena_bookmark.rb
251
249
  - plugins/publish/mail.rb
252
250
  - plugins/publish/smtp.rb
253
251
  - plugins/store/database.rb
254
252
  - plugins/store/full_text.rb
255
- - plugins/store/link.rb
256
253
  - plugins/store/permalink.rb
257
- - plugins/store/target.rb
258
254
  - plugins/store/target_link.rb
259
255
  - plugins/subscription/feed.rb
260
- - plugins/subscription/uri.rb
256
+ - plugins/subscription/link.rb
257
+ - plugins/subscription/twitter.rb
261
258
  - script/bootstrap
262
259
  - script/build
263
- - spec/fixtures/extractLink.html
264
- - spec/fixtures/filterImageLink.html
265
- - spec/fixtures/publishDump.html
266
260
  - spec/fixtures/sampleRecipe.yml
267
- - spec/fixtures/storeLink.html
268
- - spec/fixtures/storeLink2.html
269
- - spec/fixtures/storeTarget.html
270
- - spec/fixtures/storeTarget2.html
271
261
  - spec/lib/automatic/pipeline_spec.rb
272
262
  - spec/lib/automatic/recipe_spec.rb
273
263
  - spec/lib/automatic_spec.rb
274
264
  - spec/plugins/custom_feed/svn_log_spec.rb
275
- - spec/plugins/extract/link_spec.rb
265
+ - spec/plugins/filter/absolute_uri_spec.rb
276
266
  - spec/plugins/filter/ignore_spec.rb
277
- - spec/plugins/filter/image_link_spec.rb
278
267
  - spec/plugins/filter/image_source_spec.rb
268
+ - spec/plugins/filter/image_spec.rb
279
269
  - spec/plugins/filter/reverse_spec.rb
280
270
  - spec/plugins/filter/tumblr_resize_spec.rb
281
271
  - spec/plugins/notify/ikachan_spec.rb
282
272
  - spec/plugins/publish/console_spec.rb
283
- - spec/plugins/publish/dump_spec.rb
284
273
  - spec/plugins/publish/google_calendar_spec.rb
285
274
  - spec/plugins/publish/hatena_bookmark_spec.rb
286
275
  - spec/plugins/publish/mail_spec.rb
287
276
  - spec/plugins/publish/smtp_spec.rb
288
277
  - spec/plugins/store/full_text_spec.rb
289
- - spec/plugins/store/link_spec.rb
290
278
  - spec/plugins/store/permalink_spec.rb
291
279
  - spec/plugins/store/target_link_spec.rb
292
- - spec/plugins/store/target_spec.rb
293
280
  - spec/plugins/subscription/feed_spec.rb
294
- - spec/plugins/subscription/uri_spec.rb
281
+ - spec/plugins/subscription/link_spec.rb
282
+ - spec/plugins/subscription/twitter_spec.rb
295
283
  - spec/spec_helper.rb
296
284
  - spec/user_dir/plugins/store/mock.rb
297
285
  - test/fixtures/sampleOPML.xml