-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactoring environment vars check and adding to gem * Logging changes for next release
- Loading branch information
Showing
8 changed files
with
85 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## [0.1.0] - 2024-10-13 | ||
|
||
- Initial release v0.1.0 | ||
|
||
## [0.2.0] - UNRELEASED | ||
|
||
- Added check for required environment variables before call to Google Sheets API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
sheet_zoukas (0.1.0) | ||
sheet_zoukas (0.2.0) | ||
google-apis-sheets_v4 | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module SheetZoukas | ||
# Utility methods | ||
class Utils | ||
def self.vars_present?(required_vars, message) | ||
all_present = true | ||
required_vars.each do |var| | ||
if ENV.fetch(var, '').strip.empty? | ||
all_present = false | ||
puts "⛔️ #{var} #{message}." | ||
end | ||
end | ||
all_present | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module SheetZoukas | ||
VERSION = '0.1.0' | ||
VERSION = '0.2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable RSpec/MultipleExpectations | ||
|
||
require 'spec_helper' | ||
require 'sheet_zoukas/utils' | ||
|
||
RSpec.describe SheetZoukas::Utils do | ||
describe '.vars_present?' do | ||
before { ENV.store('PRESENT_VAR', 'present') } | ||
|
||
it 'returns false when missing vars' do | ||
expect do | ||
expect(described_class).not_to be_vars_present(%w[MISSING_VAR PRESENT_VAR], 'is missing') | ||
end.to output("⛔️ MISSING_VAR is missing.\n").to_stdout | ||
end | ||
|
||
it 'returns true when no missing vars' do | ||
expect do | ||
expect(described_class).to be_vars_present(%w[PRESENT_VAR], 'is missing') | ||
end.not_to output.to_stdout | ||
end | ||
|
||
it 'returns false when variable empty string' do | ||
ENV.store('EMPTY_VAR', '') | ||
|
||
expect do | ||
expect(described_class).not_to be_vars_present(%w[PRESENT_VAR EMPTY_VAR], 'is missing') | ||
end.to output("⛔️ EMPTY_VAR is missing.\n").to_stdout | ||
end | ||
|
||
it 'returns false when variable blank string' do | ||
ENV.store('EMPTY_VAR', ' ') | ||
|
||
expect do | ||
expect(described_class).not_to be_vars_present(%w[PRESENT_VAR EMPTY_VAR], 'is missing') | ||
end.to output("⛔️ EMPTY_VAR is missing.\n").to_stdout | ||
end | ||
end | ||
end | ||
|
||
# rubocop:enable RSpec/MultipleExpectations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters