Class: GoogleDriveDotenv::App
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- GoogleDriveDotenv::App
- Defined in:
- lib/google_drive_dotenv/cli.rb
Class Attribute Summary collapse
-
.credentials ⇒ Object
Returns the value of attribute credentials.
-
.key ⇒ Object
Returns the value of attribute key.
-
.output ⇒ Object
Returns the value of attribute output.
Class Method Summary collapse
Class Attribute Details
.credentials ⇒ Object
Returns the value of attribute credentials.
12 13 14 |
# File 'lib/google_drive_dotenv/cli.rb', line 12 def credentials @credentials end |
.key ⇒ Object
Returns the value of attribute key.
12 13 14 |
# File 'lib/google_drive_dotenv/cli.rb', line 12 def key @key end |
.output ⇒ Object
Returns the value of attribute output.
12 13 14 |
# File 'lib/google_drive_dotenv/cli.rb', line 12 def output @output end |
Class Method Details
.export_env(authorization_code) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/google_drive_dotenv/cli.rb', line 14 def export_env() credentials.code = credentials.fetch_access_token! session = GoogleDrive::Session.from_credentials(credentials) sheet = session.spreadsheet_by_key(key).worksheets[0] File.open(output, 'wb') do |file| (1..sheet.num_rows).each do |row| key = sheet[row, 1] value = sheet[row, 2] file.puts([key, value].join('=')) end end end |