fluent-plugin-google-sheets 0.1.0 → 0.2.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
- SHA1:
3
- metadata.gz: 688f1cdc00554c3aa687502b679381e5f2e8237c
4
- data.tar.gz: 24e23c085c4e78f13cb64a92b4f018f20d5d0e22
2
+ SHA256:
3
+ metadata.gz: 4a0fa0f2d4fdd1e1bb837b5c4d578f0b07fe021e483f08b080b17abaa09873bf
4
+ data.tar.gz: db68189ec58ebc6bf68b564bc2560a1c9e0ef79a86e27f44577b78ae4b38d16d
5
5
  SHA512:
6
- metadata.gz: aa1c47142c4388646fb31ce002be9184c6946ab2ceb6dfe902fed41927f6dd7253dfe68c2841c6ae8589c45cb4fcc7482d93a5a339f8b155c250740d35616c9a
7
- data.tar.gz: 338da024298632daeadfee3f58b6c686abdca9469ee912972f85c0d4f92efb557b0314ade569f5149d483bd7d4cf27b8454b720939f2d29ac6be5460f6e8b97c
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,7 @@
1
+ {
2
+ "dockerComposeFile": "./docker-compose.yml",
3
+ "service": "app",
4
+ "workspaceFolder": "/app",
5
+ "name": "${localWorkspaceFolderBasename}",
6
+ "initializeCommand": "cp -n .devcontainer/app.env.example .devcontainer/app.env"
7
+ }
@@ -0,0 +1,9 @@
1
+ version: "3.8"
2
+ services:
3
+ app:
4
+ init: true
5
+ build:
6
+ context: .
7
+ command: sleep infinity
8
+ volumes:
9
+ - ..:/app:cached
@@ -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
@@ -7,3 +7,6 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
11
+ service-account-file.json
12
+ *.env
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change log
2
+
3
+ ## 0.2.0
4
+
5
+ - Release under MIT license (previously no license)
6
+ - Add add_timestamp_column option (#1)
7
+
8
+ ## 0.1.0
9
+
10
+ - First release
data/Gemfile CHANGED
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in fluent-plugin-google-sheets.gemspec
4
4
  gemspec
5
+
6
+ gem 'pry-byebug'
7
+ gem 'test-unit'
8
+ gem 'vcr'
9
+ gem 'webmock'
10
+ gem 'warning'
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/[USERNAME]/fluent-plugin-google-sheets.
41
-
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mtsmfm/fluent-plugin-google-sheets.
@@ -0,0 +1,12 @@
1
+ <source>
2
+ @type forward
3
+ @id forward_input
4
+ </source>
5
+
6
+ <match example>
7
+ @type google_sheets
8
+
9
+ credential_file_path service-account-file.json
10
+ spreadsheet_id "#{ENV['SPREADSHEET_ID']}"
11
+ keys foo
12
+ </match>
@@ -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.1.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/esminc/fluent-plugin-google-sheets"
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", "~> 1.12"
24
- spec.add_development_dependency "rake", "~> 10.0"
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.1.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: 2016-09-05 00:00:00.000000000 Z
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: '1.12'
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: '1.12'
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: '5.0'
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: '5.0'
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/esminc/fluent-plugin-google-sheets
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
- rubyforge_project:
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.