Skip to content

Commit f925b9b

Browse files
committed
updated project for releasing
1 parent 5032056 commit f925b9b

18 files changed

+187
-54
lines changed

.github/CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing
2+
3+
## Requirements
4+
5+
+ Go 1.21+
6+
+ Make
7+
8+
9+
## Testing
10+
11+
First ensure tests pass:
12+
13+
```bash
14+
make test
15+
```
16+
17+
## Releasing
18+
19+
Release a new version:
20+
21+
```bash
22+
make build
23+
```

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [Halleck45]

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
# run only against tags
6+
tags:
7+
- "*"
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
goreleaser:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Checkout the repository
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
# Install go dependencies
22+
- uses: actions/setup-go@v4
23+
with:
24+
go-version: stable
25+
26+
# run tests
27+
- name: "Test application"
28+
run: go test
29+
30+
# Build artifacts
31+
- uses: goreleaser/goreleaser-action@v5
32+
with:
33+
distribution: goreleaser
34+
version: latest
35+
args: release --clean
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Go
2+
3+
on: [push]
4+
5+
jobs:
6+
test:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
go-version: [ '1.21.x' ]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Go ${{ matrix.go-version }}
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: ${{ matrix.go-version }}
20+
cache-dependency-path: subdir/go.sum
21+
22+
- name: Install Go dependencies
23+
run: go get .
24+
25+
- name: Test with the Go CLI
26+
run: go test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
env.sh
55
pkg
66
build
7-
bin
7+
bin
8+
dist

.goreleaser.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
before:
3+
hooks:
4+
- go mod tidy
5+
- go generate ./...
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
- darwin
14+
15+
archives:
16+
- format: binary
17+
name_template: >-
18+
{{ .ProjectName }}_
19+
{{- title .Os }}_
20+
{{- if eq .Arch "amd64" }}x86_64
21+
{{- else if eq .Arch "386" }}i386
22+
{{- else }}{{ .Arch }}{{ end }}
23+
{{- if .Arm }}v{{ .Arm }}{{ end }}
24+
25+
changelog:
26+
sort: asc
27+
filters:
28+
exclude:
29+
- "^docs:"
30+
- "^test:"

Makefile

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
REPLACE=`semver tag`
2-
3-
init:
4-
@export GOPATH=~/go:`pwd`
5-
6-
install:
7-
go get github.com/mitchellh/gox
8-
go get github.com/dotcypress/phonetics
9-
go get github.com/stretchr/testify
2+
.PHONY: build
103

114
test:
12-
@go test github.com/halleck45/...
13-
14-
build: test
15-
@echo "Building release: `semver tag`"
16-
@gox -build-toolchain -ldflags "-X main.version `semver tag`" oss.go
17-
18-
publish:
19-
@./publish.sh
5+
@go test ./...
6+
7+
build:
8+
@echo "\e[34m\033[1m-> Building go binaries for supported platforms\033[0m\e[39m\n"
9+
rm -Rf dist || true
10+
go install github.com/goreleaser/goreleaser@latest
11+
GOPATH=$(HOME)/go PATH=$$PATH:$(HOME)/go/bin goreleaser build --snapshot
12+
@echo "\e[34m\033[1mDONE \033[0m\e[39m\n"
2013

2114

2215
tag:

README.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# OSS
1+
# OSS
22

33
Tool for managing Open Source assets.
44

5-
## Why ?
5+
## Why ?
66

77
Managing Open Source assets is a hard task in any project ; we often download awesome librairies, images or medias, but
88
where to keep trace of all theses files ? How can I manage Open Source licenses of medias in my project ?
@@ -11,47 +11,41 @@ That's the problem oss try to resolve today.
1111

1212
![simple overview of oss](./doc/overview.gif)
1313

14-
## Installation
14+
## Installation
1515

16-
Download binary for your platform:
16+
Download the binary for your platform from the [latest release](https://github.com/Halleck45/releases/latest).
1717

18-
+ Linux Debian: [64bits](http://dl.bintray.com/halleck45/OSS/oss_linux_amd64), [32bits](http://dl.bintray.com/halleck45/OSS/oss_linux_386)
19-
+ Windows: [64bits](http://dl.bintray.com/halleck45/OSS/oss_windows_amd64.exe), [32bits](http://dl.bintray.com/halleck45/OSS/oss_windows_386.exe)
20-
+ [Others platforms](http://dl.bintray.com/halleck45/OSS/)
21-
22-
## Usage
18+
## Usage
2319

2420
On first run, please execute
2521

26-
oss init
22+
```bash
23+
oss init
24+
```
2725

2826
Then, you can use the following commands:
2927

30-
+ **status**: list assets of the project
31-
+ **add** `<license>` `<file>` `[<description>]`: register new file
32-
+ **rm** `<file>`: unregister file
33-
+ **show** `<file>`: display information about the given file
28+
+ `oss `**`status`**: list assets of the project
29+
+ `oss `**`add`**` <license> <file> [<description>]`: register new file
30+
+ `oss `**`rm`**` <file>`: unregister file
31+
+ `oss `**`show`**` <file>`: display information about the given file
3432

3533
Or to get information about SPDX licenses :
3634

37-
+ **licenses**: list available licenses (base on the [SPDX license list]((http://spdx.org/licenses/)))
38-
+ **search** `<expression>`: Search licenses matching `expression`
39-
+ **update**: update SPDX license list
35+
+ `oss `**`licenses`**: list available licenses (base on the [SPDX license list]((http://spdx.org/licenses/)))
36+
+ `oss `**`search`**` <expression>`: Search licenses matching `expression`
37+
+ `oss `**`update`**: update SPDX license list
4038

4139
Keep in mind that **the license identifier should be registered in [SPDX License list](http://spdx.org/licenses/)**
4240

4341
## Copyright
4442

4543
MIT License. Copyright (c) Jean-François Lépine. See LICENSE for details.
4644

47-
## Contributing
45+
## Contributing
4846

4947

50-
clone [email protected]:Halleck45/OSS.git
51-
cd OSS
52-
make init && make install
53-
( ... your development ...)
54-
make build
48+
Cf. [CONTRIBUTING.md](./.github/CONTRIBUTING.md)
5549

5650
Remember to keep tests up to date (and, of course, to run them with `make test`)
5751

go.mod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module github.com/halleck45/oss
2+
3+
go 1.21
4+
5+
require (
6+
github.com/dotcypress/phonetics v0.0.0-20141025200009-5cea56e8d200
7+
github.com/stretchr/testify v1.9.0
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
13+
gopkg.in/yaml.v3 v3.0.1 // indirect
14+
)

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/dotcypress/phonetics v0.0.0-20141025200009-5cea56e8d200 h1:3y43HNVcW0K++6HB7RsWIdulZ5zzrLYBBtPccYsqTdc=
4+
github.com/dotcypress/phonetics v0.0.0-20141025200009-5cea56e8d200/go.mod h1:nTAuszUNo9dUCKTwDLN9UDcO5UdL/MAOvmu5oM+5ozY=
5+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
8+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
10+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
11+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

oss.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ package main
88

99
import (
1010
"os"
11-
"github.com/halleck45/oss/license"
12-
"github.com/halleck45/oss/spdx"
11+
12+
"github.com/halleck45/oss/src/license"
13+
"github.com/halleck45/oss/src/spdx"
1314
)
1415

1516
func main() {
1617

1718
var command string
18-
if(len(os.Args) < 2) {
19+
if len(os.Args) < 2 {
1920
command = "help"
2021
} else {
21-
command = os.Args[1];
22+
command = os.Args[1]
2223
}
2324

2425
spdxService := spdx.Service{LicenseFilename: "./.oss-licenses.json"}

src/github.com/halleck45/oss/license/application.go renamed to src/license/application.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,6 @@ func (app *Application) Run(command string) {
189189
fmt.Printf(" %-20s %s", "version", "Dislay current version\n")
190190
fmt.Printf(" %-20s %s", "help", "This help\n")
191191
default:
192-
fmt.Println("Command %s not found", command)
192+
fmt.Printf("Command %s not found\n", command)
193193
}
194194
}

src/github.com/halleck45/oss/license/service.go renamed to src/license/service.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ package license
1111

1212
import (
1313
"encoding/json"
14+
"errors"
1415
"fmt"
1516
"io/ioutil"
1617
"os"
17-
"errors"
18-
"github.com/halleck45/oss/spdx"
19-
)
2018

19+
"github.com/halleck45/oss/src/spdx"
20+
)
2121

2222
/**
2323
* Service
2424
*/
2525
type Service struct {
26-
Filename string
27-
Manif Manifest
26+
Filename string
27+
Manif Manifest
2828
SpdxService spdx.Service
2929
}
3030

@@ -40,7 +40,7 @@ func (c *Service) Init() (err error) {
4040
c.Save()
4141
} else {
4242
err = c.Load()
43-
if(err != nil) {
43+
if err != nil {
4444
return err
4545
}
4646
}
@@ -52,7 +52,7 @@ func (c *Service) Init() (err error) {
5252
/**
5353
* Load current manifest
5454
*/
55-
func (c *Service) Load() (err error){
55+
func (c *Service) Load() (err error) {
5656
// file exists ; load it
5757
file, err := os.Open(c.Filename)
5858
if err != nil {
@@ -65,7 +65,6 @@ func (c *Service) Load() (err error){
6565
return err
6666
}
6767

68-
6968
/**
7069
* Add asset in manifest
7170
*/
@@ -82,7 +81,7 @@ func (c *Service) Add(a Asset) {
8281
*/
8382
func (c *Service) Get(file string) (asset Asset, err error) {
8483
for _, asset := range c.Manif.Assets {
85-
if(asset.File == file) {
84+
if asset.File == file {
8685
return asset, nil
8786
}
8887
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)