Skip to content

Commit c1ea2a4

Browse files
committed
version & change makefile
1 parent f71d03e commit c1ea2a4

File tree

7 files changed

+251
-40
lines changed

7 files changed

+251
-40
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# build
55
/build/
66
/bin/
7-
/pkg/agent/script_vfsdata.go
87

98
# test
109
/test/

Makefile

+15-21
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,34 @@ EXECUTABLE=outliner
22
WINDOWS=$(EXECUTABLE)_windows.exe
33
LINUX=$(EXECUTABLE)_linux
44
DARWIN=$(EXECUTABLE)_darwin
5-
VERSION=$(shell git describe --tags --always --long --dirty)
5+
VERSION=$(shell cat VERSION)
66
XPKG="github.com/jyny/outliner/pkg/cmd"
77

8-
release : .mod pregen fmt $(LINUX) $(DARWIN) $(WINDOWS)
9-
@echo version: $(VERSION)
8+
all : build shell_completion
9+
cp ./build/outliner_$(shell go env GOOS) ./outliner
10+
@echo build version: $(VERSION)
1011

11-
$(WINDOWS):
12-
env GOOS=windows GOARCH=amd64 go build -o ./build/$(WINDOWS) -ldflags="-X $(XPKG).version=$(VERSION)" .
12+
shell_completion :
13+
mkdir -p build
14+
go run completion/gen.go
1315

14-
$(LINUX):
16+
build : mod embedded fmt
1517
env GOOS=linux GOARCH=amd64 go build -o ./build/$(LINUX) -ldflags="-X $(XPKG).version=$(VERSION)" .
16-
17-
$(DARWIN):
1818
env GOOS=darwin GOARCH=amd64 go build -o ./build/$(DARWIN) -ldflags="-X $(XPKG).version=$(VERSION)" .
19+
env GOOS=windows GOARCH=amd64 go build -o ./build/$(WINDOWS) -ldflags="-X $(XPKG).version=$(VERSION)" .
1920

20-
.mod :
21-
go mod download
22-
touch .mod
23-
24-
.PHONY : pregen
25-
pregen :
21+
embedded :
2622
@pushd pkg/agent > /dev/null && \
27-
go run gen/gen.go \
23+
go run gen/gen.go \
2824
&& popd > /dev/null
2925

30-
.PHONY : mod
31-
mod :
32-
go mod download
33-
34-
.PHONY : fmt
3526
fmt :
3627
gofmt -w ./
3728

29+
mod :
30+
go mod download
31+
3832
.PHONY : clean
3933
clean:
4034
rm -r ./build
41-
rm .mod
35+
rm outliner

README.md

+34-18
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Use "outliner [command] --help" for more information about a command.
2626
```
2727

2828
## Contents
29-
- [Download](#download)
29+
- [Install or Download](#install-or-download)
3030
- [Setup](#setup)
3131
- [1. Get `API_TOKEN`](#1-get-api_token)
3232
- [2. Make a `.env` config file](#2-make-a-env-config-file)
@@ -41,18 +41,34 @@ Use "outliner [command] --help" for more information about a command.
4141
- [Support Cloud(IaaS)](#support-cloudiaas)
4242
- [Development and Build](#development-and-build)
4343

44-
## Download
45-
download from latest [release](https://github.com/Jyny/outliner/releases/latest)
44+
## Install or Download
45+
### Mac OSX (wip)
46+
```
47+
$ brew isntall outliner
48+
```
49+
50+
### Arch linux (wip)
51+
```
52+
# pacman -S outliner
53+
```
54+
55+
### Ubuntu (wip)
56+
```
57+
# apt isntall outliner
58+
```
59+
60+
### Download binary from latest release
61+
[https://github.com/Jyny/outliner/releases/latest](https://github.com/Jyny/outliner/releases/latest)
4662

4763
## Setup
48-
##### 1. Get `API_TOKEN`
64+
#### 1. Get `API_TOKEN`
4965
get `API_TOKEN` from cloud providers you want, like `Linode`, `DigitalOcean` and etc.
5066

51-
##### 2. Make a `.env` config file
67+
#### 2. Make a `.env` config file
5268
write the `API_TOKEN` to `.env` file whith `TOKEN_NAME` [like this](#config-by-env-file).
5369
Reference the [Support `TOKEN_NAME`](#supported-token_name) below.
5470

55-
##### 3. Generate SSH key
71+
#### 3. Generate SSH key
5672
outliner support auto generate ssh key, if Not found `id_rsa` and `id_rsa.pub` in `$HOME/.ssh/`.
5773
[ssh library package](https://godoc.org/golang.org/x/crypto/ssh) outliner use, is implement by golang.org
5874
run any command in outliner will do this after asking.
@@ -62,10 +78,14 @@ Continue to Generate New ssh key? (y/n) [y]:
6278
```
6379
To generate key by yourself, see [Generating a new SSH key and adding it to the ssh-agent](https://help.github.com/en/enterprise/2.16/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
6480

65-
##### 4. Ready to go
66-
* open terminal, go directory whrere you download outliner
67-
* maybe should add execute permission to binary (linux or mac)
68-
* `$ ./build/outliner_{OS}`
81+
#### 4. Ready to go
82+
##### * install by package manager like `homeberw` `pacman` `apt` etc.
83+
1. `$ outliner`
84+
85+
##### * install by download
86+
1. open terminal, go directory whrere you download outliner
87+
2. maybe should add execute permission to binary (linux or mac)
88+
3. `$ ./outliner_{OS}`
6989

7090
## Configurations
7191
### config by `.env` file
@@ -115,15 +135,11 @@ outliner Support the following configuration source (list by Precedence order)
115135
...
116136

117137
## Development and Build
118-
1. install depend package
119-
```
120-
$ make mod
121-
```
122-
2. build binary
138+
#### 1. install package and build binary
123139
```
124-
$ make build
140+
$ make
125141
```
126-
3. run
142+
#### 2. run
127143
```
128-
$ ./build/outliner_$(go env GOOS)
144+
$ ./outliner
129145
```

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.1.4

completion/gen.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"github.com/jyny/outliner/pkg/cmd"
5+
)
6+
7+
func main() {
8+
err := cmd.RootCmd.GenBashCompletionFile("build/outliner_bash_completion")
9+
if err != nil {
10+
panic(err)
11+
}
12+
err = cmd.RootCmd.GenZshCompletionFile("build/outliner_zsh_completion")
13+
if err != nil {
14+
panic(err)
15+
}
16+
}

pkg/agent/script_vfsdata.go

+184
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/root.go

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var rootCmd = &cobra.Command{
2929
Short: "Auto setup & deploy tool for outline VPN server",
3030
Long: "Auto setup & deploy tool for outline VPN server",
3131
}
32+
var RootCmd = rootCmd
3233

3334
// Execute entry of commandline
3435
func Execute() {

0 commit comments

Comments
 (0)