Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

on:
push:
tags: # Sequence of patterns matched against refs/tags
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
artifact_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

artifacts:
needs: [ release ]
name: Build Artifacts
strategy:
matrix:
include:
- target: linux
arch: amd64
os: ubuntu-latest
- target: freebsd
arch: amd64
os: ubuntu-latest
- target: darwin
arch: amd64
os: macos-latest
- target: darwin
arch: arm64
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build
env:
GOOS: ${{ matrix.target }}
GOARCH: ${{ matrix.arch }}
run: |
make archive GITHASH=${{ github.sha }}
- name: Upload artifact
id: upload_artifact_linux_amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.artifact_upload_url }}
asset_path: ./target/${{ matrix.target }}_${{ matrix.arch }}/forego-${{ github.sha }}-${{ matrix.target }}-${{ matrix.arch }}.tgz
asset_name: forego-${{ github.ref_name }}-${{ matrix.target }}-${{ matrix.arch }}.tgz
asset_content_type: application/x-tgz
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.env
/forego
.DS_Store

target/
bin/
19 changes: 0 additions & 19 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

64 changes: 50 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
BIN = forego
SRC = $(shell find . -name '*.go' -not -path './vendor/*')

.PHONY: all build clean lint release test
# the product we're building
NAME := forego
# the product's main package
MAIN := ./forego

# fix our gopath
GOPATH := $(GOPATH):$(PWD)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)

# build and packaging
TARGETS := $(PWD)/bin
PRODUCT := $(TARGETS)/$(NAME)

# build and packaging for release
GITHASH := $(shell git log --pretty=format:'%h' -n 1)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
VERSION ?= $(GITHASH)
RELEASE_TARGETS = $(PWD)/target/$(GOOS)_$(GOARCH)
RELEASE_PRODUCT = $(NAME)-$(VERSION)
RELEASE_BUILD = $(RELEASE_TARGETS)/$(RELEASE_PRODUCT)
RELEASE_BINARY = $(RELEASE_BUILD)/bin/$(NAME)
RELEASE_ARCHIVE = $(RELEASE_PRODUCT)-$(GOOS)-$(GOARCH).tgz
RELEASE_PACKAGE = $(RELEASE_TARGETS)/$(RELEASE_ARCHIVE)

# build and install
PREFIX ?= /usr/local
LATEST ?= latest

# sources
SRC = $(shell find $(MAIN) -name \*.go)

.PHONY: all test clean install build archive

all: build

build: $(BIN)
$(PRODUCT): $(SRC)
go build -ldflags="-X main.version=$(VERSION) -X main.githash=$(GITHASH)" -o $@ $(MAIN)

build: $(PRODUCT) ## Build the product

$(RELEASE_BINARY): $(SRC)
go build -ldflags="-X main.version=$(VERSION) -X main.githash=$(GITHASH)" -o $(RELEASE_BINARY) $(MAIN)

clean:
rm -f $(BIN)
$(RELEASE_PACKAGE): $(RELEASE_BINARY)
(cd $(RELEASE_TARGETS) && tar -zcf $(RELEASE_ARCHIVE) $(RELEASE_PRODUCT))

lint: $(SRC)
go fmt
archive: $(RELEASE_PACKAGE)

release:
bin/release
install: build ## Build and install
@echo "Using sudo to install; you may be prompted for a password..."
sudo install -m 0755 $(PRODUCT) $(PREFIX)/bin/

test: lint build
go test -v -race -cover ./...
test: ## Run tests
go test $(MAIN)/...

$(BIN): $(SRC)
go build -o $@
clean: ## Delete the built product and any generated files
rm -rf $(TARGETS)
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
## forego

<a href="https://circleci.com/gh/ddollar/forego">
<img align="right" src="https://circleci.com/gh/ddollar/forego.svg?style=svg">
</a>
## Forego

[Foreman](https://github.com/ddollar/foreman) in Go.

### Installation
## Installing

For your convenience, Forego can be installed via Homebrew. However you cannot install it along side the original Forego, from which this was forked.

Install or upgrade the latest version thusly:

[Downloads](https://dl.equinox.io/ddollar/forego/stable)
```
$ brew install bww/stable/forego
$ brew upgrade bww/stable/forego
```

##### Compile from Source
Uninstall as follows:

$ go get -u github.com/ddollar/forego
```
$ brew uninstall forego
```

### Usage

Expand All @@ -29,4 +34,4 @@ Use `forego help` to get a list of available commands, and `forego help

### License

Apache 2.0 &copy; 2015 David Dollar
Apache 2.0 &copy; 2015 David Dollar, 2018 Brian W. Wolter
12 changes: 0 additions & 12 deletions bin/release

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion env_test.go → forego/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import "testing"

func TestMultipleEnvironmentFiles(t *testing.T) {
envs := []string{"fixtures/envs/.env1", "fixtures/envs/.env2"}
envs := []string{"../fixtures/envs/.env1", "../fixtures/envs/.env2"}
env, err := loadEnvs(envs)

if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions main.go → forego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package main

import "os"

var ( // set at compile time via the linker
version = "v0.0.0"
githash = "000000"
)

var commands = []*Command{
cmdStart,
cmdRun,
Expand Down
20 changes: 12 additions & 8 deletions outlet.go → forego/outlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

type OutletFactory struct {
Padding int

Color bool
sync.Mutex
}

Expand Down Expand Up @@ -76,18 +76,22 @@ func (of *OutletFactory) ErrorOutput(str string) {
func (of *OutletFactory) WriteLine(left, right string, leftC, rightC ct.Color, isError bool) {
of.Lock()
defer of.Unlock()

ct.ChangeColor(leftC, true, ct.None, false)

if of.Color {
ct.ChangeColor(leftC, true, ct.None, false)
}
formatter := fmt.Sprintf("%%-%ds | ", of.Padding)
fmt.Printf(formatter, left)

if isError {
ct.ChangeColor(ct.Red, true, ct.None, true)
} else {
ct.ResetColor()
if of.Color {
if isError {
ct.ChangeColor(ct.Red, true, ct.None, true)
} else {
ct.ResetColor()
}
}
fmt.Println(right)
if isError {
if of.Color && isError {
ct.ResetColor()
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading