automatic 13.4.1 → 13.5.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 +3 -0
- data/README.md +3 -3
- data/Rakefile +6 -3
- data/VERSION +1 -1
- data/automatic.gemspec +29 -3
- data/bin/automatic +4 -1
- data/doc/ChangeLog +15 -1
- data/doc/PLUGINS +107 -0
- data/doc/PLUGINS.ja +107 -0
- data/doc/README +4 -4
- data/doc/README.ja +4 -4
- data/lib/automatic/feed_parser.rb +2 -2
- data/lib/automatic.rb +2 -2
- data/plugins/filter/ignore.rb +8 -0
- data/plugins/filter/one.rb +36 -0
- data/plugins/filter/rand.rb +28 -0
- data/plugins/publish/pocket.rb +44 -0
- data/plugins/publish/twitter.rb +57 -0
- data/plugins/store/target_link.rb +10 -9
- data/plugins/subscription/google_reader_star.rb +1 -1
- data/plugins/subscription/text.rb +85 -0
- data/plugins/subscription/weather.rb +66 -0
- data/script/build +3 -1
- data/spec/lib/automatic_spec.rb +2 -2
- data/spec/plugins/filter/ignore_spec.rb +49 -0
- data/spec/plugins/filter/one_spec.rb +71 -0
- data/spec/plugins/filter/rand_spec.rb +52 -0
- data/spec/plugins/publish/pocket_spec.rb +51 -0
- data/spec/plugins/publish/twitter_spec.rb +35 -0
- data/spec/plugins/store/target_link_spec.rb +1 -1
- data/spec/plugins/subscription/feed_spec.rb +2 -2
- data/spec/plugins/subscription/text_spec.rb +67 -0
- data/spec/plugins/subscription/weather_spec.rb +57 -0
- data/spec/spec_helper.rb +1 -1
- data/test/integration/test_add_pocket.yml +23 -0
- data/test/integration/test_one.yml +22 -0
- data/test/integration/test_rand.yml +20 -0
- data/test/integration/test_text2feed.yml +27 -0
- data/test/integration/test_weather.yml +18 -0
- metadata +68 -3
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Pocket
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 15, 2013
|
5
|
+
# Updated:: May 15, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class PublishPocket
|
11
|
+
require 'pocket'
|
12
|
+
|
13
|
+
def initialize(config, pipeline=[])
|
14
|
+
@config = config
|
15
|
+
@pipeline = pipeline
|
16
|
+
Pocket.configure do |c|
|
17
|
+
c.consumer_key = @config['consumer_key']
|
18
|
+
c.access_token = @config['access_token']
|
19
|
+
end
|
20
|
+
@client = Pocket.client
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
@pipeline.each {|feeds|
|
25
|
+
unless feeds.nil?
|
26
|
+
feeds.items.each {|feed|
|
27
|
+
retries = 0
|
28
|
+
begin
|
29
|
+
@client.add(:url => feed.link)
|
30
|
+
Automatic::Log.puts("info", "add: #{feed.link}")
|
31
|
+
rescue
|
32
|
+
retries += 1
|
33
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to pocket.")
|
34
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
35
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
36
|
+
end
|
37
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
38
|
+
}
|
39
|
+
end
|
40
|
+
}
|
41
|
+
@pipeline
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Twitter
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 5, 2013
|
5
|
+
# Updated:: May 5, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class PublishTwitter
|
11
|
+
require 'twitter'
|
12
|
+
|
13
|
+
def initialize(config, pipeline=[])
|
14
|
+
@config = config
|
15
|
+
@pipeline = pipeline
|
16
|
+
|
17
|
+
Twitter.configure do |conf|
|
18
|
+
conf.consumer_key = @config['consumer_key']
|
19
|
+
conf.consumer_secret = @config['consumer_secret']
|
20
|
+
conf.oauth_token = @config['oauth_token']
|
21
|
+
conf.oauth_token_secret = @config['oauth_token_secret']
|
22
|
+
end
|
23
|
+
@twitter = Twitter
|
24
|
+
|
25
|
+
if @config['tweet_tmp'] == nil
|
26
|
+
@tweet_tmp = '{title} {link}'
|
27
|
+
else
|
28
|
+
@tweet_tmp = @config['tweet_tmp']
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
@pipeline.each {|feeds|
|
35
|
+
unless feeds.nil?
|
36
|
+
feeds.items.each {|feed|
|
37
|
+
Automatic::Log.puts("info", "tweet: #{feed.link}")
|
38
|
+
retries = 0
|
39
|
+
begin
|
40
|
+
tweet = @tweet_tmp.gsub(/\{(.+?)\}/) do |text|
|
41
|
+
feed.__send__($1)
|
42
|
+
end
|
43
|
+
@twitter.update(tweet)
|
44
|
+
rescue
|
45
|
+
retries += 1
|
46
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in publish to twitter.")
|
47
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
48
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
49
|
+
end
|
50
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
51
|
+
}
|
52
|
+
end
|
53
|
+
}
|
54
|
+
@pipeline
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -17,15 +17,6 @@ module Automatic::Plugin
|
|
17
17
|
@pipeline = pipeline
|
18
18
|
end
|
19
19
|
|
20
|
-
def wget(url)
|
21
|
-
filename = url.split(/\//).last
|
22
|
-
open(url) { |source|
|
23
|
-
open(File.join(@config['path'], filename), "w+b") { |o|
|
24
|
-
o.print source.read
|
25
|
-
}
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
20
|
def run
|
30
21
|
@pipeline.each {|feeds|
|
31
22
|
unless feeds.nil?
|
@@ -48,5 +39,15 @@ module Automatic::Plugin
|
|
48
39
|
}
|
49
40
|
@pipeline
|
50
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def wget(url)
|
45
|
+
filename = url.split(/\//).last
|
46
|
+
open(url) { |source|
|
47
|
+
open(File.join(@config['path'], filename), "w+b") { |o|
|
48
|
+
o.print source.read
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
51
52
|
end
|
52
53
|
end
|
@@ -40,7 +40,7 @@ module Automatic::Plugin
|
|
40
40
|
maker.xml_stylesheets.new_xml_stylesheet
|
41
41
|
maker.channel.title = "Automatic Ruby"
|
42
42
|
maker.channel.description = "Automatic Ruby"
|
43
|
-
maker.channel.link = "https://github.com/
|
43
|
+
maker.channel.link = "https://github.com/automaticruby/automaticruby"
|
44
44
|
maker.items.do_sort = true
|
45
45
|
|
46
46
|
unless feeds.nil?
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Subscription::Text
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 6, 2013
|
5
|
+
# Updated:: May 6, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class TextFeed
|
11
|
+
def initialize
|
12
|
+
@link = 'http://dummy'
|
13
|
+
@title = 'dummy'
|
14
|
+
end
|
15
|
+
|
16
|
+
def link
|
17
|
+
@link
|
18
|
+
end
|
19
|
+
|
20
|
+
def title
|
21
|
+
@title
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_link(link)
|
25
|
+
@link = link
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_title(title)
|
29
|
+
@title = title
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class SubscriptionText
|
34
|
+
|
35
|
+
def initialize(config, pipeline=[])
|
36
|
+
@config = config
|
37
|
+
@pipeline = pipeline
|
38
|
+
|
39
|
+
unless @config.nil?
|
40
|
+
@dummyfeeds = []
|
41
|
+
unless @config['titles'].nil?
|
42
|
+
@config['titles'].each {|title|
|
43
|
+
textFeed = TextFeed.new
|
44
|
+
textFeed.set_title(title)
|
45
|
+
@dummyfeeds << textFeed
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
unless @config['urls'].nil?
|
50
|
+
@config['urls'].each {|url|
|
51
|
+
textFeed = TextFeed.new
|
52
|
+
textFeed.set_link(url)
|
53
|
+
@dummyfeeds << textFeed
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
unless @config['feeds'].nil?
|
58
|
+
@config['feeds'].each {|feed|
|
59
|
+
textFeed = TextFeed.new
|
60
|
+
textFeed.set_title(feed['title']) unless feed['title'].nil?
|
61
|
+
textFeed.set_link(feed['url']) unless feed['url'].nil?
|
62
|
+
@dummyfeeds << textFeed
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def run
|
70
|
+
retries = 0
|
71
|
+
begin
|
72
|
+
if @dummyfeeds != []
|
73
|
+
@pipeline << Automatic::FeedParser.create(@dummyfeeds)
|
74
|
+
end
|
75
|
+
rescue
|
76
|
+
retries += 1
|
77
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}")
|
78
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
79
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
80
|
+
end
|
81
|
+
|
82
|
+
@pipeline
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Subscription::Weather
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 12, 2013
|
5
|
+
# Updated:: May 12, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class WeatherFeed
|
11
|
+
def initialize
|
12
|
+
@link = 'http://weather.dummy'
|
13
|
+
@title = 'weather-dummy'
|
14
|
+
end
|
15
|
+
|
16
|
+
def link
|
17
|
+
@link
|
18
|
+
end
|
19
|
+
|
20
|
+
def title
|
21
|
+
@title
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_link(link)
|
25
|
+
@link = link
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_title(title)
|
29
|
+
@title = title
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class SubscriptionWeather
|
34
|
+
require 'weather_hacker'
|
35
|
+
|
36
|
+
def initialize(config, pipeline=[])
|
37
|
+
@config = config
|
38
|
+
@pipeline = pipeline
|
39
|
+
@weather = WeatherHacker.new(@config['zipcode'])
|
40
|
+
@day = 'today'
|
41
|
+
@day = @config['day'] unless @config['day'].nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
retries = 0
|
46
|
+
begin
|
47
|
+
weather = @weather.send(@day)['weather'] unless @weather.send(@day).nil?
|
48
|
+
if weather != nil
|
49
|
+
dummyfeed = WeatherFeed.new
|
50
|
+
dummyfeed.set_title(weather)
|
51
|
+
dummyfeed.set_link(dummyfeed.link + '.' + @day)
|
52
|
+
dummyfeeds = []
|
53
|
+
dummyfeeds << dummyfeed
|
54
|
+
@pipeline << Automatic::FeedParser.create(dummyfeeds)
|
55
|
+
end
|
56
|
+
rescue
|
57
|
+
retries += 1
|
58
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{dummyfeed}")
|
59
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
60
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
61
|
+
end
|
62
|
+
|
63
|
+
@pipeline
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/script/build
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
#
|
7
7
|
# Maintainer: id774 <idnanashi@gmail.com>
|
8
8
|
#
|
9
|
+
# v1.4 5/13,2013
|
10
|
+
# Fix bundler environment.
|
9
11
|
# v1.3 2/26,2013
|
10
12
|
# Remove script/bootstrap.
|
11
13
|
# v1.2 6/16,2012
|
@@ -33,7 +35,7 @@ exec_rspec() {
|
|
33
35
|
run_test() {
|
34
36
|
while [ $# -gt 0 ]
|
35
37
|
do
|
36
|
-
$RACK_ROOT/bin/automatic -c $1
|
38
|
+
bundle exec $RACK_ROOT/bin/automatic -c $1
|
37
39
|
test_subcommand log info $?
|
38
40
|
shift
|
39
41
|
done
|
data/spec/lib/automatic_spec.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: kzgs
|
4
4
|
# 774 <http://id774.net>
|
5
5
|
# Created:: Mar 9, 2012
|
6
|
-
# Updated::
|
6
|
+
# Updated:: May 18, 2013
|
7
7
|
# Copyright:: kzgs Copyright (c) 2012-2013
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
9
|
|
@@ -26,7 +26,7 @@ describe Automatic do
|
|
26
26
|
|
27
27
|
describe "#version" do
|
28
28
|
specify {
|
29
|
-
Automatic.const_get(:VERSION).should == "13.
|
29
|
+
Automatic.const_get(:VERSION).should == "13.5.0"
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
@@ -10,6 +10,55 @@ require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
|
10
10
|
require 'filter/ignore'
|
11
11
|
|
12
12
|
describe Automatic::Plugin::FilterIgnore do
|
13
|
+
|
14
|
+
context "with exclusion by title" do
|
15
|
+
subject {
|
16
|
+
Automatic::Plugin::FilterIgnore.new({
|
17
|
+
'title' => [""],
|
18
|
+
},
|
19
|
+
AutomaticSpec.generate_pipeline {
|
20
|
+
feed { item "http://github.com", "foo" }
|
21
|
+
feed { item "http://google.com", "hi" }
|
22
|
+
})
|
23
|
+
}
|
24
|
+
|
25
|
+
describe "#run" do
|
26
|
+
its(:run) { should have(0).feeds }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "with exclusion by title" do
|
31
|
+
subject {
|
32
|
+
Automatic::Plugin::FilterIgnore.new({
|
33
|
+
'title' => ["foo"],
|
34
|
+
},
|
35
|
+
AutomaticSpec.generate_pipeline {
|
36
|
+
feed { item "http://github.com", "foo" }
|
37
|
+
feed { item "http://google.com", "hi" }
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
describe "#run" do
|
42
|
+
its(:run) { should have(1).feeds }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "with exclusion by title" do
|
47
|
+
subject {
|
48
|
+
Automatic::Plugin::FilterIgnore.new({
|
49
|
+
'title' => ["o"],
|
50
|
+
},
|
51
|
+
AutomaticSpec.generate_pipeline {
|
52
|
+
feed { item "http://github.com", "foo" }
|
53
|
+
feed { item "http://google.com", "hi" }
|
54
|
+
})
|
55
|
+
}
|
56
|
+
|
57
|
+
describe "#run" do
|
58
|
+
its(:run) { should have(1).feeds }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
13
62
|
context "with exclusion by links" do
|
14
63
|
subject {
|
15
64
|
Automatic::Plugin::FilterIgnore.new({
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Filter::One
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 8, 2013
|
5
|
+
# Updated:: May 8, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
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/one'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::FilterOne do
|
14
|
+
context "It should be one" do
|
15
|
+
subject {
|
16
|
+
Automatic::Plugin::FilterOne.new(
|
17
|
+
{},
|
18
|
+
AutomaticSpec.generate_pipeline {
|
19
|
+
feed {
|
20
|
+
item "http://aaa.png"
|
21
|
+
item "http://bbb.png"
|
22
|
+
item "http://ccc.png"
|
23
|
+
item "http://ddd.png"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
describe "#run" do
|
30
|
+
its(:run) { should have(1).feeds }
|
31
|
+
|
32
|
+
specify {
|
33
|
+
subject.run
|
34
|
+
subject.instance_variable_get(:@return_feeds)[0].items.
|
35
|
+
count.should == 1
|
36
|
+
subject.instance_variable_get(:@return_feeds)[0].items[0].link.
|
37
|
+
should == 'http://aaa.png'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "It should be one last" do
|
43
|
+
subject {
|
44
|
+
Automatic::Plugin::FilterOne.new(
|
45
|
+
{
|
46
|
+
'pick' => "last"
|
47
|
+
},
|
48
|
+
AutomaticSpec.generate_pipeline {
|
49
|
+
feed {
|
50
|
+
item "http://aaa.png"
|
51
|
+
item "http://bbb.png"
|
52
|
+
item "http://ccc.png"
|
53
|
+
item "http://ddd.png"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
)
|
57
|
+
}
|
58
|
+
|
59
|
+
describe "#run" do
|
60
|
+
its(:run) { should have(1).feeds }
|
61
|
+
|
62
|
+
specify {
|
63
|
+
subject.run
|
64
|
+
subject.instance_variable_get(:@return_feeds)[0].items.
|
65
|
+
count.should == 1
|
66
|
+
subject.instance_variable_get(:@return_feeds)[0].items[0].link.
|
67
|
+
should == 'http://ddd.png'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Filter::Rand
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# 774 <http://id774.net>
|
5
|
+
# Created:: May 6, 2013
|
6
|
+
# Updated:: Mar 7, 2013
|
7
|
+
# Copyright:: soramugi Copyright (c) 2013
|
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 'filter/rand'
|
13
|
+
|
14
|
+
describe Automatic::Plugin::FilterRand do
|
15
|
+
context "It should be rand" do
|
16
|
+
subject {
|
17
|
+
Automatic::Plugin::FilterRand.new(
|
18
|
+
{},
|
19
|
+
AutomaticSpec.generate_pipeline {
|
20
|
+
feed {
|
21
|
+
item "http://aaa.png"
|
22
|
+
item "http://bbb.png"
|
23
|
+
item "http://ccc.png"
|
24
|
+
item "http://ddd.png"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
)
|
28
|
+
}
|
29
|
+
|
30
|
+
describe "#run" do
|
31
|
+
its(:run) { should have(1).feeds }
|
32
|
+
|
33
|
+
specify {
|
34
|
+
subject.run
|
35
|
+
link0 = subject.instance_variable_get(:@return_feeds)[0].items[0].link
|
36
|
+
link1 = subject.instance_variable_get(:@return_feeds)[0].items[1].link
|
37
|
+
link2 = subject.instance_variable_get(:@return_feeds)[0].items[2].link
|
38
|
+
link3 = subject.instance_variable_get(:@return_feeds)[0].items[3].link
|
39
|
+
if link0 != "http://aaa.png"
|
40
|
+
link0.should_not == "http://aaa.png"
|
41
|
+
elsif link1 != "http://bbb.png"
|
42
|
+
link1.should_not == "http://bbb.png"
|
43
|
+
elsif link2 != "http://ccc.png"
|
44
|
+
link2.should_not == "http://ccc.png"
|
45
|
+
else
|
46
|
+
pending("Plugin returns the origin feed.")
|
47
|
+
link3.should == "http://ddd.png"
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Pocket
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 15, 2013
|
5
|
+
# Updated:: May 15, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
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/pocket'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::PublishPocket do
|
14
|
+
subject {
|
15
|
+
Automatic::Plugin::PublishPocket.new(
|
16
|
+
{ 'consumer_key' => "hugehuge",
|
17
|
+
'access_token' => "hogehoge",
|
18
|
+
'interval' => 1,
|
19
|
+
'retry' => 1
|
20
|
+
},
|
21
|
+
AutomaticSpec.generate_pipeline{
|
22
|
+
feed { item "http://github.com" }
|
23
|
+
}
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
it "should post the link in the feed" do
|
28
|
+
client = mock("client")
|
29
|
+
client.should_receive(:add).with(:url => 'http://github.com')
|
30
|
+
subject.instance_variable_set(:@client, client)
|
31
|
+
subject.run.should have(1).feed
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Automatic::Plugin::PublishPocket do
|
36
|
+
subject {
|
37
|
+
Automatic::Plugin::PublishPocket.new(
|
38
|
+
{ 'consumer_key' => "hugehuge",
|
39
|
+
'access_token' => "hogehoge",
|
40
|
+
'interval' => 1,
|
41
|
+
'retry' => 1
|
42
|
+
},
|
43
|
+
AutomaticSpec.generate_pipeline{
|
44
|
+
}
|
45
|
+
)
|
46
|
+
}
|
47
|
+
|
48
|
+
it "should un post" do
|
49
|
+
subject.run.should have(0).feed
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Twitter
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
4
|
+
# Created:: May 5, 2013
|
5
|
+
# Updated:: May 5, 2013
|
6
|
+
# Copyright:: soramugi Copyright (c) 2013
|
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/twitter'
|
12
|
+
|
13
|
+
describe Automatic::Plugin::PublishTwitter do
|
14
|
+
subject {
|
15
|
+
Automatic::Plugin::PublishTwitter.new(
|
16
|
+
{ 'consumer_key' => 'your_consumer_key',
|
17
|
+
'consumer_secret' => 'your_consumer_secret',
|
18
|
+
'oauth_token' => 'your_oauth_token',
|
19
|
+
'oauth_token_secret' => 'your_oauth_token_secret',
|
20
|
+
'interval' => 5,
|
21
|
+
'retry' => 5
|
22
|
+
},
|
23
|
+
AutomaticSpec.generate_pipeline{
|
24
|
+
feed { item "http://github.com" }
|
25
|
+
}
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
it "should post the link tweet" do
|
30
|
+
twitter = mock("twitter")
|
31
|
+
twitter.should_receive(:update).with(" http://github.com")
|
32
|
+
subject.instance_variable_set(:@twitter, twitter)
|
33
|
+
subject.run.should have(1).feed
|
34
|
+
end
|
35
|
+
end
|
@@ -34,7 +34,7 @@ describe Automatic::Plugin::SubscriptionFeed do
|
|
34
34
|
subject {
|
35
35
|
Automatic::Plugin::SubscriptionFeed.new(
|
36
36
|
{ 'feeds' => [
|
37
|
-
"https://github.com/
|
37
|
+
"https://github.com/automaticruby/automaticruby/commits/master.atom"]
|
38
38
|
}
|
39
39
|
)
|
40
40
|
}
|
@@ -46,7 +46,7 @@ describe Automatic::Plugin::SubscriptionFeed do
|
|
46
46
|
subject {
|
47
47
|
Automatic::Plugin::SubscriptionFeed.new(
|
48
48
|
{ 'feeds' => [
|
49
|
-
"https://github.com/
|
49
|
+
"https://github.com/automaticruby/automaticruby/commits/master.atom"],
|
50
50
|
'retry' => 3,
|
51
51
|
'interval' => 5
|
52
52
|
}
|