Skip to content

Commit 7049e30

Browse files
committed
fix #112 - fix build script
The build script copies the files to Data\Packages\PowerShell. Also, deleted old scripts.
1 parent 540a61e commit 7049e30

File tree

7 files changed

+67
-189
lines changed

7 files changed

+67
-189
lines changed

bin/Build-Folder.ps1

Lines changed: 0 additions & 54 deletions
This file was deleted.

bin/Build.ps1

Lines changed: 0 additions & 32 deletions
This file was deleted.

bin/BuildFolder.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<#
2+
.SYNOPSIS
3+
Builds a version of the Sublime Text PowerShell package and deploys it
4+
locally to Data/Packages/PowerShell.
5+
6+
.DESCRIPTION
7+
Builds a version of the Sublime Text PowerShell package and deploys it
8+
locally to Data/Packages/PowerShell.
9+
10+
Requires a configuration file in ~\.sublime-package-dev.json.
11+
12+
This file must contain the following keys:
13+
14+
{
15+
"pathToSublimeText": ...\sublime_text.exe,
16+
"pathToSublimeTextData": ...
17+
}
18+
#>
19+
[CmdletBinding()]
20+
param([switch]$Release)
21+
22+
. $PSScriptRoot\Config.ps1
23+
24+
$pathToInstalledPackages = join-path (GetConfigValue pathToSublimeTextData) 'Installed Packages'
25+
test-path $pathToInstalledPackages -erroraction stop > $null
26+
$pathToPackages = join-path (GetConfigValue pathToSublimeTextData) 'Packages'
27+
test-path $pathToPackages -erroraction stop > $null
28+
$pathToPowerShellPackage = join-path $pathToPackages 'PowerShell'
29+
30+
# Deploy package locally.
31+
push-location $PSScriptRoot\..
32+
if (test-path $pathToPowerShellPackage) {
33+
write-verbose "Deleting old files..."
34+
remove-item $pathToPowerShellPackage\* -recurse
35+
}
36+
else {
37+
write-verbose "Creating target directory..."
38+
new-item -itemtype directory $pathToPowerShellPackage
39+
}
40+
write-verbose "Copying files..."
41+
copy-item * -recurse -exclude 'dist' $pathToPowerShellPackage
42+
pop-location
43+
44+
# Restart editor.
45+
write-verbose "Restarting editor..."
46+
get-process sublime_text -erroraction silentlycontinue | stop-process -erroraction silentlycontinue
47+
start-sleep -milliseconds 250
48+
49+
$editor = GetConfigValue pathToSublimeText
50+
if(!(test-path $editor -erroraction stop)){
51+
write-error "Could not locate editor executable in '$editor'."
52+
exit 1
53+
}
54+
& $editor

bin/CleanUp.ps1

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/Config.ps1

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,21 @@
11
# Helpers to read files in this format:
22
#
3-
# global-win editor path/to/some/bin
4-
# project-foo deploy-url http://some/url/here
5-
# ...
3+
# global-win editor path/to/some/bin
4+
# project-foo deploy-url http://some/url/here
5+
# ...
66

7-
function GetConfig {
8-
$path = "~/.sublime-package-dev"
7+
$script:pathToConfig = "~/.sublime-package-dev.json"
98

10-
if(!(test-path $path)){
11-
write-error "Could not find personal configuration in $path."
12-
exit 1
13-
}
14-
get-content $path
15-
}
9+
function GetConfigData {
10+
if(!(test-path $pathToConfig)){
11+
write-error "Could not find configuration file '$pathToConfig'."
12+
exit 1
13+
}
1614

17-
$script:configData = GetConfig
15+
return (get-content $pathToConfig) -join "`n" | convertfrom-json
16+
}
1817

1918
function GetConfigValue {
20-
param($section, $key)
21-
$section = $section.ToLower()
22-
$key = $key.ToLower()
23-
foreach($item in $configData){
24-
if(!$item.Trim()){
25-
continue
26-
}
27-
$s, $k, $v = $item.ToLower() -split ' ',3
28-
if(($s -eq $section) -and ($k -eq $key)){
29-
if(!$v){
30-
throw "No value found for '${section}:$key'."
31-
}
32-
return $v
33-
}
34-
}
19+
param($key)
20+
return (GetConfigData).$key
3521
}

bin/MakeRelease.ps1

Lines changed: 0 additions & 20 deletions
This file was deleted.

bin/Publish.ps1

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)