Skip to content

Commit

Permalink
Merge pull request #268 from NeowayLabs/fixReleaser
Browse files Browse the repository at this point in the history
Fix release generation for all OSs
  • Loading branch information
katcipis authored Jun 26, 2018
2 parents ac301a6 + 1c30d68 commit d23fd7a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 32 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ go:
- "tip"
- "1.10"
- "1.9"

install:
- go get -v golang.org/x/exp/ebnf
- make build

script:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- make test

- make build
- ./cmd/nash/nash ./hack/releaser.sh testci

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
webhooks:
urls:
Expand All @@ -31,4 +33,4 @@ notifications:
on_start: never
email:
- [email protected]
- tiago.katcipis@neoway.com.br
- tiagokatcipis@gmail.com
50 changes: 26 additions & 24 deletions hack/releaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if len($ARGS) != "2" {
exit("1")
}

version = $ARGS[1]
supported_os = ("linux" "darwin" "windows")
supported_arch = ("amd64")
var version = $ARGS[1]
var supported_os = ("linux" "darwin" "windows")
var supported_arch = ("amd64")

# Guarantee passing tests at least on the host arch/os
make test
Expand All @@ -18,13 +18,14 @@ mkdir -p dist

fn prepare_execs(distfiles, os) {
if $os == "windows" {
newfiles = ()
var newfiles = ()

for distfile in $distfiles {
src = $distfile[0]
dst = $distfile[1]
newsrc = $src + ".exe"
newdst = $dst + ".exe"
var src = $distfile[0]
var dst = $distfile[1]
var newsrc = $src + ".exe"
var newdst = $dst + ".exe"

newfiles <= append($newfiles, ($newsrc $newdst))
}

Expand All @@ -48,36 +49,37 @@ for os in $supported_os {
echo "building OS: "+$GOOS+" ARCH : "+$GOARCH
make build "version="+$version

pkgdir <= mktemp -d
bindir = $pkgdir + "/bin"
stdlibdir = $pkgdir + "/stdlib"
var pkgdir <= mktemp -d
var bindir = $pkgdir + "/bin"
var stdlibdir = $pkgdir + "/stdlib"

mkdir -p $bindir
mkdir -p $stdlibdir

nash_src = "./cmd/nash/nash"
nash_dst = $bindir + "/nash"
nashfmt_src = "./cmd/nashfmt/nashfmt"
nashfmt_dst = $bindir + "/nashfmt"
var nash_src = "./cmd/nash/nash"
var nash_dst = $bindir + "/nash"
var nashfmt_src = "./cmd/nashfmt/nashfmt"
var nashfmt_dst = $bindir + "/nashfmt"

execfiles = ( ($nash_src $nash_dst) ($nashfmt_src $nashfmt_dst) )
execfiles <= prepare_execs($execfiles, $os)
var execfiles = ( ($nash_src $nash_dst) ($nashfmt_src $nashfmt_dst) )
var execfiles <= prepare_execs($execfiles, $os)

# TODO: Improve with glob, right now have only two packages =)
distfiles <= append($execfiles, ("./stdlib/io.sh" $stdlibdir))
var distfiles <= append($execfiles, ("./stdlib/io.sh" $stdlibdir))
distfiles <= append($distfiles, ("./stdlib/map.sh" $stdlibdir))

for distfile in $distfiles {
src = $distfile[0]
dst = $distfile[1]
var src = $distfile[0]
var dst = $distfile[1]
cp -pr $src $dst
}

projectdir <= pwd
distar <= format("%s/dist/nash-%s-%s-%s.tar.gz", $projectdir, $version, $os, $arch)
var projectdir <= pwd
var distar <= format("%s/dist/nash-%s-%s-%s.tar.gz", $projectdir, $version, $os, $arch)

chdir($pkgdir)
pkgraw <= ls
pkgfiles <= split($pkgraw, "\n")
var pkgraw <= ls
var pkgfiles <= split($pkgraw, "\n")
tar cvfz $distar $pkgfiles
chdir($projectdir)
}
Expand Down
2 changes: 2 additions & 0 deletions stdbin/write/fd_linux.go → stdbin/write/fd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//+build !windows

package main

import (
Expand Down
6 changes: 3 additions & 3 deletions stdbin/write/fd_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
)

func specialFile(path string) (io.Writer, bool) {
if fname == "CON" { // holycrap!
func specialFile(path string) (io.WriteCloser, bool) {
if path == "CON" { // holycrap!
return os.Stdout, true
}
return nil, false
}
}

0 comments on commit d23fd7a

Please sign in to comment.