-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from tariq-asghar/master
Converted Bash scripts to PowerShell scripts for windows users
- Loading branch information
Showing
12 changed files
with
1,503 additions
and
3 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
Empty file.
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,121 @@ | ||
#!/bin/bash | ||
#################################################################################################### | ||
# | ||
# FILENAME: deploy-mdapi-source.ps1 | ||
# | ||
# PURPOSE: Convert SFDX source to MDAPI format and DEPLOY to the packaging org. | ||
# | ||
# DESCRIPTION: TODO: Write desription | ||
# | ||
# INSTRUCTIONS: Execute the following command relative to your project's root directory: | ||
# . ./dev-tools/deploy-mdapi-source.ps1 | ||
# | ||
# RELATED DOCS: TODO: ????? | ||
# └─ https://???.???.com | ||
# | ||
# TODO: ????? | ||
# ├─ https://www.????.com | ||
# └─ https://www.????.com | ||
# | ||
#### LOAD SHARED FUNCTIONS LIBRARY ################################################################# | ||
# | ||
$PROJECT_ROOT = (Split-Path $PSScriptRoot -Parent) | ||
if (Test-Path "$PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1") {} | ||
else{ | ||
Write-Output "FATAL ERROR: Could not load $PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1 File not found." | ||
return | ||
} | ||
#. '/lib/shared-functions.ps1' | ||
. "$PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1" | ||
# | ||
# | ||
#### CONFIRM SCRIPT EXECUTION ###################################################################### | ||
# | ||
confirmScriptExecution "Do you want to DEPLOY the contents of sfdx-source to your packaging org?" | ||
# | ||
# | ||
#### CREATE LOCAL VARIABLES ######################################################################## | ||
# | ||
# No local variables are used by this script. | ||
# | ||
# | ||
#### REBUILD MDAPI SOURCE FILES AND FOLDERS ######################################################## | ||
# | ||
# 0. Reset the Step Message counter and set the TOTAL STEPS to 4. | ||
resetStepMsgCounter 4 | ||
|
||
# 1. Ensure that the SFDX Package Directory specified exists. | ||
echoStepMsg "Looking for SFDX Package Directory named `"sfdx-source/$DEFAULT_PACKAGE_DIR_NAME`"" | ||
if ( Test-Path "$PROJECT_ROOT/sfdx-source/$DEFAULT_PACKAGE_DIR_NAME" ){ | ||
echo "SFDX Package directory found at: $PROJECT_ROOT/sfdx-source/$DEFAULT_PACKAGE_DIR_NAME" | ||
} else { | ||
echoErrorMsg "No SFDX Package Directory named `"sfdx-source/$DEFAULT_PACKAGE_DIR_NAME`" found. Aborting script." | ||
exit 1 | ||
} | ||
# 2. If there is a matching folder in the project's mdapi-source directory, delete any existing files. | ||
echoStepMsg "Removing stale files from `"mdapi-source/$DEFAULT_PACKAGE_DIR_NAME`"" | ||
if ( Test-Path "$PROJECT_ROOT/mdapi-source/$DEFAULT_PACKAGE_DIR_NAME" ){ | ||
(Set-Location $PROJECT_ROOT) | ||
if ($? -ne 0) { | ||
rmdir .\mdapi-source\$DEFAULT_PACKAGE_DIR_NAME | ||
if ($? -ne 0) { mkdir .\mdapi-source\$DEFAULT_PACKAGE_DIR_NAME } | ||
} | ||
echo "Directory $PROJECT_ROOT/mdapi-source/$DEFAULT_PACKAGE_DIR_NAME has been cleaned and is ready for updated metadata." | ||
} else { | ||
echo "Directory $PROJECT_ROOT/mdapi-source/$DEFAULT_PACKAGE_DIR_NAME does not exist. It will be created by the SFDX source conversion process." | ||
} | ||
# 3. Convert the SFDX source into MDAPI source. | ||
echoStepMsg "Converting SFDX source from Package Directory `"$DEFAULT_PACKAGE_DIR_NAME`". Output folder is `"mdapi-source/$DEFAULT_PACKAGE_DIR_NAME`"" | ||
echo ` | ||
"Executing force:source:convert \\ | ||
--rootdir ./sfdx-source/$DEFAULT_PACKAGE_DIR_NAME \\ | ||
--outputdir ./mdapi-source/$DEFAULT_PACKAGE_DIR_NAME\n" | ||
(Set-Location $PROJECT_ROOT) | ||
if ($? -ne 0) { | ||
sfdx force:source:convert ` | ||
--rootdir .\sfdx-source\$DEFAULT_PACKAGE_DIR_NAME ` | ||
--outputdir .\mdapi-source\$DEFAULT_PACKAGE_DIR_NAME | ||
} | ||
# Check if the previous command executed successfully. If not, abort this script. | ||
if ( $? -ne 0 ) { | ||
echoErrorMsg "SFDX source conversion to MDAPI format failed. Aborting script." | ||
exit 1 | ||
} | ||
# 4. Attempt to deploy the MDAPI source to the packaging org. | ||
echoStepMsg "Attempt to deploy the MDAPI source to the packaging org" | ||
echo \ | ||
"Executing force:mdapi:deploy \\ | ||
--deploydir ./mdapi-source \\ | ||
--testlevel RunLocalTests \\ | ||
--targetusername $PACKAGING_ORG_ALIAS \\ | ||
--wait 15\n" | ||
(Set-Location $PROJECT_ROOT) | ||
if ($? -ne 0) { | ||
sfdx force:mdapi:deploy ` | ||
--deploydir .\mdapi-source\$DEFAULT_PACKAGE_DIR_NAME ` | ||
--testlevel RunLocalTests ` | ||
--targetusername $PACKAGING_ORG_ALIAS ` | ||
--wait 15 | ||
} | ||
# Check if the previous command executed successfully. If not, abort this script. | ||
if ( $? -ne 'True' ){ | ||
echoErrorMsg "Deployment to the Packaging Org failed. Terminating script." | ||
exit 1 | ||
} | ||
# Provide a closing message telling the user where to find all the generated files. | ||
echoScriptCompleteMsg "Deployment of MDAPI source to the Packaging Org was successful." | ||
exit 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,87 @@ | ||
#!/bin/bash | ||
#################################################################################################### | ||
# | ||
# FILENAME: install-pkg-in-sandbox | ||
# | ||
# PURPOSE: Installs a 04t package into a sandbox org | ||
# | ||
# DESCRIPTION: TODO: Write descritption | ||
# | ||
# INSTRUCTIONS: Execute the following command relative to your project's root directory: | ||
# ./dev-tools/install-pkg-in-sandbox | ||
# | ||
# RELATED DOCS: TODO: ????? | ||
# └─ https://???.???.com | ||
# | ||
# TODO: ????? | ||
# ├─ https://www.????.com | ||
# └─ https://www.????.com | ||
# | ||
#### LOAD SHARED FUNCTIONS LIBRARY ################################################################# | ||
# | ||
$PROJECT_ROOT = (Split-Path $PSScriptRoot -Parent) | ||
if (Test-Path "$PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1") {} | ||
else{ | ||
Write-Output "FATAL ERROR: Could not load $PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1 File not found." | ||
return | ||
} | ||
#. '/lib/shared-functions.ps1' | ||
. "$PROJECT_ROOT/dev-tools-win/lib/shared-functions.ps1" | ||
# | ||
# | ||
#### CONFIRM SCRIPT EXECUTION ###################################################################### | ||
# | ||
confirmScriptExecution "Do you want to INSTALL a package into the specified sandbox org?" | ||
# | ||
# | ||
#### CREATE LOCAL VARIABLES ######################################################################## | ||
# | ||
# No local variables are used by this script. | ||
# | ||
# | ||
#### INSTALL PACKAGE INTO SANDBOX ################################################################## | ||
# | ||
#### 0. Reset the Step Message counter and set the TOTAL STEPS to 2. | ||
resetStepMsgCounter 2 | ||
|
||
#### 1. Attempt to install the specified package into the target subscriber org. | ||
echoStepMsg "Attempt to install package $PACKAGE_VERSION_ID into the org aliased as $SUBSCRIBER_SANDBOX_ALIAS" | ||
echo \ | ||
"Executing sfdx force:package:install \\ | ||
--id $PACKAGE_VERSION_ID \\ | ||
--wait 15 \\ | ||
--publishwait 10 \\ | ||
--targetusername $SUBSCRIBER_SANDBOX_ALIAS \\ | ||
--loglevel error\n" | ||
(Set-Location $PROJECT_ROOT) | ||
if ($? -ne 0) { | ||
sfdx force:package:install ` | ||
--id $PACKAGE_VERSION_ID ` | ||
--wait 15 ` | ||
--publishwait 10 ` | ||
--targetusername $SUBSCRIBER_SANDBOX_ALIAS ` | ||
--loglevel error | ||
} | ||
echo $? | ||
# Check if the previous command executed successfully. If not, abort this script. | ||
if ( $? -ne 0 ){ | ||
echoErrorMsg "Package installation was not successful." | ||
} | ||
#### 2. List all of the packages installed in the target subscriber org. | ||
echoStepMsg "List all packages installed in $SUBSCRIBER_SANDBOX_ALIAS" | ||
echo "List of packages currently installed in $SUBSCRIBER_SANDBOX_ALIAS." | ||
(Set-Location $PROJECT_ROOT) | ||
if ($? -ne 0) { | ||
sfdx force:package:installed:list ` | ||
--targetusername $SUBSCRIBER_SANDBOX_ALIAS ` | ||
--loglevel error | ||
} | ||
# | ||
# | ||
#### ECHO CLOSING SUCCESS MESSAGE ################################################################## | ||
# | ||
echoScriptCompleteMsg "Package installation script complete" | ||
##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,86 @@ | ||
#!/bin/bash | ||
#<%%# | ||
#################################################################################################### | ||
# | ||
# FILENAME: local-config.ps1 | ||
# | ||
# PURPOSE: Template for creating a personalized local-config.sh file. | ||
# | ||
# DESCRIPTION: All shell scripts in the dev-tools-win directory require several configuration values | ||
# to run correctly (eg. the path to your project's root directory or the alias of | ||
# the DevHub that you want to use. These customizations can be specific to each | ||
# individual developer, and therefore should not be tracked by the project's VCS. | ||
# | ||
# This file serves as a template that Release Managers can use to establish baseline | ||
# values for their project. When individaul developers clone the repo and initialize | ||
# their local, personal version of the project this template is used to create a | ||
# customized local-config.ps1 file at <project-root>/dev-tools-win/lib/local-config.sh | ||
# | ||
# INSTRUCTIONS: Replace the values of the variables as per your local configuration | ||
# | ||
#################################################################################################### | ||
#%> | ||
## | ||
### | ||
#### DEFINE LOCAL CONFIGURATION VARIABLES ########################################################## | ||
### | ||
## | ||
$PROJECT_ROOT = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent | ||
# | ||
# Alias for the Dev Hub that should be used when creating scratch orgs for this project. | ||
# This variable will always need to be customized for individual developers. | ||
$DEV_HUB_ALIAS='' | ||
|
||
# Namespace Prefix. Set to empty string ('') if this project is not building a managed package. | ||
$NAMESPACE_PREFIX='' | ||
|
||
# Package Name. Specified as part of the Package Detail info in your packaging org. | ||
# Surround this value with double-quotes if your package name contains space characters. | ||
# Set to empty string ('') if this project is not building a managed package. | ||
$PACKAGE_NAME='' | ||
|
||
# Metadata Package ID. Refers to the metadata package as a whole. Must begin with '033'. | ||
# Set to empty string ('') if this project is not building a managed package. | ||
$METADATA_PACKAGE_ID='033000000000000' | ||
|
||
# Package Version ID. Refers to a specific, installable version of a package. Must begin with '04t'. | ||
# Set to empty string ('') if this project is not building a managed package. | ||
$PACKAGE_VERSION_ID='04t000000000000' | ||
|
||
# Default Package Directory. Should match what is set in sfdx-project.json. | ||
$DEFAULT_PACKAGE_DIR_NAME='' | ||
|
||
# Alias for the primary Scratch Org used by this project. | ||
$SCRATCH_ORG_ALIAS= $NAMESPACE_PREFIX + '-SCRATCH' | ||
|
||
# Alias for the packaging org for this project. | ||
$PACKAGING_ORG_ALIAS= $NAMESPACE_PREFIX + '-PACKAGE' | ||
|
||
# Alias for the subscriber test org used to test managed-beta package installs. | ||
$SUBSCRIBER_ORG_ALIAS= $NAMESPACE_PREFIX + '-SUBSCRIBER' | ||
$SUBSCRIBER_SANDBOX_ALIAS = $SUBSCRIBER_ORG_ALIAS + '-SANDBOX' | ||
|
||
# Git Remote URI. SSH or HTTPS URI that points to the Git remote repo used by this project. | ||
# GitHub is used as an example here, but any Git remote (ie. BitBucket) can be used. | ||
# Set to empty string ('') if this project is not being tracked in a remote repository. | ||
$GIT_REMOTE_URI='' | ||
|
||
# Location of the primary scratch-def.json file that should be used by SFDX-Falcon scripts that | ||
# create scratch orgs (eg. rebuild-scratch-org). | ||
$SCRATCH_ORG_CONFIG=$PROJECT_ROOT+ '\config\project-scratch-def.json' | ||
|
||
# Echo the variables set by this script prior to exiting. Specify 'false' to suppress the | ||
# display of local config that normally occurs when executing SFDX-Falcon based scripts. | ||
$ECHO_LOCAL_CONFIG_VARS='true' | ||
# | ||
## | ||
### | ||
#### ECHO ALL VARIABLES ############################################################################ | ||
### | ||
## | ||
# | ||
if ( $ECHO_LOCAL_CONFIG_VARS -eq 'true' ) { | ||
Write-Output "Local configuration variables set by $PROJECT_ROOT/dev-tools-win/lib/local-config.sh" | ||
echoConfigVariables | ||
} | ||
##END## |
Oops, something went wrong.