-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove hard-coded version string from env setup * correct syntax for creating a variable with PowerShell * run CI on push, not only on review_requested * Find the python path if it exists in urbanopt gem directories * use the powershell to create the bat file for windows command * remove the bat setup script as this will all be done using the powershell script * fix unix basename syntax * ugh dumb copypasta mistake * update readme installer instructions to match new script fix --------- Co-authored-by: tijcolem <[email protected]>
- Loading branch information
Showing
6 changed files
with
48 additions
and
50 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
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
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 was deleted.
Oops, something went wrong.
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,25 +1,45 @@ | ||
# This is a simple setup script that generates an enviroment file that | ||
# is used to setup the ruby enviroment to run the urbanopt-cli tool. | ||
# This is a simple setup script that generates an environment file that | ||
# is used to setup the ruby environment to run the urbanopt-cli tool. | ||
# To use just run this script in powershell (e.g. ./setup-env.ps1) | ||
# Then you can use this env.ps1 to setup the enviroment. | ||
# Then you can use this env.ps1 to setup the environment. | ||
# (e.g. . env.ps1) | ||
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' | ||
|
||
if (-not (Test-Path $HOME)) { echo "env HOME needs to be set before running this script" } | ||
if (-not (Test-Path $HOME)) { exit } | ||
|
||
# uo install_python will install its own python within the gem directories so we need to find the python path and add it to $env.PATH | ||
$output = Get-ChildItem -ErrorAction SilentlyContinue -Directory "C:\URBANopt*" -Recurse -Filter "python-3.10" | Select-Object FullName | ||
|
||
if ($output.FullName) { | ||
$RUBY_PYTHON_PATH = $output.FullName | ||
} | ||
else { | ||
$RUBY_PYTHON_PATH = "" | ||
} | ||
|
||
|
||
$BASE_DIR_NAME = $PSScriptRoot | ||
|
||
$env:GEM_HOME = "$BASE_DIR_NAME\gems\ruby\2.7.0" | ||
$env:GEM_PATH = "$BASE_DIR_NAME\gems\ruby\2.7.0" | ||
$env:PATH += ";$BASE_DIR_NAME\ruby\bin;$BASE_DIR_NAME\gems\ruby\2.7.0\bin;$BASE_DIR_NAME\gems\ruby\2.7.0\gems\urbanopt-cli-0.11.1\example_files\python_deps\python-3.10" | ||
$env:PATH += ";$BASE_DIR_NAME\ruby\bin;$BASE_DIR_NAME\gems\ruby\2.7.0\bin;$RUBY_PYTHON_PATH" | ||
$env:RUBYLIB = "$BASE_DIR_NAME\OpenStudio\Ruby" | ||
$env:RUBY_DLL_PATH = "$BASE_DIR_NAME\OpenStudio\Ruby" | ||
|
||
# Remove if exists | ||
Remove-Item $HOME/.env_uo.ps1 -ErrorAction Ignore | ||
Remove-Item $HOME/.env_uo.bat -ErrorAction Ignore | ||
|
||
'$env:GEM_HOME = "' + $env:GEM_HOME + '"' >> $HOME/.env_uo.ps1 | ||
'$env:GEM_PATH = "' + $env:GEM_PATH + '"' >> $HOME/.env_uo.ps1 | ||
'$env:PATH = "' + $env:PATH + '"' >> $HOME/.env_uo.ps1 | ||
'$env:RUBYLIB = "' + $env:RUBYLIB + '"' >> $HOME/.env_uo.ps1 | ||
'$env:RUBY_DLL_PATH = "' + $env:RUBY_DLL_PATH + '"' >> $HOME/.env_uo.ps1 | ||
|
||
'' >> $HOME/.env_uo.bat | ||
'SET "GEM_HOME=' + $env:GEM_HOME + '"' >> $HOME/.env_uo.bat | ||
'SET "GEM_PATH=' + $env:GEM_PATH + '"' >> $HOME/.env_uo.bat | ||
'SET "PATH=' + $env:PATH + '"' >> $HOME/.env_uo.bat | ||
'SET "RUBYLIB=' + $env:RUBYLIB + '"' >> $HOME/.env_uo.bat | ||
'SET "RUBY_DLL_PATH=' + $env:RUBY_DLL_PATH + '"' >> $HOME/.env_uo.bat |