Skip to content

Commit

Permalink
Improve Fastfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Jul 12, 2023
1 parent 9aa6006 commit f36092e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ lane :config_nightly do
data["settings"]["BASE_APP_GROUP_IDENTIFIER"] = "io.element.nightly"
data["settings"]["BASE_BUNDLE_IDENTIFIER"] = "io.element.elementx.nightly"

api_key = ENV["MAP_LIBRE_API_KEY"]
UI.user_error!("Invalid Map Libre API key.") unless !api_key.to_s.empty?
data["settings"]["MAPLIBRE_API_KEY"] = api_key
config_maplibre(yaml: data)

File.open(target_file_path, 'w') { |f| YAML.dump(data, f) }

Expand All @@ -191,9 +189,7 @@ lane :config_production do
target_file_path = "../project.yml"
data = YAML.load_file target_file_path

api_key = ENV["MAP_LIBRE_API_KEY"]
UI.user_error!("Invalid Map Libre API key.") unless !api_key.to_s.empty?
data["settings"]["MAPLIBRE_API_KEY"] = api_key
config_maplibre(yaml: data)

File.open(target_file_path, 'w') { |f| YAML.dump(data, f) }
xcodegen(spec: "project.yml")
Expand Down Expand Up @@ -415,5 +411,11 @@ private_lane :create_simulator_if_necessary do |options|
rescue
sh("xcrun simctl create '#{simulator_name}' #{simulator_type}")
end
end

private_lane :config_maplibre do |options|
yaml = options[:yaml]
api_key = ENV["MAPLIBRE_API_KEY"]
UI.user_error!("Invalid Map Libre API key.") unless !api_key.to_s.empty?
yaml["settings"]["MAPLIBRE_API_KEY"] = api_key
end

0 comments on commit f36092e

Please sign in to comment.