Skip to content

Commit

Permalink
Move get_required_env
Browse files Browse the repository at this point in the history
  • Loading branch information
spencertransier committed May 7, 2024
1 parent 68965e0 commit cb944ae
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ default_platform(:mac)
fastlane_require 'dotenv'
fastlane_require 'shellwords' # used for shell-escaping paths

# Use this instead of getting values from ENV directly
# It will throw an error if the requested value is missing
def get_required_env(key)
UI.user_error!("Environment variable '#{key}' is not set. Have you setup #{USER_ENV_FILE_PATH} correctly?") unless ENV.key?(key)
ENV.fetch(key)
end

# Constants
USER_ENV_FILE_PATH = File.join(Dir.home, '.simplenotemacos-env.default')
PROJECT_FOLDER = Pathname.new(File.join(Dir.pwd, '..')).expand_path.to_s
Expand Down Expand Up @@ -44,13 +51,6 @@ SKIP_CODE_SIGNING_XCARGS = {
CODE_SIGNING_REQUIRED: 'NO'
}.freeze

# Use this instead of getting values from ENV directly
# It will throw an error if the requested value is missing
def get_required_env(key)
UI.user_error!("Environment variable '#{key}' is not set. Have you setup #{USER_ENV_FILE_PATH} correctly?") unless ENV.key?(key)
ENV.fetch(key)
end

before_all do
# Ensure we use the latest version of the Release Toolkit
check_for_toolkit_updates unless is_ci || ENV['FASTLANE_SKIP_TOOLKIT_UPDATE_CHECK']
Expand Down

0 comments on commit cb944ae

Please sign in to comment.