automatic 13.6.0 → 13.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 099ebe9f608899e3318f8293889007967d9c4d72
4
+ data.tar.gz: 88c76fd97d4d934d0dfab965a0cda255b841d5eb
5
+ SHA512:
6
+ metadata.gz: 58984aa3a163a1fecd59d800bc3cd7602b9fc0c24cdc80a2a247ff1738bc1f3ba369fa2aeda337ce2abbbba0e0ebdd2c8dd85b62819acfafea463ba8e0d84014
7
+ data.tar.gz: 0f87f0567276ccc1fbe5faf712be010ce826d87a3bd266d7e0327fc9c64f968fa32fd7b350a48c22fafd2b0433705c2b4bb499c510f82becd24dd7ecdb29ebf1
data/Gemfile CHANGED
@@ -7,7 +7,6 @@ gem 'json', '~> 1.7.7'
7
7
  gem 'sqlite3'
8
8
  gem 'activesupport', '~>4.0.0'
9
9
  gem 'activerecord', '~>4.0.0'
10
- gem 'actionmailer', '~>4.0.0'
11
10
  gem 'hashie'
12
11
  gem 'gcalapi'
13
12
  gem 'xml-simple'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 13.6.0
1
+ 13.7.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "automatic"
8
- s.version = "13.6.0"
8
+ s.version = "13.7.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 = "2013-06-28"
12
+ s.date = "2013-07-27"
13
13
  s.description = "Ruby General Automation Framework"
14
14
  s.email = "idnanashi@gmail.com"
15
15
  s.executables = ["automatic"]
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  "plugins/filter/sort.rb",
55
55
  "plugins/filter/tumblr_resize.rb",
56
56
  "plugins/notify/ikachan.rb",
57
+ "plugins/provide/fluentd.rb",
57
58
  "plugins/publish/console.rb",
58
59
  "plugins/publish/console_link.rb",
59
60
  "plugins/publish/eject.rb",
@@ -72,7 +73,6 @@ Gem::Specification.new do |s|
72
73
  "plugins/subscription/chan_toru.rb",
73
74
  "plugins/subscription/feed.rb",
74
75
  "plugins/subscription/g_guide.rb",
75
- "plugins/subscription/google_reader_star.rb",
76
76
  "plugins/subscription/link.rb",
77
77
  "plugins/subscription/pocket.rb",
78
78
  "plugins/subscription/text.rb",
@@ -80,6 +80,7 @@ Gem::Specification.new do |s|
80
80
  "plugins/subscription/twitter.rb",
81
81
  "plugins/subscription/twitter_search.rb",
82
82
  "plugins/subscription/weather.rb",
83
+ "plugins/subscription/xml.rb",
83
84
  "script/build",
84
85
  "spec/fixtures/sampleRecipe.yml",
85
86
  "spec/lib/automatic/log_spec.rb",
@@ -100,6 +101,7 @@ Gem::Specification.new do |s|
100
101
  "spec/plugins/filter/sort_spec.rb",
101
102
  "spec/plugins/filter/tumblr_resize_spec.rb",
102
103
  "spec/plugins/notify/ikachan_spec.rb",
104
+ "spec/plugins/provide/fluentd_spec.rb",
103
105
  "spec/plugins/publish/console_spec.rb",
104
106
  "spec/plugins/publish/eject_spec.rb",
105
107
  "spec/plugins/publish/fluentd_spec.rb",
@@ -116,7 +118,6 @@ Gem::Specification.new do |s|
116
118
  "spec/plugins/subscription/chan_toru_spec.rb",
117
119
  "spec/plugins/subscription/feed_spec.rb",
118
120
  "spec/plugins/subscription/g_guide_spec.rb",
119
- "spec/plugins/subscription/google_reader_star_spec.rb",
120
121
  "spec/plugins/subscription/link_spec.rb",
121
122
  "spec/plugins/subscription/pocket_spec.rb",
122
123
  "spec/plugins/subscription/text_spec.rb",
@@ -124,6 +125,7 @@ Gem::Specification.new do |s|
124
125
  "spec/plugins/subscription/twitter_search_spec.rb",
125
126
  "spec/plugins/subscription/twitter_spec.rb",
126
127
  "spec/plugins/subscription/weather_spec.rb",
128
+ "spec/plugins/subscription/xml_spec.rb",
127
129
  "spec/spec_helper.rb",
128
130
  "spec/user_dir/plugins/store/mock.rb",
129
131
  "test/fixtures/sampleOPML.xml",
@@ -134,7 +136,6 @@ Gem::Specification.new do |s|
134
136
  "test/integration/test_fluentd.yml",
135
137
  "test/integration/test_fulltext.yml",
136
138
  "test/integration/test_googlealert.yml",
137
- "test/integration/test_googlestar.yml",
138
139
  "test/integration/test_hatenabookmark.yml",
139
140
  "test/integration/test_ignore.yml",
140
141
  "test/integration/test_ignore2.yml",
@@ -151,23 +152,23 @@ Gem::Specification.new do |s|
151
152
  "test/integration/test_tumblr2local.yml",
152
153
  "test/integration/test_twitter_search.yml",
153
154
  "test/integration/test_weather.yml",
155
+ "test/integration/test_xml2fluentd.yml",
154
156
  "vendor/.gitkeep"
155
157
  ]
156
158
  s.homepage = "http://github.com/automaticruby/automaticruby"
157
159
  s.licenses = ["GPL"]
158
160
  s.require_paths = ["lib"]
159
- s.rubygems_version = "1.8.24"
161
+ s.rubygems_version = "2.0.5"
160
162
  s.summary = "Automatic Ruby"
161
163
 
162
164
  if s.respond_to? :specification_version then
163
- s.specification_version = 3
165
+ s.specification_version = 4
164
166
 
165
167
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
166
168
  s.add_runtime_dependency(%q<json>, ["~> 1.7.7"])
167
169
  s.add_runtime_dependency(%q<sqlite3>, [">= 0"])
168
170
  s.add_runtime_dependency(%q<activesupport>, ["~> 4.0.0"])
169
171
  s.add_runtime_dependency(%q<activerecord>, ["~> 4.0.0"])
170
- s.add_runtime_dependency(%q<actionmailer>, ["~> 4.0.0"])
171
172
  s.add_runtime_dependency(%q<hashie>, [">= 0"])
172
173
  s.add_runtime_dependency(%q<gcalapi>, [">= 0"])
173
174
  s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
@@ -189,7 +190,6 @@ Gem::Specification.new do |s|
189
190
  s.add_dependency(%q<sqlite3>, [">= 0"])
190
191
  s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
191
192
  s.add_dependency(%q<activerecord>, ["~> 4.0.0"])
192
- s.add_dependency(%q<actionmailer>, ["~> 4.0.0"])
193
193
  s.add_dependency(%q<hashie>, [">= 0"])
194
194
  s.add_dependency(%q<gcalapi>, [">= 0"])
195
195
  s.add_dependency(%q<xml-simple>, [">= 0"])
@@ -212,7 +212,6 @@ Gem::Specification.new do |s|
212
212
  s.add_dependency(%q<sqlite3>, [">= 0"])
213
213
  s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
214
214
  s.add_dependency(%q<activerecord>, ["~> 4.0.0"])
215
- s.add_dependency(%q<actionmailer>, ["~> 4.0.0"])
216
215
  s.add_dependency(%q<hashie>, [">= 0"])
217
216
  s.add_dependency(%q<gcalapi>, [">= 0"])
218
217
  s.add_dependency(%q<xml-simple>, [">= 0"])
@@ -3,8 +3,8 @@
3
3
  # Name:: Automatic::Ruby
4
4
  # Author:: 774 <http://id774.net>
5
5
  # Created:: Feb 18, 2012
6
- # Updated:: Apr 10, 2013
7
- # Copyright:: 774 Copyright (c) 2012-2013
6
+ # Updated:: Jul 19, 2013
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
  root_dir = File.expand_path("..", File.dirname(__FILE__))
@@ -1,3 +1,13 @@
1
+ === 13.7.0 / 2013-07-28
2
+
3
+ * Added new plugins.
4
+
5
+ * Subscription::Xml
6
+ * Provide::Fluentd
7
+
8
+ * Fix some problems.
9
+
10
+
1
11
  === 13.6.0 / 2013-06-28
2
12
 
3
13
  * Added new plugins.
@@ -38,42 +38,43 @@ SubscriptionLink
38
38
  retry: RETRY_COUNT
39
39
 
40
40
 
41
- SubscriptionTumblr
42
- ------------------
41
+ SubscriptionXml
42
+ ---------------
43
43
  [Path]
44
- /plugins/subscription/tumblr.rb
44
+ /plugins/subscription/xml.rb
45
45
 
46
46
  [Abstract]
47
- Subscribe tumblr and extract the links.
48
- If pages specified, including past pages.
47
+ Subscribe XML API with GET method.
48
+ This plug-in store encoded XML in content_encoded of RSS feed.
49
49
 
50
50
  [Syntax]
51
- - module: SubscriptionTumblr
51
+ - module: SubscriptionXml
52
52
  config:
53
53
  urls:
54
54
  - URL
55
- - URL ...
56
- pages: PAGES
55
+ - URL ... (XML base API)
57
56
  interval: INTERVAL_FOR_SCRAPING (in seconds.)
58
57
  retry: RETRY_COUNT
59
58
 
60
59
 
61
- SubscriptionGoogleReaderStar
62
- ----------------------------
60
+ SubscriptionTumblr
61
+ ------------------
63
62
  [Path]
64
- /plugins/subscription/google_reader_star.rb
63
+ /plugins/subscription/tumblr.rb
65
64
 
66
65
  [Abstract]
67
- Subscribe to Google reader star feed.
66
+ Subscribe tumblr and extract the links.
67
+ If pages specified, including past pages.
68
68
 
69
69
  [Syntax]
70
- - module: SubscriptionGoogleReaderStar
70
+ - module: SubscriptionTumblr
71
71
  config:
72
- feeds:
73
- - FEED
74
- - FEED ...
72
+ urls:
73
+ - URL
74
+ - URL ...
75
+ pages: PAGES
76
+ interval: INTERVAL_FOR_SCRAPING (in seconds.)
75
77
  retry: RETRY_COUNT
76
- interval: INTERVAL_FOR_RETRY (in seconds.)
77
78
 
78
79
 
79
80
  SubscriptionTwitter
@@ -187,7 +188,7 @@ SubscriptionGGuide
187
188
  [Syntax]
188
189
  - module: SubscriptionGGuide
189
190
  config:
190
- keyword: 'anime' # search word
191
+ keyword: 'anime,shogi' # search word (',' dividing and coming out two or more search)
191
192
  station: '地上波' # (It means terrestrial broadcasting in Japanese.)
192
193
  interval: INTERVAL_FOR_SCRAPING (in seconds.)
193
194
  retry: RETRY_COUNT
@@ -462,6 +463,28 @@ PublishFluentd
462
463
  tag: TAGS (example: automatic.feed)
463
464
 
464
465
 
466
+ ProvideFluentd
467
+ --------------
468
+ [Path]
469
+ /plugins/provide/fluentd.rb
470
+
471
+ [Abstract]
472
+ This plugin output content_encoded to fluentd.
473
+
474
+ [Description]
475
+ Provide::Fluentd is different from Publish::Fluentd.
476
+
477
+ Publish::Fluentd -> Output feed to flulentd.
478
+ Provide::Fluentd -> Output content_encoded to fluentd.
479
+
480
+ [Syntax]
481
+ - module: ProvideFluentd
482
+ config:
483
+ host: HOSTNAME
484
+ port: PORT_NUMBER
485
+ tag: TAGS (example: automatic.feed)
486
+
487
+
465
488
  PublishMemcached
466
489
  ----------------
467
490
  [Path]
@@ -38,42 +38,44 @@ SubscriptionLink
38
38
  retry: エラー時のリトライ回数 (回数, 省略時 0)
39
39
 
40
40
 
41
- SubscriptionTumblr
42
- ------------------
41
+ SubscriptionXml
42
+ ---------------
43
43
  [パス]
44
- /plugins/subscription/tumblr.rb
44
+ /plugins/subscription/xml.rb
45
45
 
46
46
  [概要]
47
- Tumblr を購読し、リンクを抽出する
48
- pages が指定された場合、過去のページも遡って購読する
47
+ XML で提供された API を GET メソッドで購読する
48
+ このプラグインはエンコードされた XML を RSS フィードの
49
+ content_encoded に保存する
49
50
 
50
51
  [レシピ記法]
51
- - module: SubscriptionTumblr
52
+ - module: SubscriptionXml
52
53
  config:
53
54
  urls:
54
55
  - URL
55
- - URL ...
56
- pages: PAGES
56
+ - URL ... (XML ベース API)
57
57
  interval: スクレイピングの間隔 (秒数, 省略可)
58
58
  retry: エラー時のリトライ回数 (回数, 省略時 0)
59
59
 
60
60
 
61
- SubscriptionGoogleReaderStar
62
- ----------------------------
61
+ SubscriptionTumblr
62
+ ------------------
63
63
  [パス]
64
- /plugins/subscription/google_reader_star.rb
64
+ /plugins/subscription/tumblr.rb
65
65
 
66
66
  [概要]
67
- Google リーダーのスターフィードを購読する
67
+ Tumblr を購読し、リンクを抽出する
68
+ pages が指定された場合、過去のページも遡って購読する
68
69
 
69
70
  [レシピ記法]
70
- - module: SubscriptionGoogleReaderStar
71
+ - module: SubscriptionTumblr
71
72
  config:
72
- feeds:
73
- - フィード名
74
- - フィード名 ...
73
+ urls:
74
+ - URL
75
+ - URL ...
76
+ pages: PAGES
77
+ interval: スクレイピングの間隔 (秒数, 省略可)
75
78
  retry: エラー時のリトライ回数 (回数, 省略時 0)
76
- interval: エラー時のリトライ間隔 (秒数, 省略可)
77
79
 
78
80
 
79
81
  SubscriptionTwitter
@@ -188,7 +190,7 @@ SubscriptionGGuide
188
190
  [レシピ記法]
189
191
  - module: SubscriptionGGuide
190
192
  config:
191
- keyword: 'アニメ' # 検索ワード
193
+ keyword: 'アニメ,将棋' # 検索ワード(','区切りで複数検索)
192
194
  station: '地上波' # 衛星放送の区域(現在は地上波のみ対応)
193
195
  interval: スクレイピングの間隔 (秒数, 省略可)
194
196
  retry: エラー時のリトライ回数 (回数, 省略時 0)
@@ -206,7 +208,7 @@ SubscriptionChanToru
206
208
  [レシピ記法]
207
209
  - module: SubscriptionChanToru
208
210
  config:
209
- keyword: 'アニメ' # 検索ワード
211
+ keyword: 'アニメ,将棋' # 検索ワード(','区切りで複数検索)
210
212
  station: '地上波' # 衛星放送の区域(現在は地上波のみ対応)
211
213
  interval: スクレイピングの間隔 (秒数, 省略可)
212
214
  retry: エラー時のリトライ回数 (回数, 省略時 0)
@@ -463,6 +465,28 @@ PublishFluentd
463
465
  tag: タグ (例 automatic.feed)
464
466
 
465
467
 
468
+ ProvideFluentd
469
+ --------------
470
+ [パス]
471
+ /plugins/provide/fluentd.rb
472
+
473
+ [概要]
474
+ fluentd に content_encoded の内容を出力する
475
+
476
+ [説明]
477
+ このプラグインは Publish::Fluentd とは異なる
478
+
479
+ Publish::Fluentd -> フィード全体を fluentd に出力
480
+ Provide::Fluentd -> content_encoded の内容を fluentd に出力
481
+
482
+ [レシピ記法]
483
+ - module: ProvideFluentd
484
+ config:
485
+ host: ホスト名
486
+ port: ポート番号
487
+ tag: タグ (例 automatic.feed)
488
+
489
+
466
490
  PublishMemcached
467
491
  ----------------
468
492
  [パス]
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::Ruby
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 18, 2012
5
- # Updated:: Jun 27, 2013
5
+ # Updated:: Jul 28, 2013
6
6
  # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -13,7 +13,7 @@ module Automatic
13
13
  require 'automatic/log'
14
14
  require 'automatic/feed_parser'
15
15
 
16
- VERSION = "13.6.0"
16
+ VERSION = "13.7.0"
17
17
  USER_DIR = "/.automatic"
18
18
 
19
19
  class << self
@@ -2,7 +2,7 @@
2
2
  # Name:: Automatic::FeedParser
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Feb 19, 2012
5
- # Updated:: Jan 8, 2013
5
+ # Updated:: Jul 12, 2013
6
6
  # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
@@ -77,5 +77,19 @@ module Automatic
77
77
  }
78
78
  end
79
79
 
80
+ def self.content_provide(url, data)
81
+ RSS::Maker.make("2.0") {|maker|
82
+ xss = maker.xml_stylesheets.new_xml_stylesheet
83
+ maker.channel.title = "Automatic Ruby"
84
+ maker.channel.description = "Automatic Ruby"
85
+ maker.channel.link = "https://github.com/automaticruby/automaticruby"
86
+ maker.items.do_sort = true
87
+ item = maker.items.new_item
88
+ item.title = "Automatic Ruby"
89
+ item.link = url
90
+ item.content_encoded = data
91
+ item.date = Time.now
92
+ }
93
+ end
80
94
  end
81
95
  end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Name:: Automatic::Plugin::Provide::Fluentd
3
+ # Author:: 774 <http://id774.net>
4
+ # Created:: Jul 12, 2013
5
+ # Updated:: Jul 12, 2013
6
+ # Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
7
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
+
9
+ module Automatic::Plugin
10
+ class ProvideFluentd
11
+ require 'fluent-logger'
12
+ require 'active_support'
13
+
14
+ def initialize(config, pipeline=[])
15
+ @config = config
16
+ @pipeline = pipeline
17
+ @fluentd = Fluent::Logger::FluentLogger.open(nil,
18
+ host = @config['host'],
19
+ port = @config['port'])
20
+ end
21
+
22
+ def run
23
+ @pipeline.each {|feeds|
24
+ unless feeds.nil?
25
+ feeds.items.each {|feed|
26
+ begin
27
+ @fluentd.post(@config['tag'], feed.content_encoded)
28
+ rescue
29
+ Automatic::Log.puts("error", "Fluent::Logger.post failed, the content_encoded of item may be not kind of Hash.")
30
+ end
31
+ }
32
+ end
33
+ }
34
+ @pipeline
35
+ end
36
+ end
37
+ end
@@ -13,12 +13,19 @@ module Automatic::Plugin
13
13
  def initialize(config, pipeline=[])
14
14
  @config = config
15
15
  @pipeline = pipeline
16
+ unless @config['keyword'].nil? || @config['keyword'].index(',').nil?
17
+ @keywords = @config['keyword'].split(',')
18
+ else
19
+ @keywords = [@config['keyword']]
20
+ end
16
21
  end
17
22
 
18
23
  def run
19
24
  retries = 0
20
25
  begin
21
- @pipeline << Automatic::FeedParser.get(feed_url)
26
+ @keywords.each {|keyword|
27
+ @pipeline << Automatic::FeedParser.get(feed_url keyword)
28
+ }
22
29
  rescue
23
30
  retries += 1
24
31
  Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
@@ -28,10 +35,10 @@ module Automatic::Plugin
28
35
  @pipeline
29
36
  end
30
37
 
31
- def feed_url
38
+ def feed_url keyword = nil
32
39
  feed = G_GUIDE_RSS
33
- unless @config['keyword'].nil?
34
- feed += "condition.keyword=#{@config['keyword']}&"
40
+ unless keyword.nil?
41
+ feed += "condition.keyword=#{keyword}&"
35
42
  end
36
43
  feed += station_param
37
44
  URI.encode(feed)