automatic 12.3.0 → 12.3.1

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.
Files changed (52) hide show
  1. data/Gemfile +1 -0
  2. data/README.md +54 -36
  3. data/Rakefile +14 -0
  4. data/VERSION +1 -1
  5. data/automatic.gemspec +17 -5
  6. data/bin/automatic +37 -3
  7. data/bin/automatic-config +77 -0
  8. data/config/default.yml +9 -12
  9. data/doc/ChangeLog +32 -8
  10. data/doc/PLUGINS +205 -0
  11. data/doc/PLUGINS.ja +2 -3
  12. data/doc/README +488 -0
  13. data/doc/README.ja +195 -131
  14. data/lib/automatic/feed_parser.rb +1 -9
  15. data/lib/automatic/log.rb +1 -9
  16. data/lib/automatic/opml.rb +239 -0
  17. data/lib/automatic/pipeline.rb +16 -10
  18. data/lib/automatic/recipe.rb +3 -4
  19. data/lib/automatic.rb +32 -38
  20. data/lib/config/validator.rb +83 -0
  21. data/plugins/custom_feed/svn_log.rb +1 -1
  22. data/plugins/filter/ignore.rb +9 -1
  23. data/plugins/notify/ikachan.rb +7 -6
  24. data/plugins/publish/hatena_bookmark.rb +6 -9
  25. data/script/build +63 -0
  26. data/spec/lib/automatic/pipeline_spec.rb +55 -0
  27. data/spec/lib/automatic_spec.rb +77 -0
  28. data/spec/lib/pipeline_spec.rb +67 -0
  29. data/spec/plugins/filter/ignore_spec.rb +16 -0
  30. data/spec/plugins/filter/image_spec.rb +4 -4
  31. data/spec/plugins/filter/tumblr_resize_spec.rb +4 -4
  32. data/spec/plugins/notify/ikachan_spec.rb +30 -0
  33. data/spec/plugins/publish/console_spec.rb +1 -2
  34. data/spec/plugins/publish/hatena_bookmark_spec.rb +36 -1
  35. data/spec/plugins/store/full_text_spec.rb +0 -2
  36. data/spec/plugins/store/permalink_spec.rb +0 -1
  37. data/spec/plugins/store/target_link_spec.rb +0 -1
  38. data/spec/plugins/subscription/feed_spec.rb +0 -1
  39. data/spec/spec_helper.rb +6 -4
  40. data/spec/user_dir/plugins/store/mock.rb +12 -0
  41. data/test/fixtures/sampleOPML.xml +11 -0
  42. data/test/integration/test_activerecord.yml +2 -2
  43. data/test/integration/test_fulltext.yml +3 -3
  44. data/test/integration/test_hatenabookmark.yml +6 -2
  45. data/test/integration/test_ignore.yml +4 -1
  46. data/test/integration/test_ignore2.yml +1 -4
  47. data/test/integration/test_image2local.yml +3 -5
  48. data/test/integration/test_svnlog.yml +2 -1
  49. data/test/integration/test_tumblr2local.yml +3 -3
  50. metadata +43 -22
  51. data/utils/auto_discovery.rb +0 -18
  52. data/utils/opml_parser.rb +0 -247
@@ -29,7 +29,7 @@ describe Automatic::Plugin::FilterTumblrResize do
29
29
  should == "http://29.media.tumblr.com/tumblr_m07wrcDBBF1qzoj1jo1_1280.jpg"
30
30
  }
31
31
  end
32
- end
32
+ end
33
33
  end
34
34
 
35
35
  describe Automatic::Plugin::FilterTumblrResize do
@@ -50,7 +50,7 @@ describe Automatic::Plugin::FilterTumblrResize do
50
50
  should == "http://24.media.tumblr.com/tumblr_m07wttnIdy1qzoj1jo1_1280.jpg"
51
51
  }
52
52
  end
53
- end
53
+ end
54
54
  end
55
55
 
56
56
  describe Automatic::Plugin::FilterTumblrResize do
@@ -71,7 +71,7 @@ describe Automatic::Plugin::FilterTumblrResize do
71
71
  should == "http://28.media.tumblr.com/tumblr_m07wtaxxSa1qzoj1jo1_1280.jpg"
72
72
  }
73
73
  end
74
- end
74
+ end
75
75
  end
76
76
 
77
77
  describe Automatic::Plugin::FilterTumblrResize do
@@ -98,5 +98,5 @@ describe Automatic::Plugin::FilterTumblrResize do
98
98
  should == "http://29.media.tumblr.com/tumblr_m07wrcDBBF1qzoj1jo1_1280.jpg"
99
99
  }
100
100
  end
101
- end
101
+ end
102
102
  end
@@ -26,3 +26,33 @@ describe Automatic::Plugin::NotifyIkachan do
26
26
  subject.run.should have(1).feed
27
27
  end
28
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 = stub("res")
48
+ res.should_receive(:code).and_return("200")
49
+ http = mock("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
@@ -18,7 +18,6 @@ describe Automatic::Plugin::PublishConsole do
18
18
  output.should_receive(:puts).
19
19
  with("info", @pipeline[0].items[0].pretty_inspect)
20
20
  subject.instance_variable_set(:@output, output)
21
- subject.run
21
+ subject.run
22
22
  end
23
23
  end
24
-
@@ -32,5 +32,40 @@ describe Automatic::Plugin::HatenaBookmark do
32
32
  /^UsernameToken\sUsername="anonymous",\sPasswordDigest=".+", Nonce=".+", Created="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z"/)
33
33
  }
34
34
  end
35
- end
36
35
 
36
+ describe "#post" do
37
+ subject {
38
+ Automatic::Plugin::HatenaBookmark.new
39
+ }
40
+
41
+ specify {
42
+ url = "http://www.google.com"
43
+ comment = "Can we trust them ?"
44
+
45
+ require 'net/http'
46
+ res = stub("res")
47
+ res.should_receive(:code).and_return("201")
48
+ http = mock("http")
49
+ http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
50
+ subject.wsse("", "")).and_return(res)
51
+ http.should_receive(:start).and_yield(http)
52
+ proxy = Net::HTTP.stub(:new) { http }
53
+ subject.post(url, comment)
54
+ }
55
+
56
+ specify {
57
+ url = "http://www.google.com"
58
+ comment = "Can we trust them ?"
59
+
60
+ require 'net/http'
61
+ res = stub("res")
62
+ res.should_receive(:code).twice.and_return("400")
63
+ http = mock("http")
64
+ http.should_receive(:post).with("/atom/post", subject.toXml(url, comment),
65
+ subject.wsse("", "")).and_return(res)
66
+ http.should_receive(:start).and_yield(http)
67
+ proxy = Net::HTTP.stub(:new) { http }
68
+ subject.post(url, comment)
69
+ }
70
+ end
71
+ end
@@ -1,4 +1,3 @@
1
-
2
1
  require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
3
2
 
4
3
  require 'store/full_text'
@@ -36,4 +35,3 @@ describe Automatic::Plugin::StoreFullText do
36
35
  }.should change(Automatic::Plugin::Blog, :count).by(0)
37
36
  end
38
37
  end
39
-
@@ -36,4 +36,3 @@ describe Automatic::Plugin::StorePermalink do
36
36
  }.should change(Automatic::Plugin::Permalink, :count).by(0)
37
37
  end
38
38
  end
39
-
@@ -27,4 +27,3 @@ describe Automatic::Plugin::StoreTargetLink do
27
27
  end
28
28
  end
29
29
  end
30
-
@@ -33,4 +33,3 @@ describe Automatic::Plugin::SubscriptionFeed do
33
33
  its(:run) { should have(1).feed }
34
34
  end
35
35
  end
36
-
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,10 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'plugins'))
3
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
1
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), ".."))
2
+ $LOAD_PATH.unshift APP_ROOT
3
+ $LOAD_PATH.unshift File.join(APP_ROOT)
4
+ $LOAD_PATH.unshift File.join(APP_ROOT, 'lib')
5
+ $LOAD_PATH.unshift File.join(APP_ROOT, 'plugins')
5
6
 
7
+ ENV["AUTOMATIC_RUBY_ENV"] ||= "test"
6
8
  Bundler.require :test if defined?(Bundler)
7
9
 
8
10
  if ENV['COVERAGE'] == 'on'
@@ -0,0 +1,12 @@
1
+ module Automatic::Plugin
2
+ class StoreMock
3
+ def initialize(config, pipeline = [])
4
+ @config = config
5
+ @pipeline = pipeline
6
+ end
7
+
8
+ def run
9
+ return @pipeline[0]
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <opml version="1.0">
3
+ <head>
4
+ <title>Sample OPML file</title>
5
+ </head>
6
+ <body>
7
+ <outline title="UserJS.org news" text="UserJS.org news" type="rss" version="RSS" xmlUrl="http://userjs.org/subscribe/news" htmlUrl="http://userjs.org/"/>
8
+ <outline title="Olli's blog" text="Olli's blog" type="rss" version="RSS" xmlUrl="http://my.opera.com/olli/xml/atom/blog/" htmlUrl="http://my.opera.com/olli/"/>
9
+ <outline title="Astronomy Picture of the Day" text="Astronomy Picture of the Day" type="rss" version="RSS" fix091="yes" xmlUrl="http://www.jwz.org/cheesegrater/RSS/apod.rss" htmlUrl="http://antwrp.gsfc.nasa.gov/apod/"/>
10
+ </body>
11
+ </opml>
@@ -13,12 +13,12 @@ plugins:
13
13
 
14
14
  - module: FilterIgnore
15
15
  config:
16
- exclude:
16
+ link:
17
17
  - hoge
18
18
 
19
19
  - module: StorePermalink
20
20
  config:
21
21
  db: test_permalink.db
22
22
 
23
- - module: PublishConsole
23
+ #- module: PublishConsole
24
24
 
@@ -13,12 +13,12 @@ plugins:
13
13
 
14
14
  - module: FilterIgnore
15
15
  config:
16
- exclude:
16
+ link:
17
17
  - hoge
18
18
 
19
- - module: PublishConsole
19
+ #- module: PublishConsole
20
20
 
21
21
  - module: StoreFullText
22
22
  config:
23
- db: blog.db
23
+ db: test_blog.db
24
24
 
@@ -13,14 +13,18 @@ plugins:
13
13
 
14
14
  - module: FilterIgnore
15
15
  config:
16
- exclude:
16
+ link:
17
17
  - hoge
18
18
 
19
+ - module: StorePermalink
20
+ config:
21
+ db: test_permalink.db
22
+
19
23
  - module: PublishHatenaBookmark
20
24
  config:
21
25
  username: username
22
26
  password: password
23
27
  interval: 1
24
28
 
25
- - module: PublishConsole
29
+ #- module: PublishConsole
26
30
 
@@ -15,8 +15,11 @@ plugins:
15
15
  config:
16
16
  title:
17
17
  - Twitter
18
+
19
+ - module: FilterIgnore
20
+ config:
18
21
  description:
19
22
  - Facebook
20
23
 
21
- - module: PublishConsole
24
+ #- module: PublishConsole
22
25
 
@@ -15,11 +15,8 @@ plugins:
15
15
  config:
16
16
  title:
17
17
  - Twitter
18
-
19
- - module: FilterIgnore
20
- config:
21
18
  description:
22
19
  - Facebook
23
20
 
24
- - module: PublishConsole
21
+ #- module: PublishConsole
25
22
 
@@ -9,18 +9,16 @@ plugins:
9
9
  - module: SubscriptionFeed
10
10
  config:
11
11
  feeds:
12
- - http://fotologue.jp/sleepyrabbit/rss.xml
12
+ - http://instagram.yuyuweb.cc/rss
13
13
 
14
14
  - module: StorePermalink
15
15
  config:
16
- db: image.db
16
+ db: test_image.db
17
17
 
18
18
  - module: FilterImage
19
19
 
20
- - module: FilterTumblrResize
21
-
22
20
  - module: StoreTargetLink
23
21
  config:
24
22
  path: /tmp
25
- interval: 1
23
+ interval: 2
26
24
 
@@ -11,4 +11,5 @@ plugins:
11
11
  target: http://redmine.rubyforge.org/svn
12
12
  fetch_items: 2
13
13
 
14
- - module: PublishConsole
14
+ #- module: PublishConsole
15
+
@@ -9,11 +9,11 @@ plugins:
9
9
  - module: SubscriptionFeed
10
10
  config:
11
11
  feeds:
12
- - http://reretlet.tumblr.com/rss
12
+ - http://reblog.id774.net/rss
13
13
 
14
14
  - module: StorePermalink
15
15
  config:
16
- db: image.db
16
+ db: test_tumblr.db
17
17
 
18
18
  - module: FilterImage
19
19
 
@@ -22,5 +22,5 @@ plugins:
22
22
  - module: StoreTargetLink
23
23
  config:
24
24
  path: /tmp
25
- interval: 1
25
+ interval: 2
26
26
 
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.3.0
4
+ version: 12.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-07 00:00:00.000000000 Z
12
+ date: 2012-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
16
- requirement: &78711590 !ruby/object:Gem::Requirement
16
+ requirement: &81889100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *78711590
24
+ version_requirements: *81889100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &78711240 !ruby/object:Gem::Requirement
27
+ requirement: &81888860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *78711240
35
+ version_requirements: *81888860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &78711000 !ruby/object:Gem::Requirement
38
+ requirement: &81888620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *78711000
46
+ version_requirements: *81888620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activerecord
49
- requirement: &78710750 !ruby/object:Gem::Requirement
49
+ requirement: &81888380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *78710750
57
+ version_requirements: *81888380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: gcalapi
60
- requirement: &78710460 !ruby/object:Gem::Requirement
60
+ requirement: &81888140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *78710460
68
+ version_requirements: *81888140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: xml-simple
71
- requirement: &78710200 !ruby/object:Gem::Requirement
71
+ requirement: &81887900 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,21 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *78710200
79
+ version_requirements: *81887900
80
+ - !ruby/object:Gem::Dependency
81
+ name: feedbag
82
+ requirement: &81887630 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *81887630
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: cucumber
82
- requirement: &78709930 !ruby/object:Gem::Requirement
93
+ requirement: &81903770 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *78709930
101
+ version_requirements: *81903770
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: bundler
93
- requirement: &78709670 !ruby/object:Gem::Requirement
104
+ requirement: &81903530 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: 1.0.0
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *78709670
112
+ version_requirements: *81903530
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: jeweler
104
- requirement: &78709430 !ruby/object:Gem::Requirement
115
+ requirement: &81903290 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,11 +120,12 @@ dependencies:
109
120
  version: 1.8.3
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *78709430
123
+ version_requirements: *81903290
113
124
  description: Ruby General Automation Framework
114
125
  email: idnanashi@gmail.com
115
126
  executables:
116
127
  - automatic
128
+ - automatic-config
117
129
  extensions: []
118
130
  extra_rdoc_files:
119
131
  - README.md
@@ -124,20 +136,25 @@ files:
124
136
  - VERSION
125
137
  - automatic.gemspec
126
138
  - bin/automatic
139
+ - bin/automatic-config
127
140
  - config/default.yml
128
141
  - config/feed2console.yml
129
142
  - db/.gitkeep
130
143
  - doc/AUTHORS
131
144
  - doc/COPYING
132
145
  - doc/ChangeLog
146
+ - doc/PLUGINS
133
147
  - doc/PLUGINS.ja
148
+ - doc/README
134
149
  - doc/README.ja
135
150
  - lib/automatic.rb
136
151
  - lib/automatic/environment.rb
137
152
  - lib/automatic/feed_parser.rb
138
153
  - lib/automatic/log.rb
154
+ - lib/automatic/opml.rb
139
155
  - lib/automatic/pipeline.rb
140
156
  - lib/automatic/recipe.rb
157
+ - lib/config/validator.rb
141
158
  - plugins/custom_feed/svn_log.rb
142
159
  - plugins/filter/ignore.rb
143
160
  - plugins/filter/image.rb
@@ -152,6 +169,10 @@ files:
152
169
  - plugins/store/target_link.rb
153
170
  - plugins/subscription/feed.rb
154
171
  - script/bootstrap
172
+ - script/build
173
+ - spec/lib/automatic/pipeline_spec.rb
174
+ - spec/lib/automatic_spec.rb
175
+ - spec/lib/pipeline_spec.rb
155
176
  - spec/plugins/custom_feed/svn_log_spec.rb
156
177
  - spec/plugins/filter/ignore_spec.rb
157
178
  - spec/plugins/filter/image_spec.rb
@@ -165,6 +186,8 @@ files:
165
186
  - spec/plugins/store/target_link_spec.rb
166
187
  - spec/plugins/subscription/feed_spec.rb
167
188
  - spec/spec_helper.rb
189
+ - spec/user_dir/plugins/store/mock.rb
190
+ - test/fixtures/sampleOPML.xml
168
191
  - test/integration/test_activerecord.yml
169
192
  - test/integration/test_fulltext.yml
170
193
  - test/integration/test_hatenabookmark.yml
@@ -173,8 +196,6 @@ files:
173
196
  - test/integration/test_image2local.yml
174
197
  - test/integration/test_svnlog.yml
175
198
  - test/integration/test_tumblr2local.yml
176
- - utils/auto_discovery.rb
177
- - utils/opml_parser.rb
178
199
  - vendor/.gitkeep
179
200
  homepage: http://github.com/id774/automaticruby
180
201
  licenses:
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- coding: utf-8 -*-
3
-
4
- class AutoDiscovery
5
- require 'rubygems'
6
- require 'feedbag'
7
-
8
- def search(url)
9
- Feedbag.find(url)
10
- end
11
- end
12
-
13
- if __FILE__ == $0
14
- require 'pp'
15
- url = ARGV.shift || abort("Usage: autodiscovery.rb <url>")
16
- auto_discovery = AutoDiscovery.new
17
- pp auto_discovery.search(url)
18
- end