google_spreadsheet_fetcher 1.9.1 → 2.0.1
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 +4 -4
- data/README.md +10 -9
- data/lib/google_spreadsheet_fetcher/authorizer/interface.rb +9 -0
- data/lib/google_spreadsheet_fetcher/authorizer/oauth2/authorizer.rb +51 -0
- data/lib/google_spreadsheet_fetcher/authorizer/oauth2/config.rb +28 -0
- data/lib/google_spreadsheet_fetcher/authorizer/oauth2/rack_application.rb +70 -0
- data/lib/google_spreadsheet_fetcher/authorizer/service_account.rb +27 -0
- data/lib/google_spreadsheet_fetcher/bulk_fetcher.rb +0 -3
- data/lib/google_spreadsheet_fetcher/config.rb +4 -1
- data/lib/google_spreadsheet_fetcher/fetcher.rb +0 -5
- data/lib/google_spreadsheet_fetcher/sheets_service_builder.rb +8 -26
- data/lib/google_spreadsheet_fetcher/version.rb +1 -1
- data/lib/google_spreadsheet_fetcher.rb +18 -10
- metadata +36 -13
- data/.github/workflows/main.yml +0 -40
- data/.github/workflows/release.yml +0 -33
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/google_spreadsheet_fetcher.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a18dded3ae272e466b1ef230e2b026bbef6dcbdc3504ede64efc98d6be084d84
|
4
|
+
data.tar.gz: 602af299a3764c525d76f0594023c8b84784f53993dbc651ff8605148ce47385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5513c2c32a6fdc869cf6d628d4ca4b6808c84b42107f25ba2dd765c3c173339216a71020fe4003d94c12ef3f117e9a1f702b546c0e2abe31f59402edb223ae80
|
7
|
+
data.tar.gz: 8bdeae4bc5fd457095957dcca62cc9bdf9aff6e36d689d817fd84bb2fa2e3752fa25aef17da3753511d44d8b16757d358b1cd127faa9eb9f840051be1ce90630
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# GoogleSpreadsheetFetcher
|
2
2
|
|
3
|
-
|
3
|
+
Provides access to Google spreadsheets
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,18 +20,11 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
- Make project. https://cloud.google.com/resource-manager/docs/creating-managing-projects
|
24
|
-
- Enable Google Drive API
|
25
|
-
- Make OAuth 2.0 Client. (other)
|
26
|
-
- Download client secret json
|
27
|
-
|
28
|
-
|
29
23
|
```ruby
|
30
24
|
sheet_key = 'example_sheet_id'
|
31
25
|
|
32
26
|
GoogleSpreadsheetFetcher.configure do |config|
|
33
|
-
|
34
|
-
config.credential_store_file = 'credential_store_file_path.json'
|
27
|
+
...
|
35
28
|
end
|
36
29
|
|
37
30
|
user_id = 'sample'
|
@@ -53,6 +46,14 @@ fetcher.all_rows_by!(title: 'sheet_title')
|
|
53
46
|
fetcher.all_rows_by!(sheet_id: 1234567890)
|
54
47
|
```
|
55
48
|
|
49
|
+
### Use Service Account
|
50
|
+
|
51
|
+
https://github.com/taka0125/google_spreadsheet_fetcher/wiki/Use-Service-Account
|
52
|
+
|
53
|
+
### Use OAuth2
|
54
|
+
|
55
|
+
https://github.com/taka0125/google_spreadsheet_fetcher/wiki/Use-OAuth2
|
56
|
+
|
56
57
|
## Development
|
57
58
|
|
58
59
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# https://github.com/googleapis/google-api-ruby-client/blob/main/docs/oauth-web.md
|
2
|
+
|
3
|
+
require 'googleauth'
|
4
|
+
require 'googleauth/web_user_authorizer'
|
5
|
+
require 'googleauth/stores/file_token_store'
|
6
|
+
|
7
|
+
module GoogleSpreadsheetFetcher
|
8
|
+
module Authorizer
|
9
|
+
module Oauth2
|
10
|
+
class Authorizer
|
11
|
+
include Interface
|
12
|
+
|
13
|
+
def initialize(config: nil, callback_uri: nil)
|
14
|
+
@config = config || ::GoogleSpreadsheetFetcher::Authorizer::Oauth2::Config.new
|
15
|
+
@callback_uri = callback_uri || ::GoogleSpreadsheetFetcher::Authorizer::Oauth2::RackApplication::CALLBACK_PATH
|
16
|
+
@web_user_authorizer = build_web_user_authorizer
|
17
|
+
|
18
|
+
freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
def fetch_credentials!(user_id: nil)
|
22
|
+
web_user_authorizer.get_credentials(user_id || config.user_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
def fetch_credentials
|
26
|
+
fetch_credentials!
|
27
|
+
rescue StandardError
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_authorization_url(rack_request)
|
32
|
+
web_user_authorizer.get_authorization_url(request: rack_request)
|
33
|
+
end
|
34
|
+
|
35
|
+
def handle_auth_callback(rack_request)
|
36
|
+
web_user_authorizer.handle_auth_callback(config.user_id, rack_request)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
attr_reader :config, :callback_uri, :web_user_authorizer
|
42
|
+
|
43
|
+
def build_web_user_authorizer
|
44
|
+
::Google::Auth::WebUserAuthorizer.new(
|
45
|
+
config.client_id, ::GoogleSpreadsheetFetcher.config.scopes, config.token_store, callback_uri
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GoogleSpreadsheetFetcher
|
2
|
+
module Authorizer
|
3
|
+
module Oauth2
|
4
|
+
class Config
|
5
|
+
attr_reader :client_secrets_json_path, :user_id, :token_store, :client_id
|
6
|
+
|
7
|
+
def initialize(client_secrets_json_path: nil, user_id: nil, token_store: nil)
|
8
|
+
@client_secrets_json_path = client_secrets_json_path || ::GoogleSpreadsheetFetcher.config.client_secrets_file
|
9
|
+
@user_id = user_id || ::GoogleSpreadsheetFetcher.config.user_id
|
10
|
+
@token_store = token_store || default_token_store
|
11
|
+
@client_id = ::Google::Auth::ClientId.from_file(self.client_secrets_json_path)
|
12
|
+
|
13
|
+
freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def default_token_store
|
19
|
+
store = ::GoogleSpreadsheetFetcher.config.token_store
|
20
|
+
return store if store.present?
|
21
|
+
|
22
|
+
file = ::GoogleSpreadsheetFetcher.config.credential_store_file
|
23
|
+
::Google::Auth::Stores::FileTokenStore.new(file: file)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module GoogleSpreadsheetFetcher
|
4
|
+
module Authorizer
|
5
|
+
module Oauth2
|
6
|
+
class RackApplication
|
7
|
+
AUTHORIZE_PATH = '/authorize'.freeze
|
8
|
+
CALLBACK_PATH = '/oauth2callback'.freeze
|
9
|
+
|
10
|
+
def initialize(config: nil)
|
11
|
+
@config = config || ::GoogleSpreadsheetFetcher::Authorizer::Oauth2::Config.new
|
12
|
+
@authorizer = ::GoogleSpreadsheetFetcher::Authorizer::Oauth2::Authorizer.new(config: config)
|
13
|
+
|
14
|
+
freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
path = env['PATH_INFO']
|
19
|
+
request_method = env['REQUEST_METHOD']
|
20
|
+
|
21
|
+
return handle_authorize(env) if path == AUTHORIZE_PATH && request_method == 'GET'
|
22
|
+
return handle_callback(env) if path == CALLBACK_PATH && request_method == 'GET'
|
23
|
+
|
24
|
+
plain_response(400, 'invalid access')
|
25
|
+
end
|
26
|
+
|
27
|
+
def cookie_settings(secret: nil)
|
28
|
+
{
|
29
|
+
domain: 'localhost',
|
30
|
+
path: '/',
|
31
|
+
expire_after: 3600*24,
|
32
|
+
secret: secret || SecureRandom.uuid
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :config, :authorizer
|
39
|
+
|
40
|
+
def handle_authorize(env)
|
41
|
+
request = ::Rack::Request.new(env)
|
42
|
+
|
43
|
+
credentials = authorizer.fetch_credentials
|
44
|
+
if credentials.nil?
|
45
|
+
redirect_url = authorizer.get_authorization_url(request)
|
46
|
+
|
47
|
+
return redirect_response(redirect_url)
|
48
|
+
end
|
49
|
+
|
50
|
+
plain_response(200, 'authorized')
|
51
|
+
end
|
52
|
+
|
53
|
+
def handle_callback(env)
|
54
|
+
request = ::Rack::Request.new(env)
|
55
|
+
authorizer.handle_auth_callback(request)
|
56
|
+
|
57
|
+
plain_response(200, 'token stored')
|
58
|
+
end
|
59
|
+
|
60
|
+
def redirect_response(url)
|
61
|
+
[302, {'location' => url}, []]
|
62
|
+
end
|
63
|
+
|
64
|
+
def plain_response(status, text)
|
65
|
+
[status, {'content-type' => 'text/plain'}, [text]]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GoogleSpreadsheetFetcher
|
2
|
+
module Authorizer
|
3
|
+
class ServiceAccount
|
4
|
+
include Interface
|
5
|
+
|
6
|
+
def initialize(credential, scope: nil)
|
7
|
+
@credential = credential
|
8
|
+
@scope = scope || ::GoogleSpreadsheetFetcher.config.scopes
|
9
|
+
|
10
|
+
freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup!; end
|
14
|
+
|
15
|
+
def fetch_credentials!(user_id: nil)
|
16
|
+
::Google::Auth::ServiceAccountCredentials.make_creds(
|
17
|
+
json_key_io: StringIO.new(credential),
|
18
|
+
scope: scope
|
19
|
+
).tap(&:fetch_access_token!)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :credential, :scope
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -4,14 +4,17 @@ module GoogleSpreadsheetFetcher
|
|
4
4
|
class Config
|
5
5
|
include ActiveSupport::Configurable
|
6
6
|
|
7
|
+
config_accessor :authorizer
|
8
|
+
|
7
9
|
config_accessor :client_secrets_file
|
8
10
|
config_accessor :credential_store_file # required if token_store not set
|
9
11
|
config_accessor :token_store # required if credential_store_file not set
|
10
12
|
config_accessor :scopes
|
13
|
+
config_accessor :user_id
|
11
14
|
|
12
15
|
def self.default_config
|
13
16
|
new.tap do |config|
|
14
|
-
config.scopes = [Google::Apis::SheetsV4::AUTH_SPREADSHEETS_READONLY]
|
17
|
+
config.scopes = [::Google::Apis::SheetsV4::AUTH_SPREADSHEETS_READONLY]
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
@@ -1,10 +1,5 @@
|
|
1
|
-
require 'google/apis/sheets_v4'
|
2
|
-
require 'shellwords'
|
3
|
-
|
4
1
|
module GoogleSpreadsheetFetcher
|
5
2
|
class Fetcher
|
6
|
-
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
|
7
|
-
|
8
3
|
# @param [String] spreadsheet_id
|
9
4
|
# @param [String] user_id
|
10
5
|
# @param [GoogleSpreadsheetFetcher::Config] config
|
@@ -1,12 +1,5 @@
|
|
1
|
-
require 'google/apis/sheets_v4'
|
2
|
-
require 'googleauth'
|
3
|
-
require 'googleauth/stores/file_token_store'
|
4
|
-
require 'shellwords'
|
5
|
-
|
6
1
|
module GoogleSpreadsheetFetcher
|
7
2
|
class SheetsServiceBuilder
|
8
|
-
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
|
9
|
-
|
10
3
|
# @param [String] user_id
|
11
4
|
# @param [GoogleSpreadsheetFetcher::Config] config
|
12
5
|
# @param [String] application_name
|
@@ -14,31 +7,20 @@ module GoogleSpreadsheetFetcher
|
|
14
7
|
@user_id = user_id
|
15
8
|
@config = config || GoogleSpreadsheetFetcher.config
|
16
9
|
@application_name = application_name
|
17
|
-
@token_store = @config.token_store || Google::Auth::Stores::FileTokenStore.new(file: @config.credential_store_file)
|
18
10
|
end
|
19
11
|
|
20
|
-
def build
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
def build(authorizer: nil)
|
13
|
+
authorizer = authorizer || config.authorizer || ::GoogleSpreadsheetFetcher::Authorizer::Oauth2::Authorizer.new
|
14
|
+
raise 'Authorizer is not configured' if authorizer.blank?
|
15
|
+
|
16
|
+
::Google::Apis::SheetsV4::SheetsService.new.tap do |service|
|
17
|
+
service.authorization = authorizer.fetch_credentials!(user_id: user_id)
|
18
|
+
service.client_options.application_name = application_name if application_name.present?
|
24
19
|
end
|
25
20
|
end
|
26
21
|
|
27
22
|
private
|
28
23
|
|
29
|
-
|
30
|
-
client_id = Google::Auth::ClientId.from_file(@config.client_secrets_file)
|
31
|
-
authorizer = Google::Auth::UserAuthorizer.new(client_id, @config.scopes, @token_store)
|
32
|
-
|
33
|
-
credentials = authorizer.get_credentials(@user_id)
|
34
|
-
return credentials if credentials.present?
|
35
|
-
|
36
|
-
url = authorizer.get_authorization_url(base_url: OOB_URI)
|
37
|
-
escaped_url = url.shellescape
|
38
|
-
system("open #{escaped_url}")
|
39
|
-
puts "Open #{url} in your browser and enter the resulting code: "
|
40
|
-
code = STDIN.gets
|
41
|
-
authorizer.get_and_store_credentials_from_code(user_id: @user_id, code: code, base_url: OOB_URI)
|
42
|
-
end
|
24
|
+
attr_reader :user_id, :config, :application_name
|
43
25
|
end
|
44
26
|
end
|
@@ -1,13 +1,21 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/json'
|
3
|
+
require 'active_support/core_ext'
|
4
|
+
require 'googleauth'
|
5
|
+
require 'google/apis/sheets_v4'
|
6
|
+
|
7
|
+
require 'google_spreadsheet_fetcher/version'
|
8
|
+
require 'google_spreadsheet_fetcher/config'
|
9
|
+
require 'google_spreadsheet_fetcher/error'
|
10
|
+
require 'google_spreadsheet_fetcher/authorizer/interface'
|
11
|
+
require 'google_spreadsheet_fetcher/authorizer/service_account'
|
12
|
+
require 'google_spreadsheet_fetcher/authorizer/oauth2/config'
|
13
|
+
require 'google_spreadsheet_fetcher/authorizer/oauth2/rack_application'
|
14
|
+
require 'google_spreadsheet_fetcher/authorizer/oauth2/authorizer'
|
15
|
+
require 'google_spreadsheet_fetcher/fetcher'
|
16
|
+
require 'google_spreadsheet_fetcher/sheet_url'
|
17
|
+
require 'google_spreadsheet_fetcher/bulk_fetcher'
|
18
|
+
require 'google_spreadsheet_fetcher/sheets_service_builder'
|
11
19
|
|
12
20
|
module GoogleSpreadsheetFetcher
|
13
21
|
def self.config
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_spreadsheet_fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rack
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "<"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "<"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: google-api-client
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,6 +39,20 @@ dependencies:
|
|
25
39
|
- - "~>"
|
26
40
|
- !ruby/object:Gem::Version
|
27
41
|
version: '0.9'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: googleauth
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
28
56
|
- !ruby/object:Gem::Dependency
|
29
57
|
name: activesupport
|
30
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,19 +117,14 @@ executables: []
|
|
89
117
|
extensions: []
|
90
118
|
extra_rdoc_files: []
|
91
119
|
files:
|
92
|
-
- ".github/workflows/main.yml"
|
93
|
-
- ".github/workflows/release.yml"
|
94
|
-
- ".gitignore"
|
95
|
-
- ".rspec"
|
96
|
-
- ".travis.yml"
|
97
|
-
- Gemfile
|
98
120
|
- LICENSE
|
99
121
|
- README.md
|
100
|
-
- Rakefile
|
101
|
-
- bin/console
|
102
|
-
- bin/setup
|
103
|
-
- google_spreadsheet_fetcher.gemspec
|
104
122
|
- lib/google_spreadsheet_fetcher.rb
|
123
|
+
- lib/google_spreadsheet_fetcher/authorizer/interface.rb
|
124
|
+
- lib/google_spreadsheet_fetcher/authorizer/oauth2/authorizer.rb
|
125
|
+
- lib/google_spreadsheet_fetcher/authorizer/oauth2/config.rb
|
126
|
+
- lib/google_spreadsheet_fetcher/authorizer/oauth2/rack_application.rb
|
127
|
+
- lib/google_spreadsheet_fetcher/authorizer/service_account.rb
|
105
128
|
- lib/google_spreadsheet_fetcher/bulk_fetcher.rb
|
106
129
|
- lib/google_spreadsheet_fetcher/config.rb
|
107
130
|
- lib/google_spreadsheet_fetcher/error.rb
|
@@ -128,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
151
|
- !ruby/object:Gem::Version
|
129
152
|
version: '0'
|
130
153
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.4.10
|
132
155
|
signing_key:
|
133
156
|
specification_version: 4
|
134
157
|
summary: Google Spreadsheet fetcher
|
data/.github/workflows/main.yml
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
name: rspec
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
|
8
|
-
pull_request:
|
9
|
-
branches:
|
10
|
-
- main
|
11
|
-
|
12
|
-
env:
|
13
|
-
RAILS_ENV: test
|
14
|
-
|
15
|
-
jobs:
|
16
|
-
test:
|
17
|
-
runs-on: ubuntu-latest
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
|
21
|
-
matrix:
|
22
|
-
ruby:
|
23
|
-
- 2.6
|
24
|
-
- 2.7
|
25
|
-
- 3.0
|
26
|
-
- 3.1
|
27
|
-
|
28
|
-
steps:
|
29
|
-
- uses: actions/checkout@v2
|
30
|
-
|
31
|
-
- name: Set up Ruby
|
32
|
-
uses: ruby/setup-ruby@v1
|
33
|
-
with:
|
34
|
-
ruby-version: ${{ matrix.ruby }}
|
35
|
-
bundler-cache: true
|
36
|
-
|
37
|
-
- name: Run tests
|
38
|
-
run: |
|
39
|
-
bundle exec rspec
|
40
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
name: Release gem
|
2
|
-
|
3
|
-
on:
|
4
|
-
workflow_dispatch:
|
5
|
-
inputs:
|
6
|
-
rubygems-otp-code:
|
7
|
-
description: RubyGems OTP code
|
8
|
-
required: true
|
9
|
-
|
10
|
-
permissions:
|
11
|
-
contents: write
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
release-gem:
|
15
|
-
runs-on: ubuntu-latest
|
16
|
-
env:
|
17
|
-
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
18
|
-
GEM_HOST_OTP_CODE: ${{ github.event.inputs.rubygems-otp-code }}
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@v2
|
21
|
-
with:
|
22
|
-
fetch-depth: 0 # bundle exec rake release で git tag を見るため、tagをfetchするようにしている
|
23
|
-
- uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: 3.1.1
|
26
|
-
- name: Bundle install
|
27
|
-
run: bundle install
|
28
|
-
- name: Setup git config # bundle exec rake release でgit tagが打たれていない場合、タグを打ってpushしてくれるため用意している
|
29
|
-
run: |
|
30
|
-
git config --global user.email "taka0125@gmail.com"
|
31
|
-
git config --global user.name "Takahiro Ooishi"
|
32
|
-
- name: Release gem
|
33
|
-
run: bundle exec rake release
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "google_spreadsheet_fetcher"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'google_spreadsheet_fetcher/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "google_spreadsheet_fetcher"
|
8
|
-
spec.version = GoogleSpreadsheetFetcher::VERSION
|
9
|
-
spec.authors = ["Takahiro Ooishi", "Yuya Yokosuka"]
|
10
|
-
spec.email = ["taka0125@gmail.com", "yuya.yokosuka@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Google Spreadsheet fetcher}
|
13
|
-
spec.description = %q{Google Spreadsheet fetcher}
|
14
|
-
spec.homepage = "https://github.com/taka0125/google_spreadsheet_fetcher"
|
15
|
-
spec.licenses = ['MIT']
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(test|spec|features)/})
|
19
|
-
end
|
20
|
-
spec.bindir = "exe"
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.required_ruby_version = '>= 2.3.0'
|
25
|
-
|
26
|
-
spec.add_dependency 'google-api-client', '~> 0.9'
|
27
|
-
spec.add_dependency 'activesupport'
|
28
|
-
|
29
|
-
spec.add_development_dependency "bundler"
|
30
|
-
spec.add_development_dependency "rake"
|
31
|
-
spec.add_development_dependency "rspec"
|
32
|
-
end
|