-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BugDiver
committed
Jun 1, 2019
1 parent
24141ef
commit 105843d
Showing
8 changed files
with
139 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ jest* | |
TODO* | ||
ts* | ||
launcher.js | ||
azure* | ||
.gitmodules | ||
*.ps1 | ||
*.bat |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
Param( | ||
[String]$TaskName # The name of the task to run | ||
) | ||
|
||
# Define the tasks | ||
$tasks = @{} | ||
|
||
$tasks.Add('build', @{ | ||
description = "Compiles typescript files to js with diclaration, add generated code to dist"; | ||
script = { | ||
clean | ||
npm run build | ||
Copy-Item -Recurse .\src\gen .\dist | ||
} | ||
}) | ||
|
||
|
||
$tasks.Add('package', @{ | ||
description = "Generate gauge-ts plugin zip file"; | ||
script = { | ||
Invoke-Command $tasks.Get_Item("build").script | ||
mkdir -p deploy | ||
Copy-Item launcher.* deploy | ||
Copy-Item ts.json deploy | ||
mkdir artifacts | ||
$version = version | ||
$src = Join-Path -Path (Get-Location).Path -ChildPath "deploy" | ||
$artifacts = Join-Path -Path (Get-Location).Path -ChildPath "artifacts" | ||
$dest = Join-Path -Path $artifacts -ChildPath "gauge-ts-$version.zip" | ||
Add-Type -Assembly "System.IO.Compression.FileSystem" ; | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($src, $dest) | ||
} | ||
}) | ||
|
||
|
||
$tasks.Add('install', @{ | ||
description = "Install's gauge-ts plugin from the files in artifacts dir"; | ||
script = { | ||
$version = version | ||
gauge install ts -f ".\artifacts\gauge-ts-$version.zip" | ||
} | ||
}) | ||
|
||
|
||
$tasks.Add('uninstall', @{ | ||
description = "UnInstall gauge-ts plugin's current version"; | ||
script = { | ||
$version = version | ||
gauge uninstall ts -v $version | ||
} | ||
}) | ||
|
||
|
||
|
||
$tasks.Add('forceinstall', @{ | ||
description = "Insatall gauge-ts plugin after uninstall the current version"; | ||
script = { | ||
Invoke-Command $tasks.Get_Item("uninstall").script | ||
Invoke-Command $tasks.Get_Item("install").script | ||
} | ||
}) | ||
|
||
|
||
# Helper functions | ||
function version { | ||
$runnerManifest = Get-Content .\ts.json | Out-String | ConvertFrom-Json | ||
$version = $runnerManifest.version | ||
return $version | ||
} | ||
|
||
function clean { | ||
$dirs = "dist", "deploy", "artifacts" | ||
foreach ($dir in $dirs) { | ||
if (Test-Path $dir) { | ||
Remove-Item -Recurse -Force $dir | ||
} | ||
} | ||
} | ||
|
||
# Some helpful strings for formatting output | ||
$indent = (" " * 4); | ||
$spacer = ("-" * 40); | ||
|
||
function DisplayHelpText { | ||
$help_text = Get-Help $MyInvocation.ScriptName | ||
$syn = $help_text.Synopsis | ||
Write-Output "build.ps1 - runtask TaskName" | ||
DisplayTaskList | ||
} | ||
|
||
function DisplayTaskList { | ||
Write-Output "`nList of Tasks:`n$spacer" | ||
foreach ($task in $tasks.GetEnumerator()) { | ||
Write-Output "$indent$($task.Key)" | ||
Write-Output "$($indent * 2)$($task.Value.description)" | ||
} | ||
} | ||
|
||
# Now process the given task name | ||
if (-not $taskname) { | ||
DisplayHelpText | ||
exit | ||
} | ||
$task = $tasks.Get_Item($taskname) | ||
if ($task) { | ||
Invoke-Command $task.script | ||
} | ||
else { | ||
Write-Output "'$taskname' is not a valid task name." | ||
DisplayTaskList | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
echo "Windows support is not tested yet. There might be some issues." | ||
@echo off | ||
echo "Windows support is not tested yet. There might be some issues." | ||
node launcher.js %1 |
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