automatic 12.4.0 → 12.6.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.
- data/Gemfile +1 -0
- data/README.md +8 -5
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/automatic.gemspec +32 -9
- data/bin/automatic +3 -3
- data/bin/automatic-config +34 -17
- data/config/feed2console.yml +1 -2
- data/config/html2console.yml +16 -0
- data/doc/ChangeLog +38 -3
- data/doc/PLUGINS +191 -14
- data/doc/PLUGINS.ja +187 -10
- data/doc/README +70 -42
- data/doc/README.ja +64 -58
- data/lib/automatic/opml.rb +2 -1
- data/lib/automatic/pipeline.rb +3 -3
- data/lib/automatic/recipe.rb +6 -1
- data/lib/automatic.rb +6 -6
- data/plugins/extract/link.rb +32 -0
- data/plugins/filter/ignore.rb +7 -16
- data/plugins/filter/image_link.rb +37 -0
- data/plugins/filter/{image.rb → image_source.rb} +6 -7
- data/plugins/filter/reverse.rb +3 -4
- data/plugins/filter/tumblr_resize.rb +3 -4
- data/plugins/notify/ikachan.rb +1 -2
- data/plugins/publish/console.rb +0 -1
- data/plugins/publish/dump.rb +24 -0
- data/plugins/publish/google_calendar.rb +0 -2
- data/plugins/publish/hatena_bookmark.rb +2 -3
- data/plugins/store/{store_database.rb → database.rb} +32 -7
- data/plugins/store/full_text.rb +5 -5
- data/plugins/store/link.rb +47 -0
- data/plugins/store/permalink.rb +7 -7
- data/plugins/store/target.rb +41 -0
- data/plugins/subscription/feed.rb +0 -1
- data/plugins/subscription/uri.rb +31 -0
- data/script/build +18 -4
- data/spec/fixtures/extractLink.html +14 -0
- data/spec/fixtures/filterImageLink.html +34 -0
- data/spec/fixtures/publishDump.html +14 -0
- data/{config/default.yml → spec/fixtures/sampleRecipe.yml} +8 -10
- data/spec/fixtures/storeLink.html +34 -0
- data/spec/fixtures/storeLink2.html +36 -0
- data/spec/fixtures/storeTarget.html +11 -0
- data/spec/fixtures/storeTarget2.html +11 -0
- data/spec/lib/automatic/pipeline_spec.rb +27 -14
- data/spec/lib/automatic/recipe_spec.rb +35 -0
- data/spec/lib/automatic_spec.rb +21 -14
- data/spec/plugins/extract/link_spec.rb +38 -0
- data/spec/plugins/filter/ignore_spec.rb +59 -3
- data/spec/plugins/filter/image_link_spec.rb +51 -0
- data/spec/plugins/filter/{image_spec.rb → image_source_spec.rb} +29 -9
- data/spec/plugins/filter/reverse_spec.rb +0 -1
- data/spec/plugins/filter/tumblr_resize_spec.rb +7 -0
- data/spec/plugins/publish/console_spec.rb +9 -2
- data/spec/plugins/publish/dump_spec.rb +32 -0
- data/spec/plugins/publish/google_calendar_spec.rb +2 -1
- data/spec/plugins/publish/hatena_bookmark_spec.rb +2 -1
- data/spec/plugins/publish/mail_spec.rb +9 -1
- data/spec/plugins/publish/smtp_spec.rb +9 -1
- data/spec/plugins/store/full_text_spec.rb +15 -5
- data/spec/plugins/store/link_spec.rb +47 -0
- data/spec/plugins/store/permalink_spec.rb +9 -2
- data/spec/plugins/store/target_link_spec.rb +17 -3
- data/spec/plugins/store/target_spec.rb +41 -0
- data/spec/plugins/subscription/feed_spec.rb +14 -4
- data/spec/plugins/subscription/uri_spec.rb +43 -0
- data/spec/spec_helper.rb +31 -8
- data/spec/user_dir/plugins/store/mock.rb +4 -0
- data/test/integration/test_activerecord.yml +1 -1
- data/test/integration/test_fulltext.yml +1 -1
- data/test/integration/test_get_image.yml +26 -0
- data/test/integration/test_hatenabookmark.yml +1 -1
- data/test/integration/test_ignore.yml +1 -1
- data/test/integration/test_ignore2.yml +1 -1
- data/test/integration/test_image2local.yml +1 -1
- data/test/integration/test_reverse.yml +1 -1
- data/test/integration/test_tumblr2local.yml +1 -1
- metadata +45 -9
- data/spec/lib/pipeline_spec.rb +0 -67
- data/test/integration/test_mail.yml +0 -21
@@ -1,8 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Name::
|
2
|
+
# Name:: Automatic::Pipeline
|
3
3
|
# Author:: ainame
|
4
|
+
# 774 <http://id774.net>
|
4
5
|
# Created:: Mar 10, 2012
|
5
|
-
# Updated::
|
6
|
+
# Updated:: Jun 16, 2012
|
6
7
|
# Copyright:: ainame Copyright (c) 2012
|
7
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
9
|
|
@@ -12,37 +13,49 @@ require 'automatic/pipeline'
|
|
12
13
|
|
13
14
|
TEST_MODULES = ["SubscriptionFeed", "FilterIgnore"]
|
14
15
|
|
15
|
-
describe Automatic::Pipeline do
|
16
|
-
describe "in default dir" do
|
17
|
-
before do
|
16
|
+
describe Automatic::Pipeline do
|
17
|
+
describe "in default dir" do
|
18
|
+
before do
|
18
19
|
Automatic.root_dir = APP_ROOT
|
19
20
|
Automatic.user_dir = nil
|
20
21
|
end
|
21
|
-
|
22
|
+
|
22
23
|
describe "#load_plugin" do
|
23
|
-
it "raise no plugin error" do
|
24
|
-
lambda{
|
25
|
-
Automatic::
|
26
|
-
}.should raise_exception
|
24
|
+
it "raise no plugin error" do
|
25
|
+
lambda{
|
26
|
+
Automatic::Pipeline.load_plugin "FooBar"
|
27
|
+
}.should raise_exception(Automatic::NoPluginError,
|
28
|
+
/unknown plugin named FooBar/)
|
27
29
|
end
|
28
30
|
|
29
|
-
it "correctly load module" do
|
31
|
+
it "correctly load module" do
|
30
32
|
TEST_MODULES.each do |mod|
|
31
33
|
Automatic::Pipeline.load_plugin mod.to_s
|
32
34
|
Automatic::Plugin.const_get(mod).class.should == Class
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
38
|
+
|
39
|
+
describe "#run" do
|
40
|
+
it "run a recipe with FilterIgnore module" do
|
41
|
+
plugin = mock("plugin")
|
42
|
+
plugin.should_receive(:module).and_return("FilterIgnore")
|
43
|
+
plugin.should_receive(:config)
|
44
|
+
recipe = mock("recipe")
|
45
|
+
recipe.should_receive(:each_plugin).and_yield(plugin)
|
46
|
+
Automatic::Pipeline.run(recipe).should == []
|
47
|
+
end
|
48
|
+
end
|
36
49
|
end
|
37
50
|
|
38
|
-
describe "in user dir" do
|
39
|
-
before do
|
51
|
+
describe "in user dir" do
|
52
|
+
before do
|
40
53
|
Automatic.root_dir = APP_ROOT
|
41
54
|
Automatic.user_dir = File.join(APP_ROOT, "spec/user_dir")
|
42
55
|
end
|
43
56
|
|
44
57
|
describe "#load_plugin" do
|
45
|
-
it "correctly load module" do
|
58
|
+
it "correctly load module" do
|
46
59
|
# StoreMock is the mock class that it return pipeline.
|
47
60
|
mock = "StoreMock"
|
48
61
|
Automatic::Pipeline.load_plugin mock
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Auaotmatic::Recipe
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Created:: Jun 14, 2012
|
5
|
+
# Updated:: Jun 14, 2012
|
6
|
+
# Copyright:: ainame Copyright (c) 2012
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
require File.expand_path(File.join(File.dirname(__FILE__) ,'../../spec_helper'))
|
10
|
+
require 'automatic'
|
11
|
+
require 'automatic/recipe'
|
12
|
+
|
13
|
+
TEST_RECIPE = File.expand_path(File.join(APP_ROOT, "spec",
|
14
|
+
'fixtures', 'sampleRecipe.yml'))
|
15
|
+
|
16
|
+
describe Automatic::Recipe do
|
17
|
+
describe "with recipe" do
|
18
|
+
before do
|
19
|
+
Automatic.root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../../"))
|
20
|
+
Automatic.user_dir = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "with a normal recipe" do
|
24
|
+
it "correctly load recipe" do
|
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
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/spec/lib/automatic_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Name:: Automatic
|
3
3
|
# Author:: kzgs
|
4
|
+
# 774 <http://id774.net>
|
4
5
|
# Created:: Mar 9, 2012
|
5
6
|
# Updated:: Mar 10, 2012
|
6
7
|
# Copyright:: kzgs Copyright (c) 2012
|
@@ -13,7 +14,7 @@ describe Automatic do
|
|
13
14
|
describe "#run" do
|
14
15
|
describe "with a root dir which has default recipe" do
|
15
16
|
specify {
|
16
|
-
lambda{
|
17
|
+
lambda{
|
17
18
|
Automatic.run(:recipe => "",
|
18
19
|
:root_dir => APP_ROOT,
|
19
20
|
:user_dir => APP_ROOT + "/spec/user_dir")
|
@@ -22,6 +23,12 @@ describe Automatic do
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
describe "#version" do
|
27
|
+
specify {
|
28
|
+
Automatic.const_get(:VERSION).should == "12.6.0"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
25
32
|
describe "#(root|config)_dir" do
|
26
33
|
specify {
|
27
34
|
Automatic.root_dir.should == APP_ROOT
|
@@ -30,46 +37,46 @@ describe Automatic do
|
|
30
37
|
end
|
31
38
|
|
32
39
|
describe "#user_dir= in test env" do
|
33
|
-
before(:all) do
|
40
|
+
before(:all) do
|
34
41
|
Automatic.user_dir = File.join(APP_ROOT, "spec/user_dir")
|
35
42
|
end
|
36
43
|
|
37
|
-
describe "#user_dir" do
|
38
|
-
it "return valid value" do
|
44
|
+
describe "#user_dir" do
|
45
|
+
it "return valid value" do
|
39
46
|
Automatic.user_dir.should == File.join(APP_ROOT, "spec/user_dir")
|
40
47
|
end
|
41
48
|
end
|
42
49
|
|
43
|
-
describe "#user_plugins_dir" do
|
44
|
-
it "return valid value" do
|
50
|
+
describe "#user_plugins_dir" do
|
51
|
+
it "return valid value" do
|
45
52
|
Automatic.user_plugins_dir.should == File.join(APP_ROOT, "spec/user_dir/plugins")
|
46
53
|
end
|
47
54
|
end
|
48
55
|
|
49
|
-
after(:all) do
|
56
|
+
after(:all) do
|
50
57
|
Automatic.user_dir = nil
|
51
58
|
end
|
52
59
|
end
|
53
60
|
|
54
|
-
describe "#set_user_dir in other env" do
|
55
|
-
before(:all) do
|
61
|
+
describe "#set_user_dir in other env" do
|
62
|
+
before(:all) do
|
56
63
|
ENV["AUTOMATIC_RUBY_ENV"] = "other"
|
57
64
|
Automatic.user_dir = nil
|
58
65
|
end
|
59
66
|
|
60
|
-
describe "#user_dir" do
|
61
|
-
it "return valid value" do
|
67
|
+
describe "#user_dir" do
|
68
|
+
it "return valid value" do
|
62
69
|
Automatic.user_dir.should == File.expand_path("~/") + "/.automatic"
|
63
70
|
end
|
64
71
|
end
|
65
72
|
|
66
|
-
describe "#user_plugins_dir" do
|
67
|
-
it "return valid value" do
|
73
|
+
describe "#user_plugins_dir" do
|
74
|
+
it "return valid value" do
|
68
75
|
Automatic.user_plugins_dir.should == File.expand_path("~/") + "/.automatic/plugins"
|
69
76
|
end
|
70
77
|
end
|
71
78
|
|
72
|
-
after(:all) do
|
79
|
+
after(:all) do
|
73
80
|
ENV["AUTOMATIC_RUBY_ENV"] = "test"
|
74
81
|
end
|
75
82
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Extract::Link
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Created:: Jun 12, 2012
|
5
|
+
# Updated:: Jun 14, 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 'extract/link'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::ExtractLink do
|
14
|
+
context "with html contain link tag" do
|
15
|
+
subject {
|
16
|
+
Automatic::Plugin::ExtractLink.new({},
|
17
|
+
AutomaticSpec.generate_pipeline {
|
18
|
+
html "extractLink.html"
|
19
|
+
}
|
20
|
+
)}
|
21
|
+
|
22
|
+
describe "#run" do
|
23
|
+
its(:run) { should have(4).items }
|
24
|
+
specify {
|
25
|
+
subject.run
|
26
|
+
expect = "http://id774.net"
|
27
|
+
subject.instance_variable_get(:@return_html)[0].should == expect
|
28
|
+
expect = "http://reblog.id774.net"
|
29
|
+
subject.instance_variable_get(:@return_html)[1].should == expect
|
30
|
+
expect = "http://oh-news.net/live/wp-content/uploads/2011/04/Eila_omote.jpg"
|
31
|
+
subject.instance_variable_get(:@return_html)[2].should == expect
|
32
|
+
expect = "http://blog.id774.net/post/"
|
33
|
+
subject.instance_variable_get(:@return_html)[3].should == expect
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Filter::Ignore
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'filter/ignore'
|
@@ -13,12 +20,28 @@ describe Automatic::Plugin::FilterIgnore do
|
|
13
20
|
feed { item "http://google.com" }
|
14
21
|
})
|
15
22
|
}
|
16
|
-
|
23
|
+
|
17
24
|
describe "#run" do
|
18
25
|
its(:run) { should have(2).feeds }
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
29
|
+
context "with exclusion by description" do
|
30
|
+
subject {
|
31
|
+
Automatic::Plugin::FilterIgnore.new({
|
32
|
+
'exclude' => [""],
|
33
|
+
},
|
34
|
+
AutomaticSpec.generate_pipeline {
|
35
|
+
feed { item "http://github.com" }
|
36
|
+
feed { item "http://google.com" }
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
describe "#run" do
|
41
|
+
its(:run) { should have(0).feeds }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
22
45
|
context "with exclusion by description" do
|
23
46
|
subject {
|
24
47
|
Automatic::Plugin::FilterIgnore.new({
|
@@ -29,12 +52,28 @@ describe Automatic::Plugin::FilterIgnore do
|
|
29
52
|
feed { item "http://google.com" }
|
30
53
|
})
|
31
54
|
}
|
32
|
-
|
55
|
+
|
33
56
|
describe "#run" do
|
34
57
|
its(:run) { should have(2).feeds }
|
35
58
|
end
|
36
59
|
end
|
37
60
|
|
61
|
+
context "with exclusion by description" do
|
62
|
+
subject {
|
63
|
+
Automatic::Plugin::FilterIgnore.new({
|
64
|
+
'description' => [""],
|
65
|
+
},
|
66
|
+
AutomaticSpec.generate_pipeline {
|
67
|
+
feed { item "http://github.com" }
|
68
|
+
feed { item "http://google.com" }
|
69
|
+
})
|
70
|
+
}
|
71
|
+
|
72
|
+
describe "#run" do
|
73
|
+
its(:run) { should have(0).feeds }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
38
77
|
context "with exclusion by link" do
|
39
78
|
subject {
|
40
79
|
Automatic::Plugin::FilterIgnore.new({
|
@@ -45,9 +84,26 @@ describe Automatic::Plugin::FilterIgnore do
|
|
45
84
|
feed { item "http://google.com" }
|
46
85
|
})
|
47
86
|
}
|
48
|
-
|
87
|
+
|
49
88
|
describe "#run" do
|
50
89
|
its(:run) { should have(1).feeds }
|
51
90
|
end
|
52
91
|
end
|
92
|
+
|
93
|
+
context "with exclusion by link" do
|
94
|
+
subject {
|
95
|
+
Automatic::Plugin::FilterIgnore.new({
|
96
|
+
'link' => [""],
|
97
|
+
},
|
98
|
+
AutomaticSpec.generate_pipeline {
|
99
|
+
feed { item "http://github.com" }
|
100
|
+
feed { item "http://google.com" }
|
101
|
+
})
|
102
|
+
}
|
103
|
+
|
104
|
+
describe "#run" do
|
105
|
+
its(:run) { should have(0).feeds }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
53
109
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Filter::ImageLink
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Created:: Jun 13, 2012
|
5
|
+
# Updated:: Jun 13, 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_link'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::FilterImageLink do
|
14
|
+
context "with html contain link tag" do
|
15
|
+
subject {
|
16
|
+
Automatic::Plugin::FilterImageLink.new({},
|
17
|
+
AutomaticSpec.generate_pipeline {
|
18
|
+
link "filterImageLink.html"
|
19
|
+
}
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
describe "#run" do
|
24
|
+
its(:run) { should have(10).items }
|
25
|
+
specify {
|
26
|
+
subject.run
|
27
|
+
expect = "http://link_1.jpg"
|
28
|
+
subject.instance_variable_get(:@return_html)[0].should == expect
|
29
|
+
expect = "http://link_2.jpg"
|
30
|
+
subject.instance_variable_get(:@return_html)[1].should == expect
|
31
|
+
expect = "http://link_3.JPG"
|
32
|
+
subject.instance_variable_get(:@return_html)[2].should == expect
|
33
|
+
expect = "http://link_4.png"
|
34
|
+
subject.instance_variable_get(:@return_html)[3].should == expect
|
35
|
+
expect = "http://link_5.jpeg"
|
36
|
+
subject.instance_variable_get(:@return_html)[4].should == expect
|
37
|
+
expect = "http://link_6.PNG"
|
38
|
+
subject.instance_variable_get(:@return_html)[5].should == expect
|
39
|
+
expect = "http://link_8.gif"
|
40
|
+
subject.instance_variable_get(:@return_html)[6].should == expect
|
41
|
+
expect = "http://link_9.GIF"
|
42
|
+
subject.instance_variable_get(:@return_html)[7].should == expect
|
43
|
+
expect = "http://link_10.tiff"
|
44
|
+
subject.instance_variable_get(:@return_html)[8].should == expect
|
45
|
+
expect = "http://link_11.TIFF"
|
46
|
+
subject.instance_variable_get(:@return_html)[9].should == expect
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -1,19 +1,20 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Name:: Automatic::Plugin::
|
2
|
+
# Name:: Automatic::Plugin::Filter::ImageSource
|
3
3
|
# Author:: kzgs
|
4
|
+
# 774 <http://id774.net>
|
4
5
|
# Created:: Mar 1, 2012
|
5
|
-
# Updated::
|
6
|
+
# Updated:: Jun 14, 2012
|
6
7
|
# Copyright:: kzgs Copyright (c) 2012
|
7
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
9
|
|
9
10
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
10
11
|
|
11
|
-
require 'filter/
|
12
|
+
require 'filter/image_source'
|
12
13
|
|
13
|
-
describe Automatic::Plugin::
|
14
|
+
describe Automatic::Plugin::FilterImageSource do
|
14
15
|
context "with description with image tag" do
|
15
16
|
subject {
|
16
|
-
Automatic::Plugin::
|
17
|
+
Automatic::Plugin::FilterImageSource.new({},
|
17
18
|
AutomaticSpec.generate_pipeline {
|
18
19
|
feed {
|
19
20
|
item "http://tumblr.com", "",
|
@@ -22,7 +23,6 @@ describe Automatic::Plugin::FilterImage do
|
|
22
23
|
|
23
24
|
describe "#run" do
|
24
25
|
its(:run) { should have(1).feeds }
|
25
|
-
|
26
26
|
specify {
|
27
27
|
subject.run
|
28
28
|
subject.instance_variable_get(:@pipeline)[0].items[0].link.
|
@@ -32,10 +32,10 @@ describe Automatic::Plugin::FilterImage do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe Automatic::Plugin::
|
35
|
+
describe Automatic::Plugin::FilterImageSource do
|
36
36
|
context "with description with image tag" do
|
37
37
|
subject {
|
38
|
-
Automatic::Plugin::
|
38
|
+
Automatic::Plugin::FilterImageSource.new({},
|
39
39
|
AutomaticSpec.generate_pipeline {
|
40
40
|
feed {
|
41
41
|
item "http://tumblr.com", "",
|
@@ -44,7 +44,6 @@ describe Automatic::Plugin::FilterImage do
|
|
44
44
|
|
45
45
|
describe "#run" do
|
46
46
|
its(:run) { should have(1).feeds }
|
47
|
-
|
48
47
|
specify {
|
49
48
|
subject.run
|
50
49
|
subject.instance_variable_get(:@pipeline)[0].items[0].link.
|
@@ -53,3 +52,24 @@ describe Automatic::Plugin::FilterImage do
|
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
55
|
+
|
56
|
+
describe Automatic::Plugin::FilterImageSource do
|
57
|
+
context "with no data" do
|
58
|
+
subject {
|
59
|
+
Automatic::Plugin::FilterImageSource.new({},
|
60
|
+
AutomaticSpec.generate_pipeline {
|
61
|
+
feed {
|
62
|
+
item "http://tumblr.com", "",
|
63
|
+
""
|
64
|
+
}})}
|
65
|
+
|
66
|
+
describe "#run" do
|
67
|
+
its(:run) { should have(1).feeds }
|
68
|
+
specify {
|
69
|
+
subject.run
|
70
|
+
subject.instance_variable_get(:@pipeline)[0].items[0].link.
|
71
|
+
should nil
|
72
|
+
}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Filter::TumblrResize
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'filter/tumblr_resize'
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Console
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'publish/console'
|
@@ -8,7 +15,7 @@ describe Automatic::Plugin::PublishConsole do
|
|
8
15
|
feed { item "http://github.com" }
|
9
16
|
}
|
10
17
|
end
|
11
|
-
|
18
|
+
|
12
19
|
subject {
|
13
20
|
Automatic::Plugin::PublishConsole.new({}, @pipeline)
|
14
21
|
}
|
@@ -18,6 +25,6 @@ describe Automatic::Plugin::PublishConsole do
|
|
18
25
|
output.should_receive(:puts).
|
19
26
|
with("info", @pipeline[0].items[0].pretty_inspect)
|
20
27
|
subject.instance_variable_set(:@output, output)
|
21
|
-
subject.run
|
28
|
+
subject.run.should have(1).items
|
22
29
|
end
|
23
30
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Dump
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Created:: Jun 13, 2012
|
5
|
+
# Updated:: Jun 13, 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 'publish/dump'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::PublishDump do
|
14
|
+
|
15
|
+
context "with contain normal HTML" do
|
16
|
+
subject {
|
17
|
+
Automatic::Plugin::PublishDump.new({},
|
18
|
+
AutomaticSpec.generate_pipeline {
|
19
|
+
html "publishDump.html"
|
20
|
+
}
|
21
|
+
)}
|
22
|
+
|
23
|
+
describe "#run" do
|
24
|
+
its(:run) { should have(1).items }
|
25
|
+
specify {
|
26
|
+
subject.run
|
27
|
+
expect = "<!DOCTYPE html>\n<html lang=\"ja\">\n <head>\n <title>Sample</title>\n </head>\n <body>\n <p>A simple <b>test</b> string.</p>\n <a href=\"http://id774.net\">id774.net</a>\n <a href=\"http://reblog.id774.net\">reblog.id774.net</a>\n <a href=\"http://oh-news.net/live/wp-content/uploads/2011/04/Eila_omote.jpg\">\n <img src=\"http://24.media.tumblr.com/tumblr_m5gneyJmsH1qza5ppo1_500.jpg\" alt=\"\" /></a>\n <a href=\"http://blog.id774.net/post/\">blog.id774.net</a>\n </body>\n</html>\n"
|
28
|
+
subject.instance_variable_get(:@pipeline)[0].should == expect
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Mail
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'publish/mail'
|
@@ -32,7 +39,8 @@ describe Automatic::Plugin::PublishMail do
|
|
32
39
|
sender.should == "<from@example.com>"
|
33
40
|
recipients.should == ["<to@example.com>"]
|
34
41
|
}
|
35
|
-
}
|
42
|
+
}
|
43
|
+
)
|
36
44
|
Thread.start {
|
37
45
|
smtpd.start
|
38
46
|
}
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Mail
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'publish/smtp'
|
@@ -28,7 +35,8 @@ describe Automatic::Plugin::PublishSmtp do
|
|
28
35
|
sender.should == "from@example.com"
|
29
36
|
recipients.should == ["to@example.com"]
|
30
37
|
}
|
31
|
-
}
|
38
|
+
}
|
39
|
+
)
|
32
40
|
Thread.start {
|
33
41
|
smtpd.start
|
34
42
|
}
|
@@ -1,3 +1,10 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Store::FullText
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Updated:: Jun 14, 2012
|
5
|
+
# Copyright:: 774 Copyright (c) 2012
|
6
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
7
|
+
|
1
8
|
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
9
|
|
3
10
|
require 'store/full_text'
|
@@ -11,13 +18,14 @@ describe Automatic::Plugin::StoreFullText do
|
|
11
18
|
db_path.delete if db_path.exist?
|
12
19
|
Automatic::Plugin::StoreFullText.new({"db" => @db_filename}).run
|
13
20
|
end
|
14
|
-
|
21
|
+
|
15
22
|
it "should store 1 record for the new blog entry" do
|
16
23
|
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
17
24
|
AutomaticSpec.generate_pipeline {
|
18
25
|
feed { item "http://blog.id774.net/blogs/feed/" }
|
19
|
-
}
|
20
|
-
|
26
|
+
}
|
27
|
+
)
|
28
|
+
|
21
29
|
lambda {
|
22
30
|
instance.run.should have(1).feed
|
23
31
|
}.should change(Automatic::Plugin::Blog, :count).by(1)
|
@@ -27,11 +35,13 @@ describe Automatic::Plugin::StoreFullText do
|
|
27
35
|
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
28
36
|
AutomaticSpec.generate_pipeline {
|
29
37
|
feed { item "http://blog.id774.net/blogs/feed/" }
|
30
|
-
}
|
31
|
-
|
38
|
+
}
|
39
|
+
)
|
40
|
+
|
32
41
|
instance.run.should have(1).feed
|
33
42
|
lambda {
|
34
43
|
instance.run.should have(0).feed
|
35
44
|
}.should change(Automatic::Plugin::Blog, :count).by(0)
|
36
45
|
end
|
46
|
+
|
37
47
|
end
|