fluent-plugin-github-activities 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -5
- data/fluent-plugin-github-activities.gemspec +3 -2
- data/lib/fluent/plugin/github-activities.rb +5 -3
- data/lib/fluent/plugin/github-activities/crawler.rb +260 -249
- data/lib/fluent/plugin/github-activities/users_manager.rb +45 -65
- data/lib/fluent/plugin/in_github-activities.rb +96 -78
- data/test/fixture/piroor-events.json +47 -0
- data/test/fixture/users.txt +2 -0
- data/test/plugin/test_in_github_activity.rb +85 -0
- data/test/run-test.rb +1 -0
- data/test/test_crawler.rb +132 -109
- metadata +26 -7
- data/lib/fluent/plugin/github-activities/safe_file_writer.rb +0 -46
@@ -1,46 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# This file is part of fluent-plugin-github-activities.
|
4
|
-
#
|
5
|
-
# fluent-plugin-github-activities is free software: you can
|
6
|
-
# redistribute it and/or modify it under the terms of the GNU Lesser
|
7
|
-
# General Public License as published by the Free Software
|
8
|
-
# Foundation, either version 3 of the License, or (at your option)
|
9
|
-
# any later version.
|
10
|
-
#
|
11
|
-
# fluent-plugin-github-activities is distributed in the hope that
|
12
|
-
# it will be useful, but WITHOUT ANY WARRANTY; without even the
|
13
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
14
|
-
# PURPOSE. See the GNU Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with fluent-plugin-github-activities. If not, see
|
18
|
-
# <http://www.gnu.org/licenses/>.
|
19
|
-
|
20
|
-
require "pathname"
|
21
|
-
require "fileutils"
|
22
|
-
require "tempfile"
|
23
|
-
|
24
|
-
module Fluent
|
25
|
-
module GithubActivities
|
26
|
-
class SafeFileWriter
|
27
|
-
class << self
|
28
|
-
def write(path, contents=nil)
|
29
|
-
# Don't output the file directly to prevent loading of incomplete file!
|
30
|
-
path = Pathname(path).expand_path
|
31
|
-
FileUtils.mkdir_p(path.dirname.to_s)
|
32
|
-
Tempfile.open(path.basename.to_s, path.dirname.to_s) do |output|
|
33
|
-
if block_given?
|
34
|
-
yield(output, output.path)
|
35
|
-
else
|
36
|
-
output.write(contents)
|
37
|
-
end
|
38
|
-
output.flush
|
39
|
-
File.rename(output.path, path.to_s)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|