csv_to_gsheet 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/csv_to_gsheet.rb +18 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce47d3a095af158bf35b414a9abc65f7a02ee4ceb7a652ab6cd8eb5a6f9fb2a3
4
- data.tar.gz: b5af8f5a3f226b009871ed8df1231a230c9fda266d428a52ba1fce5c473b6c2b
3
+ metadata.gz: 44edc451f3006b6118fa8724f1db59ee411e98977df58a75d94d310fea1b3ba2
4
+ data.tar.gz: bbcdced331263be4d54faddf235e018dd0f93d092e7c53120df18340d47e2d6a
5
5
  SHA512:
6
- metadata.gz: 3cd1584fb50142befd852323df98b16d6b8114f9a00cbae65559372a86fef16144bb85b1cc08f7531e5568e8ab4e54d718cf8cd230dea2c8ddf27b691560671d
7
- data.tar.gz: 86790f096701d73221f677529197e455bde9e6e5c8626d4d9903f7a5e6bf8c92357a20823b4c173b8ef36ed665fdb7c90e628017eb5bdfacf796629d384de969
6
+ metadata.gz: 18577284c1ba5549bc7d343ca28b8767aa2bf25baeed83910bf988a8fe90363d4bccaaaccb078ff7f196ca7bfb90420b8ca2e97f291d8ee977452a98057caab4
7
+ data.tar.gz: 85a7bef5ad32a371b95968f583da94bc19d8f304b0b465832f16dd4e4026ea9f75bd93ebdfc68ce8dc926408357152002be024a191818b5935cc4b7258aee261
@@ -32,6 +32,11 @@ module CsvToGsheet
32
32
  # See https://stackoverflow.com/questions/2166862/why-is-gets-throwing-an-error-when-arguments-are-passed-to-my-ruby-script
33
33
  ARGV.clear
34
34
 
35
+ # Check files to see if they exist and if they don't then tell the user what to do
36
+ #
37
+ # This exits the program early if the credentials.json-equivalent file is not present.
38
+ CsvToGsheet.check_token_files
39
+
35
40
  # Initialize the API
36
41
  service = Google::Apis::SheetsV4::SheetsService.new
37
42
  service.client_options.application_name = APPLICATION_NAME
@@ -117,6 +122,19 @@ module CsvToGsheet
117
122
  end
118
123
  end
119
124
 
125
+ def self.check_token_files
126
+ if !File.exists? CREDENTIALS_PATH
127
+ puts "No credentials.json equivalent file for your OAuth2 app exists at #{CREDENTIALS_PATH}"
128
+ puts ""
129
+ puts "Download your credentials.json file from https://developers.google.com/identity/sign-in/web/sign-in"
130
+ puts ""
131
+ puts "Move that credentials.json file to #{CREDENTIALS_PATH}"
132
+ puts ""
133
+ puts "Exiting now without connecting to Google's API"
134
+ exit 1
135
+ end
136
+ end
137
+
120
138
  ##
121
139
  # Ensure valid credentials, either by restoring from the saved credentials
122
140
  # files or intitiating an OAuth2 authorization. If authorization is required,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_to_gsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Campbell