fluent-plugin-github-activities 0.5.0 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db6ee8ed9280b6965e10bd6ebf3248aba5a945de
4
- data.tar.gz: 58e9f85025bcab3c4094203eb8ebca1133faed30
3
+ metadata.gz: 8d4c4dfb2ff1abe4ead0899ef10dab5b644a429f
4
+ data.tar.gz: 060eaa62c186efa222dda29b0019d1f3f97ef540
5
5
  SHA512:
6
- metadata.gz: 3a357bc0e21a4eda4069a8eee4df00e7fe7508de55cd51f9251e529d3d54ef27d3e7613d87e6ce8069afb19d2200aee458914038a9a41dc845d32541758290b7
7
- data.tar.gz: 0177ef399a2d19968e3628c6ad3686c2e2f1e99a581be729521c85977ca1e609136c8b5742c0bab43d985a8f984be122749fe05d31d55df6a7c9d45d1861b175
6
+ metadata.gz: 7095098c73a21c38afa298242141904a7c966c80d69d43b13e8bada9745c1b76c43d073c0a3865da93321022d1c581cbc6466afb1924aa2492671043c9f29d68
7
+ data.tar.gz: b82126b18196b60649ea97ef57acafcba9329f469b750f57cce594efa8d358d1ad6707a3cb639301c5e1c040b45e59e472c7276c0a7411958e97845bf40de60a
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # fluent-plugin-github-activities
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-github-activities.svg)](https://badge.fury.io/rb/fluent-plugin-github-activities)
4
+ [![Build Status](https://travis-ci.org/clear-code/fluent-plugin-github-activities.svg?branch=master)](https://travis-ci.org/clear-code/fluent-plugin-github-activities)
5
+
3
6
  Provides ability to watch public activities on GitHub.
4
7
  This crawls GitHub activities of specified users and forward each activity as a record.
5
8
 
@@ -80,7 +83,7 @@ Then the value of the `token` field is the access key to be written to the confi
80
83
 
81
84
  ~~~
82
85
  <source>
83
- type github-activities
86
+ @type github-activities
84
87
 
85
88
  # Access token for this instance. See also the previous section.
86
89
  access_token access-token-for-this-instance
@@ -19,13 +19,13 @@
19
19
 
20
20
  Gem::Specification.new do |spec|
21
21
  spec.name = "fluent-plugin-github-activities"
22
- spec.version = "0.5.0"
22
+ spec.version = "0.6.0"
23
23
  spec.authors = ["YUKI Hiroshi"]
24
24
  spec.email = ["yuki@clear-code.com"]
25
25
  spec.summary = "Fluentd plugin to crawl public activities on the GitHub."
26
26
  spec.description = "This provides ability to crawl public " +
27
27
  "activities of users."
28
- spec.homepage = "https://github.com/groonga/fluent-plugin-groonga"
28
+ spec.homepage = "https://github.com/clear-code/fluent-plugin-github-activities"
29
29
  spec.license = "LGPL-3.0"
30
30
 
31
31
  spec.files = ["README.md", "Gemfile", "#{spec.name}.gemspec"]
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.test_files += Dir.glob("test/**/*")
34
34
  spec.require_paths = ["lib"]
35
35
 
36
- spec.add_runtime_dependency("fluentd")
36
+ spec.add_runtime_dependency("fluentd", [">= 0.12.0", "< 0.14.0"])
37
37
 
38
38
  spec.add_development_dependency("rake")
39
39
  spec.add_development_dependency("bundler")
@@ -214,7 +214,7 @@ module Fluent
214
214
  if push_event["org"]
215
215
  commit[RELATED_ORGANIZATION_IMAGE_KEY] = push_event["org"]["avatar_url"]
216
216
  end
217
- commit[RELATED_EVENT] = push_event
217
+ commit[RELATED_EVENT] = push_event.reject {|k, _| k == "payload" }
218
218
  emit("commit", commit)
219
219
  end
220
220
 
@@ -55,7 +55,7 @@ module Fluent
55
55
  options[:previous_entity_tag]
56
56
  request[:process_after] = time_to_process
57
57
  else
58
- request[:previous_entity_tag] = options[:previous_entity_tag]
58
+ request[:previous_entity_tag] = options[:previous_entity_tag] if options.key?(:previous_entity_tag)
59
59
  end
60
60
  request
61
61
  end
@@ -24,7 +24,7 @@ module Fluent
24
24
 
25
25
  Plugin.register_input("github-activities", self)
26
26
 
27
- config_param :access_token, :string, :default => nil
27
+ config_param :access_token, :string, :default => nil, :secret => true
28
28
  config_param :users, :string, :default => nil
29
29
  config_param :users_list, :string, :default => nil
30
30
  config_param :include_commits_from_pull_request, :bool, :default => false
@@ -74,7 +74,7 @@ module Fluent
74
74
  }
75
75
  crawler = ::Fluent::GithubActivities::Crawler.new(crawler_options)
76
76
  crawler.on_emit = lambda do |tag, record|
77
- Engine.emit("#{@base_tag}.#{tag}", Engine.now, record)
77
+ router.emit("#{@base_tag}.#{tag}", Engine.now, record)
78
78
  end
79
79
 
80
80
  loop do
data/test/test_crawler.rb CHANGED
@@ -44,6 +44,14 @@ class CrawlerTest < Test::Unit::TestCase
44
44
  end
45
45
 
46
46
  def fill_extra_fields(event, parent_event=nil)
47
+ if parent_event and parent_event["type"] == "PushEvent"
48
+ push_event = fill_extra_fields(parent_event)
49
+ push_event = push_event.reject {|k, _| k == "payload" }
50
+ event = event.merge(
51
+ "$github-activities-related-event" => push_event
52
+ )
53
+ end
54
+
47
55
  parent_event ||= event
48
56
 
49
57
  event = event.merge(
@@ -207,24 +215,24 @@ class CrawlerTest < Test::Unit::TestCase
207
215
  expected = {
208
216
  :request_queue => [
209
217
  { :type => ::Fluent::GithubActivities::TYPE_COMMIT,
210
- :uri => "#{base}/8e90721ff5d89f52b5b3adf0b86db01f03dc5588",
211
- :sha => "8e90721ff5d89f52b5b3adf0b86db01f03dc5588",
218
+ :uri => "#{base}/c908f319c7b6d5c5a69c8b675bde40dd990ee364",
219
+ :sha => "c908f319c7b6d5c5a69c8b675bde40dd990ee364",
212
220
  :push => expected_push },
213
221
  { :type => ::Fluent::GithubActivities::TYPE_COMMIT,
214
- :uri => "#{base}/63e085b7607a3043cfbf9a866561807fbdda8a10",
215
- :sha => "63e085b7607a3043cfbf9a866561807fbdda8a10",
222
+ :uri => "#{base}/8ce6de7582376187e17e233dbae13575311a8c0b",
223
+ :sha => "8ce6de7582376187e17e233dbae13575311a8c0b",
216
224
  :push => expected_push },
217
225
  { :type => ::Fluent::GithubActivities::TYPE_COMMIT,
218
226
  :uri => "#{base}/c85e33bace040b7b42983e14d2b11a491d102072",
219
227
  :sha => "c85e33bace040b7b42983e14d2b11a491d102072",
220
228
  :push => expected_push },
221
229
  { :type => ::Fluent::GithubActivities::TYPE_COMMIT,
222
- :uri => "#{base}/8ce6de7582376187e17e233dbae13575311a8c0b",
223
- :sha => "8ce6de7582376187e17e233dbae13575311a8c0b",
230
+ :uri => "#{base}/63e085b7607a3043cfbf9a866561807fbdda8a10",
231
+ :sha => "63e085b7607a3043cfbf9a866561807fbdda8a10",
224
232
  :push => expected_push },
225
233
  { :type => ::Fluent::GithubActivities::TYPE_COMMIT,
226
- :uri => "#{base}/c908f319c7b6d5c5a69c8b675bde40dd990ee364",
227
- :sha => "c908f319c7b6d5c5a69c8b675bde40dd990ee364",
234
+ :uri => "#{base}/8e90721ff5d89f52b5b3adf0b86db01f03dc5588",
235
+ :sha => "8e90721ff5d89f52b5b3adf0b86db01f03dc5588",
228
236
  :push => expected_push },
229
237
  ],
230
238
  :emitted_records => [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-github-activities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YUKI Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.12.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.14.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 0.12.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +131,7 @@ files:
125
131
  - test/fixture/push-event.json
126
132
  - test/run-test.rb
127
133
  - test/test_crawler.rb
128
- homepage: https://github.com/groonga/fluent-plugin-groonga
134
+ homepage: https://github.com/clear-code/fluent-plugin-github-activities
129
135
  licenses:
130
136
  - LGPL-3.0
131
137
  metadata: {}
@@ -145,25 +151,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
151
  version: '0'
146
152
  requirements: []
147
153
  rubyforge_project:
148
- rubygems_version: 2.4.1
154
+ rubygems_version: 2.6.8
149
155
  signing_key:
150
156
  specification_version: 4
151
157
  summary: Fluentd plugin to crawl public activities on the GitHub.
152
158
  test_files:
153
- - test/test_crawler.rb
154
- - test/fixture.rb
155
- - test/run-test.rb
159
+ - test/fixture/commit-comment-event.json
160
+ - test/fixture/pull-request-comment-event.json
156
161
  - test/fixture/pull-request-event.json
162
+ - test/fixture/line-note-event.json
163
+ - test/fixture/pull-request-accepted-event.json
164
+ - test/fixture/issue-comment-event.json
165
+ - test/fixture/commit.json
157
166
  - test/fixture/push-event-multiple-commits.json
167
+ - test/fixture/branch-event.json
158
168
  - test/fixture/push-event.json
159
- - test/fixture/issue-comment-event.json
160
169
  - test/fixture/fork-event.json
161
- - test/fixture/line-note-event.json
162
- - test/fixture/commit-comment-event.json
163
- - test/fixture/branch-event.json
164
- - test/fixture/accept-pull-request-event.json
165
170
  - test/fixture/issues-event.json
166
- - test/fixture/commit.json
167
- - test/fixture/pull-request-comment-event.json
168
- - test/fixture/pull-request-accepted-event.json
169
- has_rdoc:
171
+ - test/fixture/accept-pull-request-event.json
172
+ - test/run-test.rb
173
+ - test/fixture.rb
174
+ - test/test_crawler.rb