fluent-plugin-google-sheets 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.devcontainer/Dockerfile +22 -0
- data/.devcontainer/app.env.example +1 -0
- data/.devcontainer/devcontainer.json +7 -0
- data/.devcontainer/docker-compose.yml +9 -0
- data/.github/workflows/publish.yml +18 -0
- data/.github/workflows/test.yml +21 -0
- data/.gitignore +3 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +12 -2
- data/example/fluent.conf +12 -0
- data/fluent-plugin-google-sheets.gemspec +5 -6
- data/lib/fluent/plugin/out_google_sheets.rb +3 -2
- metadata +21 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4a0fa0f2d4fdd1e1bb837b5c4d578f0b07fe021e483f08b080b17abaa09873bf
|
4
|
+
data.tar.gz: db68189ec58ebc6bf68b564bc2560a1c9e0ef79a86e27f44577b78ae4b38d16d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3d3550075023c2c58c869fafa12eaec1ffa7af4332cf8edbff8a2f413d7ffd2127bdd66a6b5b735040bf4b31aef174a6c2594a12503d86207c9efa94ae7a4d3
|
7
|
+
data.tar.gz: 9e9bb60b085e3b1c2d9622343d792e6fca728e42b1390d9b2a4a1a41f0c9f48790d72bae80bd90ad9b15f0f199e5ffbb956fd5d4b96ea65c80bca8331041a0e3
|
@@ -0,0 +1,22 @@
|
|
1
|
+
FROM ruby:3.0.0
|
2
|
+
|
3
|
+
ARG USERNAME=app
|
4
|
+
ARG USER_UID=1000
|
5
|
+
ARG USER_GID=$USER_UID
|
6
|
+
|
7
|
+
RUN groupadd --gid $USER_GID $USERNAME \
|
8
|
+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
9
|
+
&& apt-get update \
|
10
|
+
&& apt-get install -y sudo \
|
11
|
+
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
|
12
|
+
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
13
|
+
|
14
|
+
ENV BUNDLE_PATH=/app/vendor/bundle
|
15
|
+
RUN mkdir -p /app $BUNDLE_PATH
|
16
|
+
RUN chown -R $USERNAME /app $BUNDLE_PATH
|
17
|
+
|
18
|
+
ENV SHELL=/bin/bash
|
19
|
+
|
20
|
+
USER $USERNAME
|
21
|
+
|
22
|
+
WORKDIR /app
|
@@ -0,0 +1 @@
|
|
1
|
+
SPREADSHEET_ID=xxxxxxxxx
|
@@ -0,0 +1,18 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
tags:
|
4
|
+
- 'v*'
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
publish:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: '3.0'
|
14
|
+
bundler-cache: true
|
15
|
+
- run: gem update --system
|
16
|
+
- run: bundle exec rake release
|
17
|
+
env:
|
18
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
branches:
|
4
|
+
- main
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
14
|
+
ruby: [2.5, 2.6, 2.7, '3.0']
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Fumiaki MATSUSHIMA
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -26,9 +26,20 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
credential_file_path path_to_your_service_account_credential
|
28
28
|
spreadsheet_id your_spreadsheet_id
|
29
|
+
keys foo,bar # optional
|
30
|
+
add_timestamp_column false # optional, true by default
|
29
31
|
</match>
|
30
32
|
```
|
31
33
|
|
34
|
+
### Note
|
35
|
+
|
36
|
+
1. Be sure to enable Drive API and Google Sheets API
|
37
|
+
|
38
|
+
- https://console.cloud.google.com/apis/library/drive.googleapis.com
|
39
|
+
- https://console.cloud.google.com/apis/library/sheets.googleapis.com
|
40
|
+
|
41
|
+
2. Be sure to share the spreadsheet with the service account
|
42
|
+
|
32
43
|
## Development
|
33
44
|
|
34
45
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -37,5 +48,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
37
48
|
|
38
49
|
## Contributing
|
39
50
|
|
40
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
41
|
-
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mtsmfm/fluent-plugin-google-sheets.
|
data/example/fluent.conf
ADDED
@@ -4,15 +4,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-google-sheets"
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.2.0'
|
8
8
|
spec.authors = ["Fumiaki MATSUSHIMA"]
|
9
9
|
spec.email = ["mtsmfm@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = %q{Fluentd output plugin to store data on Google Sheets.}
|
12
12
|
spec.description = spec.summary
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/mtsmfm/fluent-plugin-google-sheets"
|
14
14
|
|
15
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|vcr_cassettes)/}) }
|
16
16
|
spec.bindir = "exe"
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ["lib"]
|
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "fluentd"
|
21
21
|
spec.add_dependency "google_drive"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "
|
24
|
-
spec.add_development_dependency "rake", "
|
25
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
23
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
24
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
26
25
|
end
|
@@ -10,6 +10,7 @@ module Fluent
|
|
10
10
|
config_param :keys, default: [] do |val|
|
11
11
|
val.split(',')
|
12
12
|
end
|
13
|
+
config_param :add_timestamp_column, :bool, default: true
|
13
14
|
|
14
15
|
def format(tag, time, record)
|
15
16
|
[tag, Time.at(time).strftime('%F %T'), record].to_json + "\n"
|
@@ -20,7 +21,7 @@ module Fluent
|
|
20
21
|
|
21
22
|
data.each do |tag, xs|
|
22
23
|
ws = worksheet(tag)
|
23
|
-
ws.insert_rows(ws.num_rows + 1, xs.map {|_, time, record| [time] + record.values })
|
24
|
+
ws.insert_rows(ws.num_rows + 1, xs.map {|_, time, record| (@add_timestamp_column ? [time] : []) + record.values })
|
24
25
|
ws.save
|
25
26
|
end
|
26
27
|
end
|
@@ -28,7 +29,7 @@ module Fluent
|
|
28
29
|
private
|
29
30
|
|
30
31
|
def headers
|
31
|
-
%w(timestamp) + @keys
|
32
|
+
(@add_timestamp_column ? %w(timestamp) : %w()) + @keys
|
32
33
|
end
|
33
34
|
|
34
35
|
def worksheet(tag)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-google-sheets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumiaki MATSUSHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -42,44 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 12.3.3
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 12.3.3
|
83
69
|
description: Fluentd output plugin to store data on Google Sheets.
|
84
70
|
email:
|
85
71
|
- mtsmfm@gmail.com
|
@@ -87,16 +73,25 @@ executables: []
|
|
87
73
|
extensions: []
|
88
74
|
extra_rdoc_files: []
|
89
75
|
files:
|
76
|
+
- ".devcontainer/Dockerfile"
|
77
|
+
- ".devcontainer/app.env.example"
|
78
|
+
- ".devcontainer/devcontainer.json"
|
79
|
+
- ".devcontainer/docker-compose.yml"
|
80
|
+
- ".github/workflows/publish.yml"
|
81
|
+
- ".github/workflows/test.yml"
|
90
82
|
- ".gitignore"
|
91
83
|
- ".travis.yml"
|
84
|
+
- CHANGELOG.md
|
92
85
|
- Gemfile
|
86
|
+
- LICENSE.txt
|
93
87
|
- README.md
|
94
88
|
- Rakefile
|
95
89
|
- bin/console
|
96
90
|
- bin/setup
|
91
|
+
- example/fluent.conf
|
97
92
|
- fluent-plugin-google-sheets.gemspec
|
98
93
|
- lib/fluent/plugin/out_google_sheets.rb
|
99
|
-
homepage: https://github.com/
|
94
|
+
homepage: https://github.com/mtsmfm/fluent-plugin-google-sheets
|
100
95
|
licenses: []
|
101
96
|
metadata: {}
|
102
97
|
post_install_message:
|
@@ -114,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
109
|
- !ruby/object:Gem::Version
|
115
110
|
version: '0'
|
116
111
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.5.1
|
112
|
+
rubygems_version: 3.2.16
|
119
113
|
signing_key:
|
120
114
|
specification_version: 4
|
121
115
|
summary: Fluentd output plugin to store data on Google Sheets.
|