automatic 12.6.0 → 12.9.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 (56) hide show
  1. data/VERSION +1 -1
  2. data/automatic.gemspec +10 -22
  3. data/bin/automatic-config +4 -4
  4. data/doc/ChangeLog +30 -1
  5. data/doc/PLUGINS +46 -178
  6. data/doc/PLUGINS.ja +46 -177
  7. data/doc/README +2 -10
  8. data/doc/README.ja +2 -9
  9. data/lib/automatic.rb +2 -3
  10. data/plugins/custom_feed/svn_log.rb +0 -1
  11. data/plugins/filter/absolute_uri.rb +39 -0
  12. data/plugins/filter/image.rb +46 -0
  13. data/plugins/filter/reverse.rb +0 -1
  14. data/plugins/store/database.rb +8 -23
  15. data/plugins/store/full_text.rb +4 -4
  16. data/plugins/store/permalink.rb +12 -9
  17. data/plugins/store/target_link.rb +3 -2
  18. data/plugins/subscription/link.rb +55 -0
  19. data/plugins/subscription/twitter.rb +57 -0
  20. data/script/build +1 -1
  21. data/spec/lib/automatic_spec.rb +3 -2
  22. data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
  23. data/spec/plugins/filter/absolute_uri_spec.rb +61 -0
  24. data/spec/plugins/filter/image_source_spec.rb +1 -1
  25. data/spec/plugins/filter/image_spec.rb +65 -0
  26. data/spec/plugins/publish/google_calendar_spec.rb +1 -1
  27. data/spec/plugins/store/full_text_spec.rb +0 -1
  28. data/spec/plugins/store/permalink_spec.rb +52 -3
  29. data/spec/plugins/store/target_link_spec.rb +1 -2
  30. data/spec/plugins/subscription/feed_spec.rb +0 -1
  31. data/spec/plugins/subscription/{uri_spec.rb → link_spec.rb} +9 -10
  32. data/spec/plugins/subscription/twitter_spec.rb +42 -0
  33. data/spec/spec_helper.rb +12 -26
  34. data/spec/user_dir/plugins/store/mock.rb +1 -1
  35. data/test/integration/test_get_image.yml +4 -6
  36. data/test/integration/test_image2local.yml +1 -1
  37. metadata +10 -22
  38. data/config/html2console.yml +0 -16
  39. data/plugins/extract/link.rb +0 -32
  40. data/plugins/filter/image_link.rb +0 -37
  41. data/plugins/publish/dump.rb +0 -24
  42. data/plugins/store/link.rb +0 -47
  43. data/plugins/store/target.rb +0 -41
  44. data/plugins/subscription/uri.rb +0 -31
  45. data/spec/fixtures/extractLink.html +0 -14
  46. data/spec/fixtures/filterImageLink.html +0 -34
  47. data/spec/fixtures/publishDump.html +0 -14
  48. data/spec/fixtures/storeLink.html +0 -34
  49. data/spec/fixtures/storeLink2.html +0 -36
  50. data/spec/fixtures/storeTarget.html +0 -11
  51. data/spec/fixtures/storeTarget2.html +0 -11
  52. data/spec/plugins/extract/link_spec.rb +0 -38
  53. data/spec/plugins/filter/image_link_spec.rb +0 -51
  54. data/spec/plugins/publish/dump_spec.rb +0 -32
  55. data/spec/plugins/store/link_spec.rb +0 -47
  56. data/spec/plugins/store/target_spec.rb +0 -41
data/doc/PLUGINS.ja CHANGED
@@ -7,12 +7,6 @@ SubscriptionFeed
7
7
  [パス]
8
8
  /plugins/subscription/feed.rb
9
9
 
10
- [入力]
11
- 無し
12
-
13
- [出力]
14
- フィード
15
-
16
10
  [概要]
17
11
  フィードを購読する
18
12
 
@@ -24,17 +18,43 @@ SubscriptionFeed
24
18
  - フィード名 ...
25
19
 
26
20
 
21
+ SubscriptionLink
22
+ ----------------
23
+ [パス]
24
+ /plugins/subscription/link.rb
25
+
26
+ [概要]
27
+ URL を購読しそのリンクを抽出する
28
+
29
+ [レシピ記法]
30
+ - module: SubscriptionLink
31
+ config:
32
+ urls:
33
+ - URL
34
+ - URL ...
35
+
36
+
37
+ SubscriptionTwitter
38
+ -------------------
39
+ [パス]
40
+ /plugins/subscription/link.rb
41
+
42
+ [概要]
43
+ Twitter を購読し、発言とそのリンクを抽出する
44
+
45
+ [レシピ記法]
46
+ - module: SubscriptionTwitter
47
+ config:
48
+ urls:
49
+ - URL
50
+ - URL ...
51
+
52
+
27
53
  FilterReverse
28
54
  -------------
29
55
  [パス]
30
56
  /plugins/filter/reverse.rb
31
57
 
32
- [入力]
33
- フィード
34
-
35
- [出力]
36
- フィード
37
-
38
58
  [概要]
39
59
  日付の昇順にソートする
40
60
 
@@ -47,12 +67,6 @@ FilterIgnore
47
67
  [パス]
48
68
  /plugins/filter/ignore.rb
49
69
 
50
- [入力]
51
- フィード
52
-
53
- [出力]
54
- フィード
55
-
56
70
  [概要]
57
71
  NG ワードを除外する
58
72
 
@@ -69,12 +83,6 @@ FilterImageSource
69
83
  [パス]
70
84
  /plugins/filter/image_source.rb
71
85
 
72
- [入力]
73
- フィード
74
-
75
- [出力]
76
- フィード
77
-
78
86
  [概要]
79
87
  パーマリンクを本文中の画像のソースリンクに書き換える
80
88
  画像のソースリンクが無い場合は nil にする
@@ -83,17 +91,25 @@ FilterImageSource
83
91
  - module: FilterImageSource
84
92
 
85
93
 
94
+ FilterAbsoluteURI
95
+ -----------------
96
+ [パス]
97
+ /plugins/filter/absolute_uri.rb
98
+
99
+ [概要]
100
+ リンクの相対パスを絶対パスに書き換える
101
+
102
+ [レシピ記法]
103
+ - module: FilterAbsoluteURI
104
+ config:
105
+ url: http://targethost.com/
106
+
107
+
86
108
  FilterTumblrResize
87
109
  --------------------
88
110
  [パス]
89
111
  /plugins/filter/tumblr_resize.rb
90
112
 
91
- [入力]
92
- フィード
93
-
94
- [出力]
95
- フィード
96
-
97
113
  [概要]
98
114
  パーマリンクを Tumblr の最大サイズ
99
115
  (High Res) に書き換える
@@ -110,12 +126,6 @@ StorePermalink
110
126
  [パス]
111
127
  /plugins/store/permalink.rb
112
128
 
113
- [入力]
114
- フィード
115
-
116
- [出力]
117
- フィード
118
-
119
129
  [概要]
120
130
  パーマリンクを保存する
121
131
  重複したパーマリンクは破棄する
@@ -131,12 +141,6 @@ StoreFullText
131
141
  [パス]
132
142
  /plugins/store/full_text.rb
133
143
 
134
- [入力]
135
- フィード
136
-
137
- [出力]
138
- フィード
139
-
140
144
  [概要]
141
145
  フィード全文を DB に保存する
142
146
 
@@ -154,12 +158,6 @@ StoreTargetLink
154
158
  [パス]
155
159
  /plugins/store/target_link.rb
156
160
 
157
- [入力]
158
- フィード
159
-
160
- [出力]
161
- フィード
162
-
163
161
  [概要]
164
162
  リンク先のコンテンツをローカルに保存する
165
163
 
@@ -175,12 +173,6 @@ PublishConsole
175
173
  [パス]
176
174
  /plugins/publish/console.rb
177
175
 
178
- [入力]
179
- フィード
180
-
181
- [出力]
182
- フィード
183
-
184
176
  [概要]
185
177
  パイプラインをコンソールに出力する
186
178
 
@@ -196,12 +188,6 @@ PublishHatenaBookmark
196
188
  [概要]
197
189
  はてなブックマークをする
198
190
 
199
- [入力]
200
- フィード
201
-
202
- [出力]
203
- フィード
204
-
205
191
  [説明]
206
192
  はてなブックマーク API への投稿用 XML を生成し
207
193
  送信する
@@ -222,12 +208,6 @@ PublishGoogleCalendar
222
208
  [概要]
223
209
  Google Calendar に予定を登録する
224
210
 
225
- [入力]
226
- フィード
227
-
228
- [出力]
229
- フィード
230
-
231
211
  [説明]
232
212
  item.title を Google カレンダーに登録する
233
213
 
@@ -247,12 +227,6 @@ NotifyIkachan
247
227
  [概要]
248
228
  ikachan へメッセージを送信する
249
229
 
250
- [入力]
251
- フィード
252
-
253
- [出力]
254
- フィード
255
-
256
230
  [説明]
257
231
  ikachan へ HTTP 経由で POST する
258
232
  ikachan とは: http://blog.yappo.jp/yappo/archives/000760.html
@@ -272,12 +246,6 @@ CustomFeedSVNLog
272
246
  [パス]
273
247
  /plugins/custom_feed/svn_log.rb
274
248
 
275
- [入力]
276
- 無し
277
-
278
- [出力]
279
- フィード
280
-
281
249
  [概要]
282
250
  SVN から新しいリビジョン情報を取得する
283
251
 
@@ -292,102 +260,3 @@ CustomFeedSVNLog
292
260
  fetch_items: 2 # 指定されない場合は 30
293
261
 
294
262
 
295
- SubscriptionURI
296
- ---------------
297
- [パス]
298
- /plugins/subscription/uri.rb
299
-
300
- [入力]
301
- 無し
302
-
303
- [出力]
304
- HTML
305
-
306
- [概要]
307
- http/ftp の URL をファイルオブジェクトとして開く
308
-
309
- [レシピ記法]
310
- - module: CustomFeedURI
311
- config:
312
- url:
313
- - URL
314
- - URL ...
315
-
316
-
317
- ExtractLink
318
- -----------
319
- [パス]
320
- /plugins/extract/link.rb
321
-
322
- [入力]
323
- HTML
324
-
325
- [出力]
326
- An array of links.
327
-
328
- [概要]
329
- HTML の a リンクのみを抽出する
330
-
331
- [レシピ記法]
332
- - module: FilterLink
333
-
334
-
335
- FilterImageLink
336
- ---------------
337
- [パス]
338
- /plugins/filter/image_link.rb
339
-
340
- [入力]
341
- An array of links.
342
-
343
- [出力]
344
- An array of links.
345
-
346
- [概要]
347
- 画像ファイルのリンクのみを抽出する
348
-
349
- [レシピ記法]
350
- - module: FilterImageLink
351
-
352
-
353
- StoreLink
354
- ---------
355
- [パス]
356
- /plugins/store/link.rb
357
-
358
- [入力]
359
- An array of links.
360
-
361
- [出力]
362
- An array of links.
363
-
364
- [概要]
365
- パーマリンクを保存する
366
- 重複したパーマリンクは破棄する
367
- これは StorePermalink の HTML 版である
368
-
369
- [レシピ記法]
370
- - module: StoreLink
371
- config:
372
- db: パーマリンクを保存する SQLite3 DB 名
373
-
374
-
375
- StoreTarget
376
- -----------
377
- [パス]
378
- /plugins/store/target.rb
379
-
380
- [入力]
381
- An array of links.
382
-
383
- [出力]
384
- An array of links.
385
-
386
- [概要]
387
- HTML の a リンク先のコンテンツをローカルに保存する
388
-
389
- [レシピ記法]
390
- - module: StoreTarget
391
- config:
392
- path: 保存先のフォルダ
393
- interval: 保存する間隔 (秒)
data/doc/README CHANGED
@@ -215,9 +215,6 @@ Directory and file structure
215
215
  | +-- customfeed
216
216
  | | Plug-ins to generate a custom feed.
217
217
  | |
218
- | +-- extract
219
- | | Plug-ins to extract the information.
220
- | |
221
218
  | +-- filter
222
219
  | | Plug-ins to filter the information.
223
220
  | |
@@ -336,9 +333,8 @@ After that, we will give you the right to commit for a quick fix finely.
336
333
  Coding Rule
337
334
  ===========
338
335
 
339
- 2 tabs (Soft Tabs).
336
+ Coding standards should be completed in 1 file.
340
337
  Remove trailing spaces.
341
- Namespace and conventions, see the existing code.
342
338
  {} is recommended than do end (To avoid end end end,,).
343
339
  RDoc Header is written by creator of the file.
344
340
  Write tests with RSPec.
@@ -367,11 +363,7 @@ pipeline backs again as the return value.
367
363
 
368
364
  This mechanism called "Automatic::Pipeline".
369
365
 
370
- The contents of the pipeline is the object of your choice.
371
- You can be stored in a format RSS, HTML, and various other
372
- in pipeline. However, when combined with the plug-in, it's
373
- necessary to input data format of the previous plug-ins
374
- and plug-in output of the next match.
366
+ The contents of the pipeline is the array of the feeds.
375
367
 
376
368
 
377
369
  =============================
data/doc/README.ja CHANGED
@@ -195,9 +195,6 @@ plugins:
195
195
  | +- customfeed
196
196
  | | カスタムフィードを生成するプラグイン
197
197
  | |
198
- | +- extract
199
- | | 情報を抽出するプラグイン
200
- | |
201
198
  | +- filter
202
199
  | | 情報をフィルタリングするプラグイン
203
200
  | |
@@ -317,9 +314,8 @@ http://jenkins.id774.net/jenkins/
317
314
  コーディング規約
318
315
  ================
319
316
 
320
- 2 タブ (ソフトタブ)
317
+ コーディング規約は 1 ファイルの中で完結するべきである
321
318
  末尾のスペースは除去
322
- 名前空間は既存のコードを参照
323
319
  {} は do end より推奨される
324
320
  RDoc ヘッダはファイルの作者によって書かれる
325
321
  RSPec でテストを書く
@@ -373,10 +369,7 @@ Automatic::Pipeline とは
373
369
 
374
370
  この機構を本フレームワークでは Automatic::Pipeline と呼ぶ。
375
371
 
376
- pipeline の中身は任意のオブジェクトである。
377
- RSS 、 HTML 、その他様々なフォーマットを格納して良い。
378
- ただし、プラグインを組み合わせるとき前のプラグインの出力と
379
- 次のプラグインの入力のデータフォーマットが一致する必要がある。
372
+ pipeline の中身はフィードの配列である。
380
373
 
381
374
 
382
375
  ====================
data/lib/automatic.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Name:: Automatic::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
- # Version:: 12.6.0
5
4
  # Created:: Feb 18, 2012
6
- # Updated:: Jun 18, 2012
5
+ # Updated:: Sep 18, 2012
7
6
  # Copyright:: 774 Copyright (c) 2012
8
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
9
8
 
@@ -14,7 +13,7 @@ module Automatic
14
13
  require 'automatic/log'
15
14
  require 'automatic/feed_parser'
16
15
 
17
- VERSION = "12.6.0"
16
+ VERSION = "12.9.1"
18
17
  USER_DIR = "/.automatic"
19
18
 
20
19
  class << self
@@ -53,4 +53,3 @@ module Automatic::Plugin
53
53
  end
54
54
  end
55
55
  end
56
-
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Filter::AbsoluteURI
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Jun 20, 2012
5
+ # Updated:: Sep 18, 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 FilterAbsoluteURI
11
+
12
+ def initialize(config, pipeline=[])
13
+ @config = config
14
+ @pipeline = pipeline
15
+ end
16
+
17
+ def rewrite(string)
18
+ if /^http:\/\/.*$/ =~ string
19
+ return string
20
+ else
21
+ return @config['url'] + string
22
+ end
23
+ end
24
+
25
+ def run
26
+ @return_feeds = []
27
+ @pipeline.each {|feeds|
28
+ return_feed_items = []
29
+ unless feeds.nil?
30
+ feeds.items.each {|feed|
31
+ feed.link = rewrite(feed.link) unless feed.link.nil?
32
+ }
33
+ @return_feeds << feeds
34
+ end
35
+ }
36
+ @return_feeds
37
+ end
38
+ end
39
+ end