automatic 14.12.2 → 26.08
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.
- checksums.yaml +5 -5
- data/README.md +635 -83
- data/VERSION +1 -1
- data/automatic.gemspec +109 -248
- data/bin/automatic +20 -139
- data/config/feed2console.yml +10 -4
- data/config/feed2markdown.yml +41 -0
- data/doc/AI_TUTORIAL.md +518 -0
- data/doc/BASIC_DESIGN.md +516 -0
- data/doc/COPYING.LESSER +165 -0
- data/doc/DEPLOYMENT.md +824 -0
- data/doc/LICENSE.md +14 -0
- data/doc/PLUGINS.md +1875 -0
- data/doc/PLUGIN_DEVELOPMENT.md +86 -0
- data/doc/POLICY.md +857 -0
- data/doc/QUICKSTART.md +256 -0
- data/doc/RELEASING.md +381 -0
- data/doc/REQUIREMENTS.md +526 -0
- data/doc/VERSIONS +208 -0
- data/lib/automatic/cli.rb +248 -0
- data/lib/automatic/environment.rb +31 -5
- data/lib/automatic/feed_maker.rb +10 -9
- data/lib/automatic/feed_parser.rb +51 -35
- data/lib/automatic/http.rb +107 -0
- data/lib/automatic/log.rb +49 -18
- data/lib/automatic/opml.rb +3 -1
- data/lib/automatic/pipeline.rb +63 -32
- data/lib/automatic/recipe.rb +56 -17
- data/lib/automatic/version.rb +14 -1
- data/lib/automatic.rb +78 -20
- data/plugins/custom_feed/svn_log.rb +73 -32
- data/plugins/custom_feed/web.rb +348 -0
- data/plugins/filter/absolute_uri.rb +43 -27
- data/plugins/filter/accept.rb +38 -45
- data/plugins/filter/claude.rb +217 -0
- data/plugins/filter/clear.rb +12 -8
- data/plugins/filter/description_link.rb +49 -51
- data/plugins/filter/full_feed.rb +158 -52
- data/plugins/filter/gemini.rb +216 -0
- data/plugins/filter/github_feed.rb +38 -26
- data/plugins/filter/ignore.rb +33 -44
- data/plugins/filter/image.rb +36 -25
- data/plugins/filter/image_source.rb +58 -52
- data/plugins/filter/join.rb +107 -0
- data/plugins/filter/one.rb +19 -26
- data/plugins/filter/open_ai.rb +198 -0
- data/plugins/filter/rand.rb +16 -17
- data/plugins/filter/sakura_ai.rb +205 -0
- data/plugins/filter/sanitize.rb +29 -34
- data/plugins/filter/sort.rb +20 -27
- data/plugins/filter/tumblr_resize.rb +31 -23
- data/plugins/notify/ikachan.rb +86 -48
- data/plugins/provide/fluentd.rb +43 -24
- data/plugins/publish/amazon_s3.rb +73 -40
- data/plugins/publish/console.rb +19 -16
- data/plugins/publish/console_link.rb +20 -17
- data/plugins/publish/eject.rb +48 -26
- data/plugins/publish/fluentd.rb +50 -30
- data/plugins/publish/hatena_bookmark.rb +88 -71
- data/plugins/publish/instapaper.rb +69 -59
- data/plugins/publish/markdown.rb +278 -0
- data/plugins/publish/memcached.rb +35 -29
- data/plugins/store/database.rb +50 -48
- data/plugins/store/digest.rb +212 -0
- data/plugins/store/file.rb +99 -68
- data/plugins/store/full_text.rb +32 -25
- data/plugins/store/permalink.rb +18 -22
- data/plugins/subscription/feed.rb +34 -21
- data/plugins/subscription/link.rb +31 -32
- data/plugins/subscription/text.rb +32 -46
- data/plugins/subscription/tumblr.rb +55 -44
- data/plugins/subscription/xml.rb +40 -36
- metadata +108 -321
- data/Gemfile +0 -38
- data/Rakefile +0 -59
- data/doc/ChangeLog +0 -303
- data/doc/PLUGINS +0 -750
- data/doc/PLUGINS.ja +0 -753
- data/doc/README +0 -511
- data/doc/README.ja +0 -519
- data/plugins/filter/google_news.rb +0 -50
- data/plugins/publish/google_calendar.rb +0 -84
- data/plugins/publish/hipchat.rb +0 -46
- data/plugins/publish/pocket.rb +0 -45
- data/plugins/publish/twitter.rb +0 -58
- data/plugins/subscription/chan_toru.rb +0 -57
- data/plugins/subscription/g_guide.rb +0 -57
- data/plugins/subscription/pocket.rb +0 -51
- data/plugins/subscription/twitter.rb +0 -69
- data/plugins/subscription/twitter_search.rb +0 -50
- data/plugins/subscription/weather.rb +0 -33
- data/script/build +0 -84
- data/spec/fixtures/sampleFeeds.tsv +0 -1
- data/spec/fixtures/sampleFeeds2.tsv +0 -2
- data/spec/fixtures/sampleRecipe.yml +0 -24
- data/spec/lib/automatic/log_spec.rb +0 -32
- data/spec/lib/automatic/pipeline_spec.rb +0 -68
- data/spec/lib/automatic/recipe_spec.rb +0 -40
- data/spec/lib/automatic_spec.rb +0 -99
- data/spec/plugins/custom_feed/svn_log_spec.rb +0 -31
- data/spec/plugins/filter/absolute_uri_spec.rb +0 -61
- data/spec/plugins/filter/accept_spec.rb +0 -331
- data/spec/plugins/filter/clear_spec.rb +0 -49
- data/spec/plugins/filter/description_link_spec.rb +0 -138
- data/spec/plugins/filter/full_feed_spec.rb +0 -129
- data/spec/plugins/filter/github_feed_spec.rb +0 -55
- data/spec/plugins/filter/google_news_spec.rb +0 -69
- data/spec/plugins/filter/ignore_spec.rb +0 -328
- data/spec/plugins/filter/image_source_spec.rb +0 -89
- data/spec/plugins/filter/image_spec.rb +0 -65
- data/spec/plugins/filter/one_spec.rb +0 -71
- data/spec/plugins/filter/rand_spec.rb +0 -52
- data/spec/plugins/filter/sanitize_spec.rb +0 -153
- data/spec/plugins/filter/sort_spec.rb +0 -189
- data/spec/plugins/filter/tumblr_resize_spec.rb +0 -109
- data/spec/plugins/notify/ikachan_spec.rb +0 -58
- data/spec/plugins/provide/fluentd_spec.rb +0 -49
- data/spec/plugins/publish/amazon_s3_spec.rb +0 -40
- data/spec/plugins/publish/console_spec.rb +0 -30
- data/spec/plugins/publish/eject_spec.rb +0 -40
- data/spec/plugins/publish/fluentd_spec.rb +0 -40
- data/spec/plugins/publish/google_calendar_spec.rb +0 -83
- data/spec/plugins/publish/hatena_bookmark_spec.rb +0 -134
- data/spec/plugins/publish/hipchat_spec.rb +0 -69
- data/spec/plugins/publish/instapaper_spec.rb +0 -82
- data/spec/plugins/publish/memcached_spec.rb +0 -63
- data/spec/plugins/publish/pocket_spec.rb +0 -51
- data/spec/plugins/publish/twitter_spec.rb +0 -73
- data/spec/plugins/store/file_spec.rb +0 -58
- data/spec/plugins/store/full_text_spec.rb +0 -152
- data/spec/plugins/store/permalink_spec.rb +0 -206
- data/spec/plugins/subscription/chan_toru_spec.rb +0 -56
- data/spec/plugins/subscription/feed_spec.rb +0 -71
- data/spec/plugins/subscription/g_guide_spec.rb +0 -82
- data/spec/plugins/subscription/link_spec.rb +0 -72
- data/spec/plugins/subscription/pocket_spec.rb +0 -57
- data/spec/plugins/subscription/text_spec.rb +0 -84
- data/spec/plugins/subscription/tumblr_spec.rb +0 -74
- data/spec/plugins/subscription/twitter_search_spec.rb +0 -57
- data/spec/plugins/subscription/twitter_spec.rb +0 -73
- data/spec/plugins/subscription/weather_spec.rb +0 -44
- data/spec/plugins/subscription/xml_spec.rb +0 -84
- data/spec/spec_helper.rb +0 -106
- data/spec/user_dir/plugins/store/mock.rb +0 -16
- data/test/fixtures/sampleOPML.xml +0 -11
- data/test/integration/test_absoluteurl.yml +0 -25
- data/test/integration/test_activerecord.yml +0 -24
- data/test/integration/test_add_pocket.yml +0 -26
- data/test/integration/test_chan_toru.yml +0 -21
- data/test/integration/test_descriptionlink.yml +0 -21
- data/test/integration/test_fluentd.yml +0 -22
- data/test/integration/test_fulltext.yml +0 -30
- data/test/integration/test_google_news.yml +0 -21
- data/test/integration/test_googlealert.yml +0 -21
- data/test/integration/test_hatenabookmark.yml +0 -30
- data/test/integration/test_ignore.yml +0 -25
- data/test/integration/test_ignore2.yml +0 -22
- data/test/integration/test_image2local.yml +0 -33
- data/test/integration/test_instapaper.yml +0 -26
- data/test/integration/test_link2local.yml +0 -34
- data/test/integration/test_one.yml +0 -23
- data/test/integration/test_pocket.yml +0 -22
- data/test/integration/test_rand.yml +0 -21
- data/test/integration/test_sanitize.yml +0 -23
- data/test/integration/test_sort.yml +0 -36
- data/test/integration/test_svnlog.yml +0 -15
- data/test/integration/test_text2feed.yml +0 -36
- data/test/integration/test_tumblr2local.yml +0 -43
- data/test/integration/test_twitter_search.yml +0 -22
- data/test/integration/test_weather.yml +0 -19
- data/test/integration/test_xml2fluentd.yml +0 -21
- data/vendor/.gitkeep +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
2
|
-
|
|
3
|
-
require 'notify/ikachan'
|
|
4
|
-
|
|
5
|
-
describe Automatic::Plugin::NotifyIkachan do
|
|
6
|
-
paramz = {
|
|
7
|
-
"channels" => "#room",
|
|
8
|
-
"url" => "http://sample.com",
|
|
9
|
-
"port" => "4979",
|
|
10
|
-
"command" => "notice",
|
|
11
|
-
}
|
|
12
|
-
subject {
|
|
13
|
-
Automatic::Plugin::NotifyIkachan.new(
|
|
14
|
-
paramz,
|
|
15
|
-
AutomaticSpec.generate_pipeline {
|
|
16
|
-
feed { item "http://github.com", "GitHub" }
|
|
17
|
-
}
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
it "should post title and link in the feed" do
|
|
22
|
-
ikachan = double("ikachan")
|
|
23
|
-
ikachan.should_receive(:post).with("http://github.com", "GitHub")
|
|
24
|
-
ikachan.should_receive(:params)
|
|
25
|
-
subject.instance_variable_set(:@ikachan, ikachan)
|
|
26
|
-
subject.run.should have(1).feed
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe Automatic::Plugin::Ikachan do
|
|
31
|
-
describe "#post" do
|
|
32
|
-
subject {
|
|
33
|
-
Automatic::Plugin::Ikachan.new.tap {|ikachan|
|
|
34
|
-
ikachan.params = {
|
|
35
|
-
"channels" => "#room",
|
|
36
|
-
"url" => "http://sample.com",
|
|
37
|
-
"port" => "4979",
|
|
38
|
-
"command" => "notice",
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
specify {
|
|
44
|
-
link = "http://www.google.com"
|
|
45
|
-
|
|
46
|
-
require 'net/http'
|
|
47
|
-
res = double("res")
|
|
48
|
-
res.should_receive(:code).and_return("200")
|
|
49
|
-
http = double("http")
|
|
50
|
-
http.should_receive(:post).with("/join", "channel=#room")
|
|
51
|
-
http.should_receive(:post).with(
|
|
52
|
-
"/notice", "channel=#room&message=#{link}").and_return(res)
|
|
53
|
-
http.should_receive(:start).and_yield(http)
|
|
54
|
-
proxy = Net::HTTP.stub(:new) { http }
|
|
55
|
-
subject.post(link)
|
|
56
|
-
}
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Provide::Fluentd
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Created:: Jul 12, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 'provide/fluentd'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::ProvideFluentd do
|
|
14
|
-
context 'when feed' do
|
|
15
|
-
describe 'should forward the feeds' do
|
|
16
|
-
hash = {}
|
|
17
|
-
hash['test1'] = "test2"
|
|
18
|
-
hash['test3'] = "test4"
|
|
19
|
-
expect = hash
|
|
20
|
-
|
|
21
|
-
feeds = []
|
|
22
|
-
json = hash.to_json
|
|
23
|
-
data = ActiveSupport::JSON.decode(json)
|
|
24
|
-
url = "http://id774.net/test/xml/data"
|
|
25
|
-
rss = Automatic::FeedMaker.content_provide(url, data)
|
|
26
|
-
feeds << rss
|
|
27
|
-
|
|
28
|
-
subject {
|
|
29
|
-
Automatic::Plugin::ProvideFluentd.new(
|
|
30
|
-
{
|
|
31
|
-
'host' => "localhost",
|
|
32
|
-
'port' => "10000",
|
|
33
|
-
'tag' => "automatic_spec.provide_fluentd",
|
|
34
|
-
'mode' => "test"
|
|
35
|
-
},
|
|
36
|
-
feeds
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
its (:run) {
|
|
41
|
-
fluentd = double("fluentd")
|
|
42
|
-
subject.run.should have(1).feed
|
|
43
|
-
subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.class == Hash
|
|
44
|
-
subject.instance_variable_get(:@pipeline)[0].items[0].content_encoded.should == expect
|
|
45
|
-
}
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::AmazonS3
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Created:: Feb 25, 2014
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 'publish/amazon_s3'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishAmazonS3 do
|
|
14
|
-
context 'when feed' do
|
|
15
|
-
describe 'should forward the feeds' do
|
|
16
|
-
subject {
|
|
17
|
-
Automatic::Plugin::PublishAmazonS3.new(
|
|
18
|
-
{
|
|
19
|
-
'access_key' => "aabbcc",
|
|
20
|
-
'secret_key' => "ddeeff",
|
|
21
|
-
'bucket_name' => "test_bucket",
|
|
22
|
-
'target_path' => "test/tmp",
|
|
23
|
-
'mode' => "test"
|
|
24
|
-
},
|
|
25
|
-
AutomaticSpec.generate_pipeline{
|
|
26
|
-
feed {
|
|
27
|
-
item "http://github.com", "hoge",
|
|
28
|
-
"<a>fuga</a>"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
its (:run) {
|
|
35
|
-
subject.run.should have(1).feed
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Console
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Updated:: Feb 25, 2014
|
|
5
|
-
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
|
|
6
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
7
|
-
|
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
9
|
-
|
|
10
|
-
require 'publish/console'
|
|
11
|
-
|
|
12
|
-
describe Automatic::Plugin::PublishConsole do
|
|
13
|
-
before do
|
|
14
|
-
@pipeline = AutomaticSpec.generate_pipeline {
|
|
15
|
-
feed { item "http://github.com" }
|
|
16
|
-
}
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
subject {
|
|
20
|
-
Automatic::Plugin::PublishConsole.new({}, @pipeline)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
it "should output pretty inspect of feeds" do
|
|
24
|
-
output = double("output")
|
|
25
|
-
output.should_receive(:puts).
|
|
26
|
-
with("info", @pipeline[0].items[0].pretty_inspect)
|
|
27
|
-
subject.instance_variable_set(:@output, output)
|
|
28
|
-
subject.run.should have(1).items
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Eject
|
|
3
|
-
# Author:: soramugi <http://soramugi.net>
|
|
4
|
-
# Created:: Jun 9, 2013
|
|
5
|
-
# Updated:: Jun 9, 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 'publish/eject'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishEject do
|
|
14
|
-
before do
|
|
15
|
-
@pipeline = AutomaticSpec.generate_pipeline {
|
|
16
|
-
feed { item "http://github.com" }}
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
subject {
|
|
20
|
-
Automatic::Plugin::PublishEject.new({}, @pipeline)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
it "should eject of feeds" do
|
|
24
|
-
subject.stub(:eject_cmd).and_return('echo')
|
|
25
|
-
subject.run.should have(1).items
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
subject {
|
|
29
|
-
Automatic::Plugin::PublishEject.new({'interval' => 0}, @pipeline)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
it "should eject of feeds" do
|
|
33
|
-
subject.stub(:eject_cmd).and_return('echo')
|
|
34
|
-
subject.run.should have(1).items
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "should eject_cmd" do
|
|
38
|
-
subject.eject_cmd.should_not == ''
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Fluentd
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Created:: Jun 21, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 'publish/fluentd'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishFluentd do
|
|
14
|
-
context 'when feed' do
|
|
15
|
-
describe 'should forward the feeds' do
|
|
16
|
-
subject {
|
|
17
|
-
Automatic::Plugin::PublishFluentd.new(
|
|
18
|
-
{
|
|
19
|
-
'host' => "localhost",
|
|
20
|
-
'port' => "10000",
|
|
21
|
-
'tag' => "automatic_spec.publish_fluent",
|
|
22
|
-
'mode' => "test"
|
|
23
|
-
},
|
|
24
|
-
AutomaticSpec.generate_pipeline{
|
|
25
|
-
feed {
|
|
26
|
-
item "http://github.com", "hoge",
|
|
27
|
-
"<a>fuga</a>"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
its (:run) {
|
|
34
|
-
fluentd = double("fluentd")
|
|
35
|
-
subject.run.should have(1).feed
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::CustomFeed::SVNFLog
|
|
3
|
-
# Author:: kzgs
|
|
4
|
-
# Created:: Feb 26, 2012
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 'publish/google_calendar'
|
|
12
|
-
require 'gcalapi'
|
|
13
|
-
|
|
14
|
-
describe Automatic::Plugin::PublishGoogleCalendar do
|
|
15
|
-
subject {
|
|
16
|
-
Automatic::Plugin::PublishGoogleCalendar.new(
|
|
17
|
-
{"username" => "user", "password" => "pswd"},
|
|
18
|
-
AutomaticSpec.generate_pipeline{
|
|
19
|
-
feed {
|
|
20
|
-
item "http://github.com", "GitHub"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
it "should post the link in the feed" do
|
|
27
|
-
gc = double("gc")
|
|
28
|
-
gc.should_receive(:add).with("今日 GitHub")
|
|
29
|
-
subject.instance_variable_set(:@gc, gc)
|
|
30
|
-
subject.run.should have(1).feed
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe Automatic::Plugin::Googlecalendar do
|
|
35
|
-
describe "#add" do
|
|
36
|
-
context "All day events" do
|
|
37
|
-
specify {
|
|
38
|
-
set_gcal_mock(all_day_event_mock(
|
|
39
|
-
"花火@晴海", "", Time.mktime(2012, 8, 15)))
|
|
40
|
-
Automatic::Plugin::Googlecalendar.new.add("2012/8/15 花火@晴海")
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
specify {
|
|
44
|
-
lambda {
|
|
45
|
-
Automatic::Plugin::Googlecalendar.new.add("2012/2/30")
|
|
46
|
-
}.should raise_exception(RuntimeError, /不正な日付形式-1/)
|
|
47
|
-
}
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def all_day_event_mock(title, where, date=nil)
|
|
53
|
-
event = double("event")
|
|
54
|
-
{
|
|
55
|
-
:title => title,
|
|
56
|
-
:st => date.nil? ? nil : Time.mktime(date.year, date.month, date.day),
|
|
57
|
-
:en => nil,
|
|
58
|
-
:allday => true
|
|
59
|
-
}.each_pair do |key, value|
|
|
60
|
-
if value.nil?
|
|
61
|
-
event.should_receive("#{key}=".to_sym)
|
|
62
|
-
else
|
|
63
|
-
event.should_receive("#{key}=".to_sym).with(value)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
event.should_receive(:st)
|
|
67
|
-
event.should_receive(:save!)
|
|
68
|
-
return event
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def cal_mock(event_mock)
|
|
72
|
-
cal = double("cal")
|
|
73
|
-
cal.should_receive(:create_event).and_return {
|
|
74
|
-
event_mock
|
|
75
|
-
}
|
|
76
|
-
return cal
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def set_gcal_mock(event_mock)
|
|
80
|
-
GoogleCalendar::Calendar.stub(:new) {
|
|
81
|
-
cal_mock(event_mock)
|
|
82
|
-
}
|
|
83
|
-
end
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::HatenaBookmark
|
|
3
|
-
# Author:: 774 <http://id774.net>
|
|
4
|
-
# Created:: Feb 22, 2012
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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 'publish/hatena_bookmark'
|
|
12
|
-
|
|
13
|
-
describe Automatic::Plugin::PublishHatenaBookmark do
|
|
14
|
-
subject {
|
|
15
|
-
Automatic::Plugin::PublishHatenaBookmark.new(
|
|
16
|
-
{"username" => "user", "password" => "pswd"},
|
|
17
|
-
AutomaticSpec.generate_pipeline{
|
|
18
|
-
feed { item "http://github.com" }
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
it "should post the link with prefix 'http' in the feed" do
|
|
24
|
-
hb = double("hb")
|
|
25
|
-
hb.should_receive(:post).with("http://github.com", nil)
|
|
26
|
-
subject.instance_variable_set(:@hb, hb)
|
|
27
|
-
subject.run.should have(1).feed
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe Automatic::Plugin::PublishHatenaBookmark do
|
|
32
|
-
subject {
|
|
33
|
-
Automatic::Plugin::PublishHatenaBookmark.new(
|
|
34
|
-
{"username" => "user", "password" => "pswd"},
|
|
35
|
-
AutomaticSpec.generate_pipeline{
|
|
36
|
-
feed { item "//github.com" }
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
it "should post the link with prefix '//...' in the feed" do
|
|
42
|
-
hb = double("hb")
|
|
43
|
-
hb.should_receive(:post).with("http://github.com", nil)
|
|
44
|
-
subject.instance_variable_set(:@hb, hb)
|
|
45
|
-
subject.run.should have(1).feed
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe Automatic::Plugin::PublishHatenaBookmark do
|
|
50
|
-
subject {
|
|
51
|
-
Automatic::Plugin::PublishHatenaBookmark.new(
|
|
52
|
-
{"username" => "user", "password" => "pswd"},
|
|
53
|
-
AutomaticSpec.generate_pipeline{
|
|
54
|
-
feed { item "https://github.com" }
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
it "should post the link with prefix 'https' in the feed" do
|
|
60
|
-
hb = double("hb")
|
|
61
|
-
hb.should_receive(:post).with("https://github.com", nil)
|
|
62
|
-
subject.instance_variable_set(:@hb, hb)
|
|
63
|
-
subject.run.should have(1).feed
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe Automatic::Plugin::PublishHatenaBookmark do
|
|
68
|
-
subject {
|
|
69
|
-
Automatic::Plugin::PublishHatenaBookmark.new(
|
|
70
|
-
{"username" => "user", "password" => "pswd"},
|
|
71
|
-
AutomaticSpec.generate_pipeline{
|
|
72
|
-
feed { item "github.com" }
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
it "should post the link with others in the feed" do
|
|
78
|
-
hb = double("hb")
|
|
79
|
-
hb.should_receive(:post).with("http://github.com", nil)
|
|
80
|
-
subject.instance_variable_set(:@hb, hb)
|
|
81
|
-
subject.run.should have(1).feed
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe Automatic::Plugin::HatenaBookmark do
|
|
86
|
-
describe "#wsse" do
|
|
87
|
-
subject {
|
|
88
|
-
Automatic::Plugin::HatenaBookmark.new.wsse("anonymous", "pswd")
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
it { should be_has_key('X-WSSE') }
|
|
92
|
-
|
|
93
|
-
specify {
|
|
94
|
-
subject['X-WSSE'].should match(
|
|
95
|
-
/^UsernameToken\sUsername="anonymous",\sPasswordDigest=".+", Nonce=".+", Created="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z"/)
|
|
96
|
-
}
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
describe "#post" do
|
|
100
|
-
subject {
|
|
101
|
-
Automatic::Plugin::HatenaBookmark.new
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
specify {
|
|
105
|
-
url = "http://www.google.com"
|
|
106
|
-
comment = "Can we trust them ?"
|
|
107
|
-
|
|
108
|
-
require 'net/http'
|
|
109
|
-
res = double("res")
|
|
110
|
-
res.should_receive(:code).and_return("201")
|
|
111
|
-
http = double("http")
|
|
112
|
-
http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
|
|
113
|
-
subject.wsse("", "")).and_return(res)
|
|
114
|
-
http.should_receive(:start).and_yield(http)
|
|
115
|
-
proxy = Net::HTTP.stub(:new) { http }
|
|
116
|
-
subject.post(url, comment)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
specify {
|
|
120
|
-
url = "http://www.google.com"
|
|
121
|
-
comment = "Can we trust them ?"
|
|
122
|
-
|
|
123
|
-
require 'net/http'
|
|
124
|
-
res = double("res")
|
|
125
|
-
res.should_receive(:code).twice.and_return("400")
|
|
126
|
-
http = double("http")
|
|
127
|
-
http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
|
|
128
|
-
subject.wsse("", "")).and_return(res)
|
|
129
|
-
http.should_receive(:start).and_yield(http)
|
|
130
|
-
proxy = Net::HTTP.stub(:new) { http }
|
|
131
|
-
subject.post(url, comment)
|
|
132
|
-
}
|
|
133
|
-
end
|
|
134
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Hipchat
|
|
3
|
-
# Author:: Kohei Hasegawa <http://github.com/banyan>
|
|
4
|
-
# Created:: Jun 5, 2013
|
|
5
|
-
# Updated:: Feb 25, 2014
|
|
6
|
-
# Copyright:: Copyright (c) 2012-2014 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
|
-
require 'publish/hipchat'
|
|
11
|
-
|
|
12
|
-
describe Automatic::Plugin::PublishHipchat do
|
|
13
|
-
let(:config) {
|
|
14
|
-
{
|
|
15
|
-
'api_token' => "bogus_api_token",
|
|
16
|
-
'room_id' => 'bogus_room',
|
|
17
|
-
'username' => 'bogus_bot',
|
|
18
|
-
'interval' => 1,
|
|
19
|
-
'retry' => 1
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let(:pipeline) {
|
|
24
|
-
AutomaticSpec.generate_pipeline {
|
|
25
|
-
feed { item("http://github.com", 'title', 'description') }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
context 'return feed' do
|
|
30
|
-
subject {
|
|
31
|
-
described_class.new(config, pipeline)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
context 'when successfully' do
|
|
35
|
-
it "should passed proper argument to HipChat::Client" do
|
|
36
|
-
client = double('client').as_null_object
|
|
37
|
-
HipChat::Client.should_receive(:new).with("bogus_api_token").and_return(client)
|
|
38
|
-
subject.run
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should post the link in the feed" do
|
|
42
|
-
client = double("client")
|
|
43
|
-
client.should_receive(:send).with('bogus_bot', 'description', {"color"=>"yellow", "notify"=>false})
|
|
44
|
-
subject.instance_variable_set(:@client, client)
|
|
45
|
-
subject.run.should have(1).feed
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
context 'when raise an error during post' do
|
|
50
|
-
it do
|
|
51
|
-
client = double("client")
|
|
52
|
-
client.stub(:send).and_raise
|
|
53
|
-
subject.instance_variable_set(:@client, client)
|
|
54
|
-
Automatic::Log.should_receive(:puts).twice
|
|
55
|
-
subject.run.should have(1).feed
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context 'when feed is empty' do
|
|
61
|
-
subject {
|
|
62
|
-
described_class.new(config)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
it "should not post" do
|
|
66
|
-
subject.run.should have(0).feed
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Name:: Automatic::Plugin::Publish::Instapaper
|
|
3
|
-
# Author:: soramugi <http://soramugi.net>
|
|
4
|
-
# 774 <http://id774.net>
|
|
5
|
-
# Created:: Feb 9, 2013
|
|
6
|
-
# Updated:: Feb 25, 2014
|
|
7
|
-
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
|
|
8
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
|
-
|
|
10
|
-
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
11
|
-
|
|
12
|
-
require 'publish/instapaper'
|
|
13
|
-
|
|
14
|
-
describe Automatic::Plugin::PublishInstapaper do
|
|
15
|
-
context 'when feed' do
|
|
16
|
-
subject {
|
|
17
|
-
Automatic::Plugin::PublishInstapaper.new(
|
|
18
|
-
{ 'email' => "email@example.com",
|
|
19
|
-
'password' => "pswd",
|
|
20
|
-
'interval' => 5,
|
|
21
|
-
'retry' => 5
|
|
22
|
-
},
|
|
23
|
-
AutomaticSpec.generate_pipeline {
|
|
24
|
-
feed { item "http://github.com" }
|
|
25
|
-
})}
|
|
26
|
-
|
|
27
|
-
it "should post the link in the feed" do
|
|
28
|
-
instapaper = double("instapaper")
|
|
29
|
-
instapaper.should_receive(:add).with("http://github.com", nil, '')
|
|
30
|
-
subject.instance_variable_set(:@instapaper, instapaper)
|
|
31
|
-
subject.run.should have(1).feed
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
context 'when feed is empty' do
|
|
36
|
-
subject {
|
|
37
|
-
Automatic::Plugin::PublishInstapaper.new(
|
|
38
|
-
{ 'email' => "email@example.com",
|
|
39
|
-
'password' => "pswd",
|
|
40
|
-
'interval' => 1,
|
|
41
|
-
'retry' => 1
|
|
42
|
-
},
|
|
43
|
-
AutomaticSpec.generate_pipeline {
|
|
44
|
-
feed { item "http://github.com" }
|
|
45
|
-
})}
|
|
46
|
-
|
|
47
|
-
its (:run) { subject.run.should have(1).feed }
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe Automatic::Plugin::Instapaper do
|
|
52
|
-
describe "#add" do
|
|
53
|
-
subject {
|
|
54
|
-
Automatic::Plugin::Instapaper.new(
|
|
55
|
-
{ 'email' => "email@example.com",
|
|
56
|
-
'password' => "pswd",
|
|
57
|
-
'interval' => 5,
|
|
58
|
-
'retry' => 5
|
|
59
|
-
})}
|
|
60
|
-
|
|
61
|
-
url = "http://www.google.com"
|
|
62
|
-
title = "automatic test"
|
|
63
|
-
description = "automatic test"
|
|
64
|
-
|
|
65
|
-
specify {
|
|
66
|
-
res = double("res")
|
|
67
|
-
res.should_receive(:code).and_return("201")
|
|
68
|
-
subject.should_receive(:request).and_return(res)
|
|
69
|
-
subject.add(url, title, description)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
it 'raise error' do
|
|
74
|
-
lambda{
|
|
75
|
-
res = double("res")
|
|
76
|
-
res.should_receive(:code).twice.and_return("403")
|
|
77
|
-
subject.should_receive(:request).and_return(res)
|
|
78
|
-
subject.add(url, title, description)
|
|
79
|
-
}.should raise_error
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|