Skip to content

Instantly share code, notes, and snippets.

@mortenholmgaard
Last active March 20, 2023 20:56
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenholmgaard/493572893b1e75da54633e9cc52b881c to your computer and use it in GitHub Desktop.
Save mortenholmgaard/493572893b1e75da54633e9cc52b881c to your computer and use it in GitHub Desktop.
Fastlane Android app environment setup on Windows
source "https://rubygems.org"
ruby ">= 2.6.0"
gem "fastlane", ">= 2.126.0"
gem "git"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
#Requires -RunAsAdministrator
$RUBY_VERSION = "2.6.3.1"
Function DoesCommandExists {
Param ($command)
try { if(Get-Command $command -erroraction 'silentlycontinue'){ return $true } }
catch { return $false }
}
# https://docs.fastlane.tools/getting-started/android/setup/
"Settings environment variables LC_ALL and LANG"
[Environment]::SetEnvironmentVariable("LC_ALL", "en_US.UTF-8", "Machine")
[Environment]::SetEnvironmentVariable("LANG", "en_US.UTF-8", "Machine")
$hasInstalledChocolatey = DoesCommandExists choco
If ($hasInstalledChocolatey) {
"Updating Chocolatey"
choco upgrade chocolatey
} Else {
"Installing Chocolatey"
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
$hasInstalledRuby = DoesCommandExists ruby
If ($hasInstalledRuby) {
"Updating ruby"
choco upgrade ruby --version $RUBY_VERSION -y
} Else {
"Installing ruby"
choco install ruby --version $RUBY_VERSION -y
Write-Host "To finish the installation close the Powershell window and reopen it then rerun the script - (exit)" -ForegroundColor red
Exit
}
"ridk install - denpendency for bundle install"
ridk install 1 2 3
$hasInstalledBundler = DoesCommandExists bundle
If ($hasInstalledBundler) {
"Updating bundler"
gem update bundler
} Else {
"Installing bundler"
gem install bundler
}
bundle install
Write-Host "You are ready to go" -ForegroundColor green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment