automatic 13.5.0 → 13.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Gemfile +11 -5
  2. data/README.md +4 -6
  3. data/VERSION +1 -1
  4. data/automatic.gemspec +61 -18
  5. data/doc/ChangeLog +25 -0
  6. data/doc/PLUGINS +202 -12
  7. data/doc/PLUGINS.ja +221 -30
  8. data/doc/README +1 -1
  9. data/doc/README.ja +1 -1
  10. data/lib/automatic.rb +3 -3
  11. data/lib/automatic/feed_parser.rb +2 -2
  12. data/lib/automatic/log.rb +12 -2
  13. data/lib/automatic/pipeline.rb +1 -1
  14. data/lib/automatic/recipe.rb +5 -2
  15. data/plugins/custom_feed/svn_log.rb +3 -3
  16. data/plugins/filter/absolute_uri.rb +8 -4
  17. data/plugins/filter/accept.rb +61 -0
  18. data/plugins/filter/full_feed.rb +4 -5
  19. data/plugins/filter/github_feed.rb +36 -0
  20. data/plugins/filter/ignore.rb +1 -1
  21. data/plugins/filter/image.rb +1 -1
  22. data/plugins/filter/image_source.rb +34 -10
  23. data/plugins/filter/one.rb +1 -1
  24. data/plugins/filter/rand.rb +1 -1
  25. data/plugins/filter/sanitize.rb +50 -0
  26. data/plugins/filter/sort.rb +1 -1
  27. data/plugins/filter/tumblr_resize.rb +1 -1
  28. data/plugins/publish/console.rb +3 -3
  29. data/plugins/publish/console_link.rb +30 -0
  30. data/plugins/publish/eject.rb +42 -0
  31. data/plugins/publish/fluentd.rb +42 -0
  32. data/plugins/publish/google_calendar.rb +3 -3
  33. data/plugins/publish/hatena_bookmark.rb +1 -1
  34. data/plugins/publish/hipchat.rb +45 -0
  35. data/plugins/publish/instapaper.rb +2 -1
  36. data/plugins/publish/memcached.rb +44 -0
  37. data/plugins/publish/pocket.rb +1 -1
  38. data/plugins/publish/twitter.rb +1 -1
  39. data/plugins/store/database.rb +3 -3
  40. data/plugins/store/full_text.rb +2 -2
  41. data/plugins/store/permalink.rb +1 -1
  42. data/plugins/store/target_link.rb +3 -2
  43. data/plugins/subscription/chan_toru.rb +56 -0
  44. data/plugins/subscription/feed.rb +1 -1
  45. data/plugins/subscription/g_guide.rb +48 -0
  46. data/plugins/subscription/google_reader_star.rb +3 -3
  47. data/plugins/subscription/link.rb +2 -2
  48. data/plugins/subscription/pocket.rb +49 -0
  49. data/plugins/subscription/text.rb +3 -12
  50. data/plugins/subscription/tumblr.rb +7 -1
  51. data/plugins/subscription/twitter.rb +1 -1
  52. data/plugins/subscription/twitter_search.rb +50 -0
  53. data/plugins/subscription/weather.rb +7 -41
  54. data/script/build +3 -0
  55. data/spec/fixtures/sampleRecipe.yml +1 -1
  56. data/spec/lib/automatic/log_spec.rb +31 -0
  57. data/spec/lib/automatic/pipeline_spec.rb +1 -1
  58. data/spec/lib/automatic/recipe_spec.rb +1 -1
  59. data/spec/lib/automatic_spec.rb +3 -3
  60. data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
  61. data/spec/plugins/filter/absolute_uri_spec.rb +1 -1
  62. data/spec/plugins/filter/accept_spec.rb +331 -0
  63. data/spec/plugins/filter/full_feed_spec.rb +4 -6
  64. data/spec/plugins/filter/github_feed_spec.rb +54 -0
  65. data/spec/plugins/filter/ignore_spec.rb +1 -1
  66. data/spec/plugins/filter/image_source_spec.rb +17 -3
  67. data/spec/plugins/filter/image_spec.rb +1 -1
  68. data/spec/plugins/filter/one_spec.rb +1 -1
  69. data/spec/plugins/filter/rand_spec.rb +1 -1
  70. data/spec/plugins/filter/sanitize_spec.rb +153 -0
  71. data/spec/plugins/filter/sort_spec.rb +1 -1
  72. data/spec/plugins/filter/tumblr_resize_spec.rb +1 -1
  73. data/spec/plugins/notify/ikachan_spec.rb +1 -1
  74. data/spec/plugins/publish/console_spec.rb +1 -1
  75. data/spec/plugins/publish/eject_spec.rb +40 -0
  76. data/spec/plugins/publish/fluentd_spec.rb +39 -0
  77. data/spec/plugins/publish/google_calendar_spec.rb +1 -1
  78. data/spec/plugins/publish/hatena_bookmark_spec.rb +1 -1
  79. data/spec/plugins/publish/hipchat_spec.rb +69 -0
  80. data/spec/plugins/publish/instapaper_spec.rb +42 -28
  81. data/spec/plugins/publish/memcached_spec.rb +63 -0
  82. data/spec/plugins/publish/pocket_spec.rb +33 -33
  83. data/spec/plugins/publish/twitter_spec.rb +57 -19
  84. data/spec/plugins/store/full_text_spec.rb +6 -1
  85. data/spec/plugins/store/permalink_spec.rb +18 -19
  86. data/spec/plugins/store/target_link_spec.rb +1 -1
  87. data/spec/plugins/subscription/chan_toru_spec.rb +56 -0
  88. data/spec/plugins/subscription/feed_spec.rb +1 -1
  89. data/spec/plugins/subscription/g_guide_spec.rb +76 -0
  90. data/spec/plugins/subscription/google_reader_star_spec.rb +1 -1
  91. data/spec/plugins/subscription/link_spec.rb +1 -1
  92. data/spec/plugins/subscription/pocket_spec.rb +57 -0
  93. data/spec/plugins/subscription/text_spec.rb +1 -14
  94. data/spec/plugins/subscription/tumblr_spec.rb +3 -2
  95. data/spec/plugins/subscription/twitter_search_spec.rb +57 -0
  96. data/spec/plugins/subscription/twitter_spec.rb +3 -2
  97. data/spec/plugins/subscription/weather_spec.rb +2 -15
  98. data/spec/spec_helper.rb +1 -0
  99. data/test/integration/test_chan_toru.yml +19 -0
  100. data/test/integration/test_fluentd.yml +20 -0
  101. data/test/integration/test_pocket.yml +21 -0
  102. data/test/integration/test_sanitize.yml +22 -0
  103. data/test/integration/test_twitter_search.yml +21 -0
  104. metadata +145 -24
  105. data/plugins/publish/mail.rb +0 -64
  106. data/plugins/publish/smtp.rb +0 -48
  107. data/spec/plugins/publish/mail_spec.rb +0 -53
  108. data/spec/plugins/publish/smtp_spec.rb +0 -49
@@ -94,6 +94,27 @@ SubscriptionTwitter
94
94
  retry: エラー時のリトライ回数 (回数, 省略時 0)
95
95
 
96
96
 
97
+ SubscriptionTwitterSearch
98
+ -------------------------
99
+ [Path]
100
+ /plugins/subscription/twitter_search.rb
101
+
102
+ [Abstract]
103
+ Twitterの検索結果を取得
104
+
105
+ [Syntax]
106
+ - module: SubscriptionTwitterSearch
107
+ config:
108
+ search: 検索ワード
109
+ opt: 検索時に使用するオプション
110
+ consumer_key: 'your_consumer_key'
111
+ consumer_secret: 'your_consumer_secret'
112
+ oauth_token: 'your_oauth_token'
113
+ oauth_token_secret: 'your_oauth_token_secret'
114
+ interval: スクレイピングの間隔 (秒数, 省略可)
115
+ retry: エラー時のリトライ回数 (回数, 省略時 0)
116
+
117
+
97
118
  SubscriptionWeather
98
119
  -------------------
99
120
  [パス]
@@ -135,6 +156,62 @@ SubscriptionText
135
156
  retry: エラー時のリトライ回数 (回数, 省略時 0)
136
157
 
137
158
 
159
+ SubscriptionPocket
160
+ 検索キーワードからCHAN-TORUページの取得(Gk)
161
+ ------------------
162
+ [パス]
163
+ /plugins/subscription/pocket.rb
164
+
165
+ [概要]
166
+ Pocket APIをたたいてfeedの作成
167
+
168
+ [レシピ記法]
169
+ - module: SubscriptionPocket
170
+ config:
171
+ consumer_key: 'your_consumer_key'
172
+ access_token: 'your_access_token'
173
+ optional: # see http://getpocket.com/developer/docs/v3/retrieve
174
+ favorite: 1
175
+ count: 2
176
+ interval: スクレイピングの間隔 (秒数, 省略可)
177
+ retry: エラー時のリトライ回数 (回数, 省略時 0)
178
+
179
+
180
+ SubscriptionGGuide
181
+ ------------------
182
+ [パス]
183
+ /plugins/subscription/g_guide.rb
184
+
185
+ [概要]
186
+ 検索キーワードからGガイド(テレビ番組の情報)rssの取得
187
+
188
+ [レシピ記法]
189
+ - module: SubscriptionGGuide
190
+ config:
191
+ keyword: 'アニメ' # 検索ワード
192
+ station: '地上波' # 衛星放送の区域(現在は地上波のみ対応)
193
+ interval: スクレイピングの間隔 (秒数, 省略可)
194
+ retry: エラー時のリトライ回数 (回数, 省略時 0)
195
+
196
+
197
+ SubscriptionChanToru
198
+ --------------------
199
+ [パス]
200
+ /plugins/subscription/chan_toru.rb
201
+
202
+ [概要]
203
+ 検索キーワードからCHAN-TORU(テレビ番組の情報)rssの取得
204
+ (SubscriptionGGuideプラグイン依存)
205
+
206
+ [レシピ記法]
207
+ - module: SubscriptionChanToru
208
+ config:
209
+ keyword: 'アニメ' # 検索ワード
210
+ station: '地上波' # 衛星放送の区域(現在は地上波のみ対応)
211
+ interval: スクレイピングの間隔 (秒数, 省略可)
212
+ retry: エラー時のリトライ回数 (回数, 省略時 0)
213
+
214
+
138
215
  FilterSort
139
216
  ----------
140
217
  [パス]
@@ -170,6 +247,25 @@ FilterIgnore
170
247
  - 無視キーワード ...
171
248
 
172
249
 
250
+ FilterAccept
251
+ ------------
252
+ [パス]
253
+ /plugins/filter/accept.rb
254
+
255
+ [概要]
256
+ OK ワードのみにする
257
+
258
+ [レシピ記法]
259
+ - module: FilterAccept
260
+ config:
261
+ link:
262
+ - キーワード
263
+ - キーワード ...
264
+ description:
265
+ - キーワード
266
+ - キーワード ...
267
+
268
+
173
269
  FilterImage
174
270
  -----------
175
271
  [パス]
@@ -196,6 +292,48 @@ FilterImageSource
196
292
  - module: FilterImageSource
197
293
 
198
294
 
295
+ FilterOne
296
+ ---------
297
+ [パス]
298
+ /plugins/filter/one.rb
299
+
300
+ [概要]
301
+ アイテムをフィードから 1 件だけ取り出す
302
+
303
+ [レシピ記法]
304
+ - module: FilterOne
305
+ config:
306
+ pick: last (省略時は先頭から)
307
+
308
+
309
+ FilterRand
310
+ ----------
311
+ [パス]
312
+ /plugins/filter/rand.rb
313
+
314
+ [概要]
315
+ フィードの順番をランダムにする
316
+
317
+ [レシピ記法]
318
+ - module: FilterRand
319
+
320
+
321
+ FilterSanitize
322
+ --------------
323
+ [パス]
324
+ /plugins/filter/sanitize.rb
325
+
326
+ [概要]
327
+ HTML タグを除去する
328
+ 参照 https://github.com/rgrove/sanitize
329
+
330
+ [レシピ記法]
331
+ - module: FilterSanitize
332
+ config:
333
+ mode: basic or relaxed or restricted
334
+ (デフォルト restricted)
335
+
336
+
199
337
  FilterFullFeed
200
338
  --------------
201
339
  [パス]
@@ -225,7 +363,7 @@ FilterAbsoluteURI
225
363
 
226
364
 
227
365
  FilterTumblrResize
228
- --------------------
366
+ ------------------
229
367
  [パス]
230
368
  /plugins/filter/tumblr_resize.rb
231
369
 
@@ -240,32 +378,6 @@ FilterTumblrResize
240
378
  - module: FilterTumblrResize
241
379
 
242
380
 
243
- FilterOne
244
- ---------
245
- [パス]
246
- /plugins/filter/one.rb
247
-
248
- [概要]
249
- アイテムをフィードから 1 件だけ取り出す
250
-
251
- [レシピ記法]
252
- - module: FilterOne
253
- config:
254
- pick: last (省略時は先頭から)
255
-
256
-
257
- FilterRand
258
- ----------
259
- [パス]
260
- /plugins/filter/rand.rb
261
-
262
- [概要]
263
- フィードの順番をランダムにする
264
-
265
- [レシピ記法]
266
- - module: FilterRand
267
-
268
-
269
381
  StorePermalink
270
382
  --------------
271
383
  [パス]
@@ -299,7 +411,7 @@ StoreFullText
299
411
 
300
412
 
301
413
  StoreTargetLink
302
- --------------
414
+ ---------------
303
415
  [パス]
304
416
  /plugins/store/target_link.rb
305
417
 
@@ -315,7 +427,7 @@ StoreTargetLink
315
427
 
316
428
 
317
429
  PublishConsole
318
- ------------
430
+ --------------
319
431
  [パス]
320
432
  /plugins/publish/console.rb
321
433
 
@@ -326,6 +438,47 @@ PublishConsole
326
438
  - module: PublishConsole
327
439
 
328
440
 
441
+ PublishFluentd
442
+ --------------
443
+ [パス]
444
+ /plugins/publish/fluentd.rb
445
+
446
+ [概要]
447
+ fluentd にフィードを出力する
448
+
449
+ [説明]
450
+ このプラグインは fluentd にフィードを出力する
451
+ 受け手側では以下のように fluentd を設定し起動しておく
452
+
453
+ <source>
454
+ type forward
455
+ port 9999
456
+ </source>
457
+
458
+ [レシピ記法]
459
+ - module: PublishFluentd
460
+ config:
461
+ host: ホスト名
462
+ port: ポート番号
463
+ tag: タグ (例 automatic.feed)
464
+
465
+
466
+ PublishMemcached
467
+ ----------------
468
+ [パス]
469
+ /plugins/publish/memcached.rb
470
+
471
+ [概要]
472
+ フィードをハッシュに変換して memcached に出力する
473
+
474
+ [レシピ記法]
475
+ - module: PublishMemcached
476
+ config:
477
+ host: ホスト名
478
+ port: ポート番号
479
+ key: 出力するキーの名称
480
+
481
+
329
482
  PublishHatenaBookmark
330
483
  ---------------------
331
484
  [パス]
@@ -367,7 +520,7 @@ PublishTwitter
367
520
 
368
521
 
369
522
  PublishPocket
370
- -----------------
523
+ -------------
371
524
  [パス]
372
525
  /plugins/publish/pocket.rb
373
526
 
@@ -425,6 +578,44 @@ PublishGoogleCalendar
425
578
  interval: 複数の予定の投稿間隔 (秒)
426
579
 
427
580
 
581
+ PublishEject
582
+ ------------
583
+ [パス]
584
+ /plugins/publish/eject.rb
585
+
586
+ [概要]
587
+ Feedのリンク個数分だけeject
588
+
589
+ [レシピ記法]
590
+ - module: PublishEject
591
+ config:
592
+ interval: 複数の予定の投稿間隔 (秒)
593
+
594
+
595
+ PublishHipchat
596
+ --------------
597
+ [パス]
598
+ /plugins/publish/hipchat.rb
599
+
600
+ [概要]
601
+ HipChat の room にメッセージを送信する
602
+
603
+ [説明]
604
+ HipChat API (https://www.hipchat.com/docs/api) を利用して
605
+ item.description を任意の room にメッセージを送信する
606
+
607
+ [レシピ記法]
608
+ - module: PublishHipchat
609
+ config:
610
+ api_token: HipChat の API token (省略不可)
611
+ room_id: ルームID、もしくはルーム名 (省略不可)
612
+ username: 送信元のユーザ名 (省略不可)
613
+ color: 背景の色 (省略時 'yellow')
614
+ notify: メッセージをルームの人々に notice するかどうか (0 => false, 1 => true, 省略時 0)
615
+ retry: エラー時のリトライ回数 (回数, 省略時 0)
616
+ interval: エラー時のリトライ間隔 (秒数, 省略可)
617
+
618
+
428
619
  NotifyIkachan
429
620
  -------------
430
621
  [パス]
data/doc/README CHANGED
@@ -496,7 +496,7 @@ TODO
496
496
  Environment
497
497
  ===========
498
498
 
499
- Ruby 1.8 - 2.0.
499
+ Ruby 1.9 - 2.0.
500
500
 
501
501
  Depend on the packages that described in Gemfile.
502
502
 
@@ -504,7 +504,7 @@ TODO
504
504
  動作環境
505
505
  ========
506
506
 
507
- Ruby 1.8 - 2.0
507
+ Ruby 1.9 - 2.0
508
508
 
509
509
  Gemfile に記述された gem パッケージに依存
510
510
 
@@ -2,8 +2,8 @@
2
2
  # Name:: Automatic::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 18, 2012
5
- # Updated:: May 18, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
5
+ # Updated:: Jun 27, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic
@@ -13,7 +13,7 @@ module Automatic
13
13
  require 'automatic/log'
14
14
  require 'automatic/feed_parser'
15
15
 
16
- VERSION = "13.5.0"
16
+ VERSION = "13.6.0"
17
17
  USER_DIR = "/.automatic"
18
18
 
19
19
  class << self
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 19, 2012
5
5
  # Updated:: Jan 8, 2013
6
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic
@@ -38,7 +38,7 @@ module Automatic
38
38
  unless feeds.nil?
39
39
  feeds.each {|feed|
40
40
  unless feed.link.nil?
41
- Automatic::Log.puts("info", "Creating: #{feed.link}")
41
+ Automatic::Log.puts("info", "Feed: #{feed.link}")
42
42
  item = maker.items.new_item
43
43
  item.title = feed.title
44
44
  item.link = feed.link
@@ -3,14 +3,24 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 20, 2012
5
5
  # Updated:: Mar 11, 2012
6
- # Copyright:: 774 Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Automatic
10
10
  module Log
11
+ LOG_LEVELS = ['info', 'warn', 'error', 'none']
12
+
13
+ def self.level(level)
14
+ @level = level
15
+ end
16
+
11
17
  def self.puts(level, message)
18
+ if LOG_LEVELS.index(@level).to_i > LOG_LEVELS.index(level).to_i
19
+ return
20
+ end
12
21
  t = Time.now.strftime("%Y/%m/%d %X")
13
- print "#{t} [#{level}] #{message}\n"
22
+ print log = "#{t} [#{level}] #{message}\n"
23
+ return log
14
24
  end
15
25
  end
16
26
  end
@@ -3,7 +3,7 @@
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 22, 2012
5
5
  # Updated:: Mar 10, 2012
6
- # Copyright:: 774 Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require 'active_support/core_ext'
@@ -4,7 +4,7 @@
4
4
  # 774 <http://id774.net>
5
5
  # Created:: Feb 18, 2012
6
6
  # Updated:: Jun 14, 2012
7
- # Copyright:: 774 Copyright (c) 2012
7
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
8
8
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
9
 
10
10
  require 'hashie'
@@ -21,8 +21,11 @@ module Automatic
21
21
  def load_recipe(path)
22
22
  dir = File.join((File.expand_path('~/.automatic/config/')), path)
23
23
  path = dir if File.exist?(dir)
24
- Automatic::Log.puts("info", "Loading: #{path}")
25
24
  @procedure = Hashie::Mash.new(YAML.load(File.read(path)))
25
+ log_level = @procedure.global && @procedure.global.log && @procedure.global.log.level
26
+ Automatic::Log.level(log_level)
27
+ Automatic::Log.puts("info", "Loading: #{path}")
28
+ @procedure
26
29
  end
27
30
 
28
31
  def each_plugin
@@ -3,7 +3,7 @@
3
3
  # Author:: kzgs
4
4
  # Created:: Feb 29, 2012
5
5
  # Updated:: Mar 3, 2012
6
- # Copyright:: kzgs Copyright (c) 2012
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  require 'rss/maker'
@@ -19,12 +19,12 @@ module Automatic::Plugin
19
19
 
20
20
  def run
21
21
  revisions = XmlSimple.xml_in(`svn log #{svn_log_argument}`)["logentry"]
22
- @pipeline << RSS::Maker.make("1.0") { |maker|
22
+ @pipeline << RSS::Maker.make("1.0") {|maker|
23
23
  maker.channel.title = @config["title"] || ""
24
24
  maker.channel.about = ""
25
25
  maker.channel.description = ""
26
26
  maker.channel.link = base_url
27
- revisions.each { |rev|
27
+ revisions.each {|rev|
28
28
  item = maker.items.new_item
29
29
  item.title = "#{rev["msg"]} by #{rev["author"]}"
30
30
  item.link = base_url+"/!svn/bc/#{rev["revision"]}"