automatic 12.3.1 → 12.4.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 +7 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/automatic.gemspec +21 -10
- data/bin/automatic-config +11 -0
- data/config/feed2console.yml +1 -1
- data/doc/ChangeLog +13 -0
- data/doc/PLUGINS +12 -0
- data/doc/PLUGINS.ja +12 -0
- data/doc/README +18 -6
- data/doc/README.ja +21 -6
- data/lib/automatic.rb +3 -3
- data/lib/automatic/recipe.rb +0 -1
- data/plugins/filter/reverse.rb +33 -0
- data/plugins/publish/mail.rb +64 -0
- data/plugins/publish/smtp.rb +48 -0
- data/script/build +2 -2
- data/spec/plugins/filter/reverse_spec.rb +55 -0
- data/spec/plugins/publish/mail_spec.rb +45 -0
- data/spec/plugins/publish/smtp_spec.rb +41 -0
- data/spec/plugins/store/full_text_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -5
- data/test/integration/test_activerecord.yml +1 -1
- data/test/integration/test_fulltext.yml +1 -1
- data/test/integration/test_googlealert.yml +21 -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_mail.yml +21 -0
- data/test/integration/test_reverse.yml +17 -0
- metadata +102 -28
- data/lib/config/validator.rb +0 -83
data/Gemfile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
# Version:
|
1
|
+
# Version:20120317
|
2
2
|
|
3
3
|
source :rubygems
|
4
|
+
source "http://gems.github.com"
|
4
5
|
|
5
6
|
gem 'sqlite3'
|
6
7
|
gem 'activesupport', '~>3'
|
7
8
|
gem 'hashie'
|
8
9
|
gem 'activerecord', '~>3'
|
10
|
+
gem 'actionmailer', '~>3'
|
9
11
|
gem 'gcalapi'
|
10
12
|
gem 'xml-simple'
|
11
13
|
gem 'feedbag'
|
@@ -15,10 +17,11 @@ group :test do
|
|
15
17
|
gem 'rcov', :platforms => :mri_18
|
16
18
|
gem 'simplecov'
|
17
19
|
gem 'simplecov-rcov'
|
20
|
+
gem 'koseki-mocksmtpd'
|
18
21
|
end
|
19
22
|
|
20
23
|
group :development do
|
21
|
-
gem "cucumber"
|
22
|
-
gem "bundler"
|
23
|
-
gem "jeweler"
|
24
|
+
gem "cucumber"
|
25
|
+
gem "bundler"
|
26
|
+
gem "jeweler"
|
24
27
|
end
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
12.
|
1
|
+
12.4.0
|
data/automatic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "automatic"
|
8
|
-
s.version = "12.
|
8
|
+
s.version = "12.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["id774"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-04-30"
|
13
13
|
s.description = "Ruby General Automation Framework"
|
14
14
|
s.email = "idnanashi@gmail.com"
|
15
15
|
s.executables = ["automatic", "automatic-config"]
|
@@ -41,15 +41,17 @@ Gem::Specification.new do |s|
|
|
41
41
|
"lib/automatic/opml.rb",
|
42
42
|
"lib/automatic/pipeline.rb",
|
43
43
|
"lib/automatic/recipe.rb",
|
44
|
-
"lib/config/validator.rb",
|
45
44
|
"plugins/custom_feed/svn_log.rb",
|
46
45
|
"plugins/filter/ignore.rb",
|
47
46
|
"plugins/filter/image.rb",
|
47
|
+
"plugins/filter/reverse.rb",
|
48
48
|
"plugins/filter/tumblr_resize.rb",
|
49
49
|
"plugins/notify/ikachan.rb",
|
50
50
|
"plugins/publish/console.rb",
|
51
51
|
"plugins/publish/google_calendar.rb",
|
52
52
|
"plugins/publish/hatena_bookmark.rb",
|
53
|
+
"plugins/publish/mail.rb",
|
54
|
+
"plugins/publish/smtp.rb",
|
53
55
|
"plugins/store/full_text.rb",
|
54
56
|
"plugins/store/permalink.rb",
|
55
57
|
"plugins/store/store_database.rb",
|
@@ -63,11 +65,14 @@ Gem::Specification.new do |s|
|
|
63
65
|
"spec/plugins/custom_feed/svn_log_spec.rb",
|
64
66
|
"spec/plugins/filter/ignore_spec.rb",
|
65
67
|
"spec/plugins/filter/image_spec.rb",
|
68
|
+
"spec/plugins/filter/reverse_spec.rb",
|
66
69
|
"spec/plugins/filter/tumblr_resize_spec.rb",
|
67
70
|
"spec/plugins/notify/ikachan_spec.rb",
|
68
71
|
"spec/plugins/publish/console_spec.rb",
|
69
72
|
"spec/plugins/publish/google_calendar_spec.rb",
|
70
73
|
"spec/plugins/publish/hatena_bookmark_spec.rb",
|
74
|
+
"spec/plugins/publish/mail_spec.rb",
|
75
|
+
"spec/plugins/publish/smtp_spec.rb",
|
71
76
|
"spec/plugins/store/full_text_spec.rb",
|
72
77
|
"spec/plugins/store/permalink_spec.rb",
|
73
78
|
"spec/plugins/store/target_link_spec.rb",
|
@@ -77,10 +82,13 @@ Gem::Specification.new do |s|
|
|
77
82
|
"test/fixtures/sampleOPML.xml",
|
78
83
|
"test/integration/test_activerecord.yml",
|
79
84
|
"test/integration/test_fulltext.yml",
|
85
|
+
"test/integration/test_googlealert.yml",
|
80
86
|
"test/integration/test_hatenabookmark.yml",
|
81
87
|
"test/integration/test_ignore.yml",
|
82
88
|
"test/integration/test_ignore2.yml",
|
83
89
|
"test/integration/test_image2local.yml",
|
90
|
+
"test/integration/test_mail.yml",
|
91
|
+
"test/integration/test_reverse.yml",
|
84
92
|
"test/integration/test_svnlog.yml",
|
85
93
|
"test/integration/test_tumblr2local.yml",
|
86
94
|
"vendor/.gitkeep"
|
@@ -88,7 +96,7 @@ Gem::Specification.new do |s|
|
|
88
96
|
s.homepage = "http://github.com/id774/automaticruby"
|
89
97
|
s.licenses = ["GPL"]
|
90
98
|
s.require_paths = ["lib"]
|
91
|
-
s.rubygems_version = "1.8.
|
99
|
+
s.rubygems_version = "1.8.19"
|
92
100
|
s.summary = "Automatic Ruby"
|
93
101
|
|
94
102
|
if s.respond_to? :specification_version then
|
@@ -99,35 +107,38 @@ Gem::Specification.new do |s|
|
|
99
107
|
s.add_runtime_dependency(%q<activesupport>, ["~> 3"])
|
100
108
|
s.add_runtime_dependency(%q<hashie>, [">= 0"])
|
101
109
|
s.add_runtime_dependency(%q<activerecord>, ["~> 3"])
|
110
|
+
s.add_runtime_dependency(%q<actionmailer>, ["~> 3"])
|
102
111
|
s.add_runtime_dependency(%q<gcalapi>, [">= 0"])
|
103
112
|
s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
|
104
113
|
s.add_runtime_dependency(%q<feedbag>, [">= 0"])
|
105
114
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
106
|
-
s.add_development_dependency(%q<bundler>, ["
|
107
|
-
s.add_development_dependency(%q<jeweler>, ["
|
115
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
116
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
108
117
|
else
|
109
118
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
110
119
|
s.add_dependency(%q<activesupport>, ["~> 3"])
|
111
120
|
s.add_dependency(%q<hashie>, [">= 0"])
|
112
121
|
s.add_dependency(%q<activerecord>, ["~> 3"])
|
122
|
+
s.add_dependency(%q<actionmailer>, ["~> 3"])
|
113
123
|
s.add_dependency(%q<gcalapi>, [">= 0"])
|
114
124
|
s.add_dependency(%q<xml-simple>, [">= 0"])
|
115
125
|
s.add_dependency(%q<feedbag>, [">= 0"])
|
116
126
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
117
|
-
s.add_dependency(%q<bundler>, ["
|
118
|
-
s.add_dependency(%q<jeweler>, ["
|
127
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
128
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
119
129
|
end
|
120
130
|
else
|
121
131
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
122
132
|
s.add_dependency(%q<activesupport>, ["~> 3"])
|
123
133
|
s.add_dependency(%q<hashie>, [">= 0"])
|
124
134
|
s.add_dependency(%q<activerecord>, ["~> 3"])
|
135
|
+
s.add_dependency(%q<actionmailer>, ["~> 3"])
|
125
136
|
s.add_dependency(%q<gcalapi>, [">= 0"])
|
126
137
|
s.add_dependency(%q<xml-simple>, [">= 0"])
|
127
138
|
s.add_dependency(%q<feedbag>, [">= 0"])
|
128
139
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
129
|
-
s.add_dependency(%q<bundler>, ["
|
130
|
-
s.add_dependency(%q<jeweler>, ["
|
140
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
141
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
131
142
|
end
|
132
143
|
end
|
133
144
|
|
data/bin/automatic-config
CHANGED
@@ -10,11 +10,13 @@
|
|
10
10
|
root_dir = File.expand_path("..", File.dirname(__FILE__))
|
11
11
|
$:.unshift root_dir + '/lib'
|
12
12
|
|
13
|
+
require 'automatic'
|
13
14
|
require 'rubygems'
|
14
15
|
require 'optparse'
|
15
16
|
|
16
17
|
parser = OptionParser.new { |opt|
|
17
18
|
}
|
19
|
+
parser.version = Automatic.const_get(:VERSION)
|
18
20
|
|
19
21
|
def abort_with_usage(subcommand, message)
|
20
22
|
top_filename = File.basename($0)
|
@@ -56,6 +58,15 @@ subparsers = {
|
|
56
58
|
rss_results = Automatic::FeedParser.get_rss(url)
|
57
59
|
pp rss_results
|
58
60
|
},
|
61
|
+
'inspect' => lambda { |argv|
|
62
|
+
require 'automatic/feed_parser'
|
63
|
+
require 'feedbag'
|
64
|
+
url = argv.shift || abort_with_usage("inspect", "<url>")
|
65
|
+
feeds = Feedbag.find(url)
|
66
|
+
pp feeds
|
67
|
+
rss_results = Automatic::FeedParser.get_rss(feeds.pop)
|
68
|
+
pp rss_results
|
69
|
+
},
|
59
70
|
'log' => lambda { |argv|
|
60
71
|
require 'automatic/log'
|
61
72
|
level = argv.shift || abort_with_usage("log", "<level> <message>")
|
data/config/feed2console.yml
CHANGED
data/doc/ChangeLog
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 12.4.0 / 2012-04-30
|
2
|
+
|
3
|
+
* Inspect SubCommand added to automatic-config.
|
4
|
+
|
5
|
+
* Added Plugins.
|
6
|
+
|
7
|
+
* Filter::Reverse
|
8
|
+
* Publish::SMTP
|
9
|
+
* Publish::Mail
|
10
|
+
|
11
|
+
* Running all Integration Tests with CI.
|
12
|
+
|
13
|
+
|
1
14
|
=== 12.3.1 / 2012-03-16
|
2
15
|
|
3
16
|
* English Documents.
|
data/doc/PLUGINS
CHANGED
@@ -18,6 +18,18 @@ SubscriptionFeed
|
|
18
18
|
- FEED ...
|
19
19
|
|
20
20
|
|
21
|
+
FilterReverse
|
22
|
+
-------------
|
23
|
+
[Path]
|
24
|
+
/plugins/filter/reverse.rb
|
25
|
+
|
26
|
+
[Abstract]
|
27
|
+
Sort feed by date asc.
|
28
|
+
|
29
|
+
[Syntax]
|
30
|
+
- module: FilterReverse
|
31
|
+
|
32
|
+
|
21
33
|
FilterIgnore
|
22
34
|
------------
|
23
35
|
[Path]
|
data/doc/PLUGINS.ja
CHANGED
data/doc/README
CHANGED
@@ -254,6 +254,9 @@ Directory and file structure
|
|
254
254
|
|
|
255
255
|
+-+ script
|
256
256
|
| |
|
257
|
+
| +-- build
|
258
|
+
| | Run Integration Test that carried out on CI.
|
259
|
+
| |
|
257
260
|
| +-- bootstrap
|
258
261
|
| To set the environment, such as bundle install.
|
259
262
|
| (Only more than ruby 1.9)
|
@@ -263,6 +266,9 @@ Directory and file structure
|
|
263
266
|
|
|
264
267
|
+-+ test
|
265
268
|
| |
|
269
|
+
| +-- fixtures
|
270
|
+
| | Fixtures for test.
|
271
|
+
| |
|
266
272
|
| +-- integration
|
267
273
|
| Directory for the Integration Test.
|
268
274
|
|
|
@@ -298,7 +304,7 @@ RubyForge
|
|
298
304
|
http://rubyforge.org/projects/automatic/
|
299
305
|
|
300
306
|
CI
|
301
|
-
http://id774.net/jenkins/
|
307
|
+
http://jenkins.id774.net/jenkins/
|
302
308
|
|
303
309
|
|
304
310
|
===========
|
@@ -337,8 +343,9 @@ pipeline backs again as the return value.
|
|
337
343
|
|
338
344
|
pipeline = []
|
339
345
|
recipe.each_plugin { |plugin|
|
340
|
-
|
341
|
-
|
346
|
+
mod = plugin.module
|
347
|
+
load_plugin(mod)
|
348
|
+
klass = Automatic::Plugin.const_get(mod)
|
342
349
|
pipeline = klass.new(plugin.config, pipeline).run
|
343
350
|
}
|
344
351
|
|
@@ -400,7 +407,7 @@ Continuous Integration
|
|
400
407
|
======================
|
401
408
|
|
402
409
|
CI is performed in Jenkins.
|
403
|
-
http://id774.net/jenkins/
|
410
|
+
http://jenkins.id774.net/jenkins/
|
404
411
|
|
405
412
|
|
406
413
|
===========================
|
@@ -427,8 +434,8 @@ $ automatic-config scaffold
|
|
427
434
|
$ automatic-config autodiscovery <url>
|
428
435
|
Return the URL of the feed of target detected by auto discovery.
|
429
436
|
(ex.)
|
430
|
-
$ automatic-config autodiscovery http://id774.net/
|
431
|
-
["http://id774.net/
|
437
|
+
$ automatic-config autodiscovery http://blog.id774.net/blogs
|
438
|
+
["http://blog.id774.net/blogs/feed/", "http://blog.id774.net/blogs/comments/feed/"]
|
432
439
|
|
433
440
|
$ automatic-config opmlparser <opml path>
|
434
441
|
To output the URLs to parse the OPML file.
|
@@ -438,6 +445,11 @@ $ automatic-config opmlparser opml.xml > feeds.txt
|
|
438
445
|
$ automatic-config feedparser <url>
|
439
446
|
Return the contents to parse the feed.
|
440
447
|
|
448
|
+
$ automatic-config inspect <url>
|
449
|
+
Return the URL of the feed of target detected by auto discovery.
|
450
|
+
Return the contents to parse the first feed further.
|
451
|
+
This inspects verify the target subscriptionable.
|
452
|
+
|
441
453
|
$ automatic-config log <level> <message>
|
442
454
|
To output log messages in the form of Automatic Ruby.
|
443
455
|
|
data/doc/README.ja
CHANGED
@@ -252,6 +252,9 @@ $ automatic-config scaffold
|
|
252
252
|
|
|
253
253
|
+- script
|
254
254
|
| |
|
255
|
+
| +- build
|
256
|
+
| | CI で実施する結合試験をおこなう
|
257
|
+
| |
|
255
258
|
| +- bootstrap
|
256
259
|
| bundle install 等の環境設定をおこなう
|
257
260
|
| (ruby 1.9 以上のみ)
|
@@ -264,6 +267,9 @@ $ automatic-config scaffold
|
|
264
267
|
|
|
265
268
|
+- test
|
266
269
|
| |
|
270
|
+
| +- fixtures
|
271
|
+
| | テストでロードされるフィクスチャ
|
272
|
+
| |
|
267
273
|
| +- integration
|
268
274
|
| インテグレーションテスト用ディレクトリ
|
269
275
|
|
|
@@ -277,6 +283,9 @@ $ automatic-config scaffold
|
|
277
283
|
+- COPYING
|
278
284
|
| 本ソフトウェアのライセンス
|
279
285
|
|
|
286
|
+
+- ChangeLog
|
287
|
+
| 更新履歴
|
288
|
+
|
|
280
289
|
+- PLUGINS.ja
|
281
290
|
| プラグインについてのドキュメント
|
282
291
|
|
|
@@ -299,7 +308,7 @@ RubyForge
|
|
299
308
|
http://rubyforge.org/projects/automatic/
|
300
309
|
|
301
310
|
CI
|
302
|
-
http://id774.net/jenkins/
|
311
|
+
http://jenkins.id774.net/jenkins/
|
303
312
|
|
304
313
|
|
305
314
|
プラグインを新しく作ったり、あるいはフレームワークを
|
@@ -361,8 +370,9 @@ Automatic::Pipeline とは
|
|
361
370
|
|
362
371
|
pipeline = []
|
363
372
|
recipe.each_plugin { |plugin|
|
364
|
-
|
365
|
-
|
373
|
+
mod = plugin.module
|
374
|
+
load_plugin(mod)
|
375
|
+
klass = Automatic::Plugin.const_get(mod)
|
366
376
|
pipeline = klass.new(plugin.config, pipeline).run
|
367
377
|
}
|
368
378
|
|
@@ -426,7 +436,7 @@ $ script/build
|
|
426
436
|
========================
|
427
437
|
|
428
438
|
CI は Jenkins でおこなう。
|
429
|
-
http://id774.net/jenkins/
|
439
|
+
http://jenkins.id774.net/jenkins/
|
430
440
|
|
431
441
|
|
432
442
|
================
|
@@ -453,8 +463,8 @@ $ automatic-config scaffold
|
|
453
463
|
$ automatic-config autodiscovery <url>
|
454
464
|
対象の URL をオートディスカバリで探知しフィードの URL を返す。
|
455
465
|
(例)
|
456
|
-
$ automatic-config autodiscovery http://id774.net/
|
457
|
-
["http://id774.net/
|
466
|
+
$ automatic-config autodiscovery http://blog.id774.net/blogs
|
467
|
+
["http://blog.id774.net/blogs/feed/", "http://blog.id774.net/blogs/comments/feed/"]
|
458
468
|
|
459
469
|
$ automatic-config opmlparser <opml path>
|
460
470
|
OPML ファイルを解析し URL を出力する。
|
@@ -464,6 +474,11 @@ $ automatic-config opmlparser opml.xml > feeds.txt
|
|
464
474
|
$ automatic-config feedparser <url>
|
465
475
|
フィードを解析して内容を返す。
|
466
476
|
|
477
|
+
$ automatic-config inspect <url>
|
478
|
+
対象の URL をオートディスカバリで探知する。
|
479
|
+
さらに最初のフィードの URL を解析して内容を返す。
|
480
|
+
目的のサイトのフィードを購読可能かどうか検証するのに使う。
|
481
|
+
|
467
482
|
$ automatic-config log <level> <message>
|
468
483
|
Automatic Ruby のログ形式でメッセージを出力する。
|
469
484
|
|
data/lib/automatic.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Name:: Automatic::Ruby
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
|
-
# Version:: 12.
|
4
|
+
# Version:: 12.4.0
|
5
5
|
# Created:: Feb 18, 2012
|
6
|
-
# Updated::
|
6
|
+
# Updated:: Apr 30, 2012
|
7
7
|
# Copyright:: 774 Copyright (c) 2012
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
9
|
|
@@ -14,7 +14,7 @@ module Automatic
|
|
14
14
|
require 'automatic/log'
|
15
15
|
require 'automatic/feed_parser'
|
16
16
|
|
17
|
-
VERSION = "12.
|
17
|
+
VERSION = "12.4.0"
|
18
18
|
USER_DIR = "/.automatic"
|
19
19
|
|
20
20
|
class << self
|
data/lib/automatic/recipe.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Name:: Automatic::Plugin::Filter::Reverse
|
4
|
+
# Author:: 774 <http://id774.net>
|
5
|
+
# Created:: Mar 23, 2012
|
6
|
+
# Updated:: Mar 23, 2012
|
7
|
+
# Copyright:: 774 Copyright (c) 2012
|
8
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
|
+
|
10
|
+
module Automatic::Plugin
|
11
|
+
class FilterReverse
|
12
|
+
|
13
|
+
def initialize(config, pipeline=[])
|
14
|
+
@config = config
|
15
|
+
@pipeline = pipeline
|
16
|
+
@output = STDOUT
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
return_feeds = []
|
21
|
+
@pipeline.each { |feeds|
|
22
|
+
return_feed_items = []
|
23
|
+
unless feeds.nil?
|
24
|
+
feeds.items.sort!{|a,b|
|
25
|
+
a.date <=> b.date
|
26
|
+
}
|
27
|
+
return_feeds << feeds
|
28
|
+
end
|
29
|
+
}
|
30
|
+
return_feeds
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Mail
|
3
|
+
# Author:: 774 <http://id774.net>
|
4
|
+
# Created:: Apr 5, 2012
|
5
|
+
# Updated:: Apr 5, 2012
|
6
|
+
# Copyright:: 774 Copyright (c) 2012
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class PublishMail
|
11
|
+
require 'action_mailer'
|
12
|
+
|
13
|
+
def initialize(config, pipeline=[])
|
14
|
+
@config = config
|
15
|
+
@pipeline = pipeline
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
Mailer.smtp_settings = default_setting.update(
|
20
|
+
{
|
21
|
+
:port => @config["port"],
|
22
|
+
#:address => @config["address"],
|
23
|
+
#:authentication => @config["auth"],
|
24
|
+
#:user_name => @config["username"],
|
25
|
+
#:password => @config["password"],
|
26
|
+
#:domain => @config["domain"],
|
27
|
+
})
|
28
|
+
|
29
|
+
Mailer.raise_delivery_errors = true
|
30
|
+
@pipeline.each { |feeds|
|
31
|
+
unless feeds.nil?
|
32
|
+
feeds.items.each { |feed|
|
33
|
+
Mailer.notify(@config, feed)
|
34
|
+
}
|
35
|
+
end
|
36
|
+
}
|
37
|
+
@pipeline
|
38
|
+
end
|
39
|
+
|
40
|
+
def default_setting
|
41
|
+
return {}
|
42
|
+
end
|
43
|
+
|
44
|
+
class Mailer < ActionMailer::Base
|
45
|
+
def notify(option, feed)
|
46
|
+
m = mail(
|
47
|
+
:date => Time.now,
|
48
|
+
:subject => feed.title,
|
49
|
+
:to => option["mailto"],
|
50
|
+
#:cc => option["mailcc"],
|
51
|
+
#:bcc => option["mailbcc"],
|
52
|
+
:from => option["mailfrom"])
|
53
|
+
|
54
|
+
unless feed.content_encoded.nil?
|
55
|
+
m.body = feed.content_encoded
|
56
|
+
else
|
57
|
+
m.body = feed.description
|
58
|
+
end
|
59
|
+
|
60
|
+
m.deliver
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Name:: Automatic::Plugin::Publish::Smtp
|
3
|
+
# Author:: kzgs
|
4
|
+
# Created:: Mar 17, 2012
|
5
|
+
# Updated:: Mar 17, 2012
|
6
|
+
# Copyright:: kzgs Copyright (c) 2012
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
|
+
|
9
|
+
module Automatic::Plugin
|
10
|
+
class PublishSmtp
|
11
|
+
require 'action_mailer'
|
12
|
+
|
13
|
+
def initialize(config, pipeline=[])
|
14
|
+
@config = config
|
15
|
+
@pipeline = pipeline
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
Mailer.smtp_settings = default_setting.update(
|
20
|
+
{
|
21
|
+
:port => @config["port"],
|
22
|
+
})
|
23
|
+
Mailer.raise_delivery_errors = true
|
24
|
+
@pipeline.each { |feeds|
|
25
|
+
unless feeds.nil?
|
26
|
+
feeds.items.each { |feed|
|
27
|
+
Mailer.notify(@config, feed)
|
28
|
+
}
|
29
|
+
end
|
30
|
+
}
|
31
|
+
@pipeline
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_setting
|
35
|
+
return {}
|
36
|
+
end
|
37
|
+
|
38
|
+
class Mailer < ActionMailer::Base
|
39
|
+
def notify(option, feed)
|
40
|
+
m = mail(:subject => option["subject"],
|
41
|
+
:to => option["mailto"],
|
42
|
+
:from => option["mailfrom"])
|
43
|
+
m.body = feed.link
|
44
|
+
m.deliver
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/script/build
CHANGED
@@ -46,9 +46,9 @@ test_config() {
|
|
46
46
|
|
47
47
|
added_tests() {
|
48
48
|
test_config scaffold
|
49
|
-
test_config autodiscovery http://id774.net/
|
49
|
+
test_config autodiscovery http://blog.id774.net/blogs/
|
50
50
|
test_config opmlparser "$RACK_ROOT/test/fixtures/sampleOPML.xml"
|
51
|
-
test_config feedparser http://id774.net/
|
51
|
+
test_config feedparser http://blog.id774.net/blogs/feed/ > /dev/null
|
52
52
|
test_config log info finished.
|
53
53
|
}
|
54
54
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Name:: Automatic::Plugin::Filter::Reverse
|
4
|
+
# Author:: 774 <http://id774.net>
|
5
|
+
# Created:: Mar 23, 2012
|
6
|
+
# Updated:: Mar 23, 2012
|
7
|
+
# Copyright:: 774 Copyright (c) 2012
|
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/reverse'
|
13
|
+
|
14
|
+
describe Automatic::Plugin::FilterReverse do
|
15
|
+
context "it should be reverse sorted" do
|
16
|
+
subject {
|
17
|
+
Automatic::Plugin::FilterReverse.new({},
|
18
|
+
AutomaticSpec.generate_pipeline {
|
19
|
+
feed {
|
20
|
+
item "http://aaa.png", "",
|
21
|
+
"<img src=\"http://aaa.png\">",
|
22
|
+
"Fri, 23 Mar 2012 00:10:00 +0000"
|
23
|
+
item "http://bbb.png", "",
|
24
|
+
"<img src=\"http://bbb.png\">",
|
25
|
+
"Fri, 25 Mar 2012 01:05:00 +0000"
|
26
|
+
item "http://ccc.png", "",
|
27
|
+
"<img src=\"http://ccc.png\">",
|
28
|
+
"Fri, 22 Mar 2012 00:15:00 +0000"
|
29
|
+
item "http://ddd.png", "",
|
30
|
+
"<img src=\"http://ddd.png\">",
|
31
|
+
"Fri, 23 Mar 2012 00:00:08 +0000"
|
32
|
+
item "http://eee.png", "",
|
33
|
+
"<img src=\"http://eee.png\">",
|
34
|
+
"Fri, 23 Nov 2012 00:09:00 +0000"
|
35
|
+
}})}
|
36
|
+
|
37
|
+
describe "#run" do
|
38
|
+
its(:run) { should have(1).feeds }
|
39
|
+
|
40
|
+
specify {
|
41
|
+
subject.run
|
42
|
+
subject.instance_variable_get(:@pipeline)[0].items[0].link.
|
43
|
+
should == "http://ccc.png"
|
44
|
+
subject.instance_variable_get(:@pipeline)[0].items[1].link.
|
45
|
+
should == "http://ddd.png"
|
46
|
+
subject.instance_variable_get(:@pipeline)[0].items[2].link.
|
47
|
+
should == "http://aaa.png"
|
48
|
+
subject.instance_variable_get(:@pipeline)[0].items[3].link.
|
49
|
+
should == "http://bbb.png"
|
50
|
+
subject.instance_variable_get(:@pipeline)[0].items[4].link.
|
51
|
+
should == "http://eee.png"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
|
+
|
3
|
+
require 'publish/mail'
|
4
|
+
require 'mocksmtpd'
|
5
|
+
|
6
|
+
describe Automatic::Plugin::PublishMail do
|
7
|
+
before do
|
8
|
+
@pipeline = AutomaticSpec.generate_pipeline {
|
9
|
+
feed { item "http://github.com",
|
10
|
+
'aaa',
|
11
|
+
'bbb\n',
|
12
|
+
'Mon, 30 Jan 2012 13:22:29 +0900'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
subject {
|
18
|
+
Automatic::Plugin::PublishMail.new({
|
19
|
+
"port" => 25,
|
20
|
+
"mailto" => "<to@example.com>",
|
21
|
+
"mailfrom" => "<from@example.com>",
|
22
|
+
"subject" => "test"
|
23
|
+
}, @pipeline)
|
24
|
+
}
|
25
|
+
|
26
|
+
it "should mail to smtp server" do
|
27
|
+
smtpd = SMTPServer.new({
|
28
|
+
:Port => 10025,
|
29
|
+
:MailHook => lambda { |sender| sender.should == "<from@example.com>" },
|
30
|
+
:DataHook => lambda { |tmpf, sender, recipients|
|
31
|
+
tmpf.should include("github.com")
|
32
|
+
sender.should == "<from@example.com>"
|
33
|
+
recipients.should == ["<to@example.com>"]
|
34
|
+
}
|
35
|
+
})
|
36
|
+
Thread.start {
|
37
|
+
smtpd.start
|
38
|
+
}
|
39
|
+
loop do
|
40
|
+
break if smtpd.status == :Running
|
41
|
+
end
|
42
|
+
subject.run
|
43
|
+
smtpd.shutdown
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
|
2
|
+
|
3
|
+
require 'publish/smtp'
|
4
|
+
require 'mocksmtpd'
|
5
|
+
|
6
|
+
describe Automatic::Plugin::PublishSmtp do
|
7
|
+
before do
|
8
|
+
@pipeline = AutomaticSpec.generate_pipeline {
|
9
|
+
feed { item "http://github.com" }
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
subject {
|
14
|
+
Automatic::Plugin::PublishSmtp.new({
|
15
|
+
"port" => 10025,
|
16
|
+
"mailto" => "to@example.com",
|
17
|
+
"mailfrom" => "from@example.com",
|
18
|
+
"subject" => "test"
|
19
|
+
}, @pipeline)
|
20
|
+
}
|
21
|
+
|
22
|
+
it "should mail to smtp server" do
|
23
|
+
smtpd = SMTPServer.new({
|
24
|
+
:Port => 10025,
|
25
|
+
:MailHook => lambda { |sender| sender.should == "from@example.com" },
|
26
|
+
:DataHook => lambda { |tmpf, sender, recipients|
|
27
|
+
tmpf.should include("github.com")
|
28
|
+
sender.should == "from@example.com"
|
29
|
+
recipients.should == ["to@example.com"]
|
30
|
+
}
|
31
|
+
})
|
32
|
+
Thread.start {
|
33
|
+
smtpd.start
|
34
|
+
}
|
35
|
+
loop do
|
36
|
+
break if smtpd.status == :Running
|
37
|
+
end
|
38
|
+
subject.run
|
39
|
+
smtpd.shutdown
|
40
|
+
end
|
41
|
+
end
|
@@ -15,7 +15,7 @@ describe Automatic::Plugin::StoreFullText do
|
|
15
15
|
it "should store 1 record for the new blog entry" do
|
16
16
|
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
17
17
|
AutomaticSpec.generate_pipeline {
|
18
|
-
feed { item "http://id774.net/
|
18
|
+
feed { item "http://blog.id774.net/blogs/feed/" }
|
19
19
|
})
|
20
20
|
|
21
21
|
lambda {
|
@@ -26,7 +26,7 @@ describe Automatic::Plugin::StoreFullText do
|
|
26
26
|
it "should not store record for the existent blog entry" do
|
27
27
|
instance = Automatic::Plugin::StoreFullText.new({"db" => @db_filename},
|
28
28
|
AutomaticSpec.generate_pipeline {
|
29
|
-
feed { item "http://id774.net/
|
29
|
+
feed { item "http://blog.id774.net/blogs/feed/" }
|
30
30
|
})
|
31
31
|
|
32
32
|
instance.run.should have(1).feed
|
data/spec/spec_helper.rb
CHANGED
@@ -11,9 +11,10 @@ if ENV['COVERAGE'] == 'on'
|
|
11
11
|
require 'simplecov'
|
12
12
|
require 'simplecov-rcov'
|
13
13
|
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
14
|
-
|
14
|
+
|
15
15
|
SimpleCov.start do
|
16
16
|
add_filter "spec"
|
17
|
+
add_filter "vendor"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -50,11 +51,11 @@ module AutomaticSpec
|
|
50
51
|
|
51
52
|
class StubPipelineGenerator
|
52
53
|
attr_reader :feeds
|
53
|
-
|
54
|
+
|
54
55
|
def initialize
|
55
56
|
@feeds = []
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
def feed(&block)
|
59
60
|
feed_generator = StubFeedGenerator.new
|
60
61
|
feed_generator.instance_eval(&block)
|
@@ -66,18 +67,19 @@ module AutomaticSpec
|
|
66
67
|
def initialize
|
67
68
|
@channel = RSS::Rss::Channel.new
|
68
69
|
end
|
69
|
-
|
70
|
+
|
70
71
|
def feed
|
71
72
|
rss = RSS::Rss.new([])
|
72
73
|
rss.instance_variable_set(:@channel, @channel)
|
73
74
|
return rss
|
74
75
|
end
|
75
76
|
|
76
|
-
def item(url, title="", description="")
|
77
|
+
def item(url, title="", description="", date="")
|
77
78
|
itm = RSS::Rss::Channel::Item.new
|
78
79
|
itm.link = url
|
79
80
|
itm.title = title unless title.blank?
|
80
81
|
itm.instance_variable_set(:@description, description)
|
82
|
+
itm.pubDate = date unless date.blank?
|
81
83
|
@channel.items << itm
|
82
84
|
end
|
83
85
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
global:
|
2
|
+
timezone: Asia/Tokyo
|
3
|
+
cache:
|
4
|
+
base: /tmp
|
5
|
+
log:
|
6
|
+
level: info
|
7
|
+
|
8
|
+
plugins:
|
9
|
+
- module: SubscriptionFeed
|
10
|
+
config:
|
11
|
+
feeds:
|
12
|
+
- http://www.google.com/alerts/feeds/01922355350745702683/544996148035630811
|
13
|
+
- http://www.google.com/alerts/feeds/01922355350745702683/18239124957297333757
|
14
|
+
- http://www.google.com/alerts/feeds/01922355350745702683/11755855657646433816
|
15
|
+
|
16
|
+
#- module: PublishConsole
|
17
|
+
|
18
|
+
- module: StoreFullText
|
19
|
+
config:
|
20
|
+
db: test_googlealert.db
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
global:
|
2
|
+
timezone: Asia/Tokyo
|
3
|
+
cache:
|
4
|
+
base: /tmp
|
5
|
+
log:
|
6
|
+
level: info
|
7
|
+
|
8
|
+
plugins:
|
9
|
+
- module: SubscriptionFeed
|
10
|
+
config:
|
11
|
+
feeds:
|
12
|
+
- http://b.hatena.ne.jp/Naruhodius/rss
|
13
|
+
|
14
|
+
- module: PublishMail
|
15
|
+
config:
|
16
|
+
port: 25
|
17
|
+
mailto: plagger.receiver@gmail.com
|
18
|
+
mailfrom: automatic@harpuia.id774.net
|
19
|
+
|
20
|
+
#- module: PublishConsole
|
21
|
+
|
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.
|
4
|
+
version: 12.4.0
|
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-
|
12
|
+
date: 2012-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: activesupport
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '3'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: hashie
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: activerecord
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,31 @@ dependencies:
|
|
54
69
|
version: '3'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: actionmailer
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3'
|
58
94
|
- !ruby/object:Gem::Dependency
|
59
95
|
name: gcalapi
|
60
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
61
97
|
none: false
|
62
98
|
requirements:
|
63
99
|
- - ! '>='
|
@@ -65,10 +101,15 @@ dependencies:
|
|
65
101
|
version: '0'
|
66
102
|
type: :runtime
|
67
103
|
prerelease: false
|
68
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
69
110
|
- !ruby/object:Gem::Dependency
|
70
111
|
name: xml-simple
|
71
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
72
113
|
none: false
|
73
114
|
requirements:
|
74
115
|
- - ! '>='
|
@@ -76,10 +117,15 @@ dependencies:
|
|
76
117
|
version: '0'
|
77
118
|
type: :runtime
|
78
119
|
prerelease: false
|
79
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
80
126
|
- !ruby/object:Gem::Dependency
|
81
127
|
name: feedbag
|
82
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
83
129
|
none: false
|
84
130
|
requirements:
|
85
131
|
- - ! '>='
|
@@ -87,10 +133,15 @@ dependencies:
|
|
87
133
|
version: '0'
|
88
134
|
type: :runtime
|
89
135
|
prerelease: false
|
90
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
91
142
|
- !ruby/object:Gem::Dependency
|
92
143
|
name: cucumber
|
93
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
94
145
|
none: false
|
95
146
|
requirements:
|
96
147
|
- - ! '>='
|
@@ -98,29 +149,44 @@ dependencies:
|
|
98
149
|
version: '0'
|
99
150
|
type: :development
|
100
151
|
prerelease: false
|
101
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
102
158
|
- !ruby/object:Gem::Dependency
|
103
159
|
name: bundler
|
104
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
105
161
|
none: false
|
106
162
|
requirements:
|
107
|
-
- -
|
163
|
+
- - ! '>='
|
108
164
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
165
|
+
version: '0'
|
110
166
|
type: :development
|
111
167
|
prerelease: false
|
112
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
113
174
|
- !ruby/object:Gem::Dependency
|
114
175
|
name: jeweler
|
115
|
-
requirement:
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
116
177
|
none: false
|
117
178
|
requirements:
|
118
|
-
- -
|
179
|
+
- - ! '>='
|
119
180
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
181
|
+
version: '0'
|
121
182
|
type: :development
|
122
183
|
prerelease: false
|
123
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
124
190
|
description: Ruby General Automation Framework
|
125
191
|
email: idnanashi@gmail.com
|
126
192
|
executables:
|
@@ -154,15 +220,17 @@ files:
|
|
154
220
|
- lib/automatic/opml.rb
|
155
221
|
- lib/automatic/pipeline.rb
|
156
222
|
- lib/automatic/recipe.rb
|
157
|
-
- lib/config/validator.rb
|
158
223
|
- plugins/custom_feed/svn_log.rb
|
159
224
|
- plugins/filter/ignore.rb
|
160
225
|
- plugins/filter/image.rb
|
226
|
+
- plugins/filter/reverse.rb
|
161
227
|
- plugins/filter/tumblr_resize.rb
|
162
228
|
- plugins/notify/ikachan.rb
|
163
229
|
- plugins/publish/console.rb
|
164
230
|
- plugins/publish/google_calendar.rb
|
165
231
|
- plugins/publish/hatena_bookmark.rb
|
232
|
+
- plugins/publish/mail.rb
|
233
|
+
- plugins/publish/smtp.rb
|
166
234
|
- plugins/store/full_text.rb
|
167
235
|
- plugins/store/permalink.rb
|
168
236
|
- plugins/store/store_database.rb
|
@@ -176,11 +244,14 @@ files:
|
|
176
244
|
- spec/plugins/custom_feed/svn_log_spec.rb
|
177
245
|
- spec/plugins/filter/ignore_spec.rb
|
178
246
|
- spec/plugins/filter/image_spec.rb
|
247
|
+
- spec/plugins/filter/reverse_spec.rb
|
179
248
|
- spec/plugins/filter/tumblr_resize_spec.rb
|
180
249
|
- spec/plugins/notify/ikachan_spec.rb
|
181
250
|
- spec/plugins/publish/console_spec.rb
|
182
251
|
- spec/plugins/publish/google_calendar_spec.rb
|
183
252
|
- spec/plugins/publish/hatena_bookmark_spec.rb
|
253
|
+
- spec/plugins/publish/mail_spec.rb
|
254
|
+
- spec/plugins/publish/smtp_spec.rb
|
184
255
|
- spec/plugins/store/full_text_spec.rb
|
185
256
|
- spec/plugins/store/permalink_spec.rb
|
186
257
|
- spec/plugins/store/target_link_spec.rb
|
@@ -190,10 +261,13 @@ files:
|
|
190
261
|
- test/fixtures/sampleOPML.xml
|
191
262
|
- test/integration/test_activerecord.yml
|
192
263
|
- test/integration/test_fulltext.yml
|
264
|
+
- test/integration/test_googlealert.yml
|
193
265
|
- test/integration/test_hatenabookmark.yml
|
194
266
|
- test/integration/test_ignore.yml
|
195
267
|
- test/integration/test_ignore2.yml
|
196
268
|
- test/integration/test_image2local.yml
|
269
|
+
- test/integration/test_mail.yml
|
270
|
+
- test/integration/test_reverse.yml
|
197
271
|
- test/integration/test_svnlog.yml
|
198
272
|
- test/integration/test_tumblr2local.yml
|
199
273
|
- vendor/.gitkeep
|
@@ -218,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
292
|
version: '0'
|
219
293
|
requirements: []
|
220
294
|
rubyforge_project:
|
221
|
-
rubygems_version: 1.8.
|
295
|
+
rubygems_version: 1.8.19
|
222
296
|
signing_key:
|
223
297
|
specification_version: 3
|
224
298
|
summary: Automatic Ruby
|
data/lib/config/validator.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# Name:: Automatic::Config::Validator
|
4
|
-
# Author:: aerith <http://aerith.sc/>
|
5
|
-
# Created:: Feb 23, 2012
|
6
|
-
# Updated:: Feb 23, 2012
|
7
|
-
# Copyright:: Copyright (c) 2012
|
8
|
-
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
9
|
-
|
10
|
-
class Automatic
|
11
|
-
module Config
|
12
|
-
class Validator
|
13
|
-
attr_accessor :config, :result
|
14
|
-
|
15
|
-
class InvalidException < Exception; end;
|
16
|
-
|
17
|
-
def initialize(config = nil)
|
18
|
-
@config = config || {}
|
19
|
-
@result = ValidateResult.new
|
20
|
-
end
|
21
|
-
|
22
|
-
def validate(klass, config = nil)
|
23
|
-
return true if config.nil?
|
24
|
-
return true if not config.is_a?(Hash)
|
25
|
-
return true if not klass.respond_to?(:rules)
|
26
|
-
|
27
|
-
rules = klass.rules
|
28
|
-
return true if not rules.is_a?(Hash)
|
29
|
-
|
30
|
-
process(rules, config).result.valid?
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def process(rules, config)
|
35
|
-
errors = {}
|
36
|
-
|
37
|
-
rules.each do |key, rule|
|
38
|
-
name = key.to_sym
|
39
|
-
|
40
|
-
rule.each do |method, args|
|
41
|
-
unless ValidateRule.send(method, *[config, name, args])
|
42
|
-
errors[name] = {} if errors[name].nil? or errors.size < 1
|
43
|
-
errors[name][method] = true
|
44
|
-
if @config["stop_on_invalid"] and errors[name][method]
|
45
|
-
raise InvalidException
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
@result.errors = errors
|
52
|
-
|
53
|
-
self
|
54
|
-
end
|
55
|
-
|
56
|
-
class ValidateResult
|
57
|
-
attr_accessor :errors
|
58
|
-
|
59
|
-
def error(name)
|
60
|
-
errors.exists?(name)
|
61
|
-
end
|
62
|
-
|
63
|
-
def valid?
|
64
|
-
errors.empty?
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
module ValidateRule
|
69
|
-
def self.required(config, name, *args)
|
70
|
-
return true unless args.size < 1 or args.first
|
71
|
-
return true if not config[name.to_s].nil? and not config[name.to_s].empty?
|
72
|
-
false
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.default(config, name, *args)
|
76
|
-
config[name.to_s] ||= args.first
|
77
|
-
true
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|