Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: KSP-SpaceDock/SpaceDock-Backend
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e2227c8aefb8
Choose a base ref
...
head repository: KSP-SpaceDock/SpaceDock-Backend
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bf004ffb2102
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 19, 2017

  1. Fake plugin system

    This will read a file named plugin.txt from the build folder, and include its content into sdb.go's import statement, so plugins will be fetched at build time and embedded into the assembly.
    Dorian Stoll committed Mar 19, 2017
    Copy the full SHA
    1aec7e8 View commit details
  2. Package updated, value is gone

    Dorian Stoll committed Mar 19, 2017
    Copy the full SHA
    bf004ff View commit details
Showing with 60 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +28 −0 build/activate.ps1
  3. +30 −0 build/activate.sh
  4. +0 −1 src/SpaceDock/app.go
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -36,3 +36,5 @@ bin/

# SpaceDock specific
config/config.yml
build/plugins.txt
build_sdb.go
28 changes: 28 additions & 0 deletions build/activate.ps1
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
$script:THIS_PATH = $myinvocation.mycommand.path
$script:BASE_DIR = split-path (resolve-path "$THIS_PATH/..") -Parent
$script:DIR_NAME = split-path $BASE_DIR -Leaf
$script:PLUGIN_FILE = $BASE_DIR + "/build/plugins.txt"

function global:deactivate ( [switch] $NonDestructive ){

@@ -31,9 +32,36 @@ function global:deactivate ( [switch] $NonDestructive ){
if ( !$NonDestructive ) {
# Self destruct!
remove-item function:deactivate
remove-item function:build
}
}

function global:build($projectname) {
# Vars
$filename = $projectname + ".go"
$binname = $projectname + ".exe"

# Update deps
go get -u ./...

# Implement plugin stuff
Get-Content ($BASE_DIR + "/" + $filename) | Foreach-Object {
if ($_ -eq ")") {
# Add Lines before the selected pattern
if (Test-Path $PLUGIN_FILE) {
Get-Content $PLUGIN_FILE | Foreach-Object {
' _ "' + $_ + '"'
go get -u $_
}
}
}
$_ # send the current line to output
} | Set-Content ($BASE_DIR + "/build_" + $filename)

# Build the binary
go build -v -o $BASE_DIR/build/$binname $BASE_DIR/build_$filename
}

# unset irrelevant variables
deactivate -nondestructive

30 changes: 30 additions & 0 deletions build/activate.sh
Original file line number Diff line number Diff line change
@@ -33,9 +33,39 @@ deactivate () {
if [ ! "${1-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
unset -f build
fi
}

build () {
# Vars
$filename = $1 + ".go"
$binname = $1

# Update deps
go get -u ./...

# Implement plugin stuff
rm $VIRTUAL_ENV/build_$filename
filelines=`cat $VIRTUAL_ENV/$filename`
for line in $filelines ; do
if ["$line" = ")"]
then
if [-e "$VIRTUAL_ENV/build/plugins.txt"]
then
filelines2=`cat $VIRTUAL_ENV/build/plugins.txt`
for line2 in $filelines ; do
echo $line >> $VIRTUAL_ENV/build_$filename
done
fi
fi
echo $line >> $VIRTUAL_ENV/build_$filename
done

# Build the binary
go build -v -o $VIRTUAL_ENV/build/$binname $VIRTUAL_ENV/build_$filename
}

# unset irrelevant variables
deactivate nondestructive

1 change: 0 additions & 1 deletion src/SpaceDock/app.go
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ func init() {
App.Adapt(iris.DevLogger())
mySessions := sessions.New(sessions.Config{
Cookie: "spacedocksid",
DecodeCookie: false,
Expires: 0,
CookieLength: 32,
DisableSubdomainPersistence: false,