Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 6dfaf7b

Browse files
committed
prep for v0.0.18 release, brought in line with current project practice
1 parent 9d1f8f1 commit 6dfaf7b

8 files changed

Lines changed: 143 additions & 224 deletions

File tree

CITATION.cff

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
cff-version: 1.1.0
3+
message: "If you use this software, please cite it as below."
4+
authors:
5+
- family-names: Doiel
6+
given-names: R. S.
7+
orcid: https://orcid.org/0000-0003-0900-6903
8+
version: 0.0.18
9+
title: cli
10+
date-released: 2021-07-27

Makefile

Lines changed: 99 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,127 @@
11
#
2-
# Simple Makefile
2+
# Simple Makefile for Golang based Projects.
33
#
44
PROJECT = cli
55

6-
VERSION = $(shell grep -m1 "Version = " $(PROJECT).go | cut -d\` -f 2)
6+
PROGRAMS = $(shell ls -1 cmd/)
77

8-
BRANCH = $(shell git branch | grep "* " | cut -d\ -f 2)
8+
PACKAGE = $(shell ls -1 *.go)
9+
10+
#VERSION = $(shell jq .version codemeta.json | cut -d\" -f 2)
11+
VERSION = $(shell grep '"version":' codemeta.json | cut -d\" -f 4)
12+
13+
BRANCH = $(shell git branch | grep '* ' | cut -d\ -f 2)
914

1015
OS = $(shell uname)
1116

17+
#PREFIX = /usr/local/bin
18+
PREFIX = $(HOME)
19+
20+
ifneq ($(prefix),)
21+
PREFIX = $(prefix)
22+
endif
23+
1224
EXT =
1325
ifeq ($(OS), Windows)
14-
EXT = .exe
26+
EXT = .exe
1527
endif
1628

17-
build:
18-
go build -o bin/pkgassets$(EXT) cmd/pkgassets/pkgassets.go
19-
go build -o bin/cligenerate$(EXT) cmd/cligenerate/cligenerate.go
29+
build: version.go $(PROGRAMS)
2030

31+
version.go: .FORCE
32+
@echo "package $(PROJECT)" >version.go
33+
@echo '' >>version.go
34+
@echo 'const Version = "$(VERSION)"' >>version.go
35+
@echo '' >>version.go
36+
@git add version.go
37+
@if [ -f bin/codemeta ]; then ./bin/codemeta; fi
2138

22-
man: build
23-
mkdir -p man/man1
24-
bin/cligenerate -generate-manpage | nroff -Tutf8 -man > man/man1/cligenerate.1
25-
bin/pkgassets -generate-manpage | nroff -Tutf8 -man > man/man1/pkgassets.1
39+
$(PROGRAMS): $(PACKAGE)
40+
@mkdir -p bin
41+
go build -o "bin/$@$(EXT)" cmd/$@/*.go
2642

27-
28-
test:
43+
test: $(PACKAGE)
2944
go test
30-
cd pkgassets && go test
45+
46+
website:
47+
./mk-website.bash
3148

3249
status:
3350
git status
3451

3552
save:
36-
if [ "$(msg)" != "" ]; then git commit -am "$(msg)"; else git commit -am "Quick Save"; fi
53+
@if [ "$(msg)" != "" ]; then git commit -am "$(msg)"; else git commit -am "Quick Save"; fi
3754
git push origin $(BRANCH)
3855

39-
clean:
40-
if [ -d bin ]; then rm -fR bin; fi
41-
if [ -d dist ]; then rm -fR dist; fi
42-
if [ -d man ]; then rm -fR man; fi
56+
refresh:
57+
git fetch origin
58+
git pull origin $(BRANCH)
4359

60+
publish:
61+
./mk_website.py
62+
bash publish.bash
63+
64+
clean:
65+
@if [ -f version.go ]; then rm version.go; fi
66+
@if [ -d bin ]; then rm -fR bin; fi
67+
@if [ -d dist ]; then rm -fR dist; fi
68+
@if [ -d man ]; then rm -fR man; fi
4469

4570
install: build
46-
env GOBIN=$(GOPATH)/bin go install cmd/cligenerate/cligenerate.go
47-
env GOBIN=$(GOPATH)/bin go install cmd/pkgassets/pkgassets.go
48-
49-
50-
dist/linux-amd64:
51-
mkdir -p dist/bin
52-
env GOOS=linux GOARCH=amd64 go build -o dist/bin/cligenerate cmd/cligenerate/cligenerate.go
53-
env GOOS=linux GOARCH=amd64 go build -o dist/bin/pkgassets cmd/pkgassets/pkgassets.go
54-
cd dist && zip -r $(PROJECT)-$(VERSION)-linux-amd64.zip README.md LICENSE INSTALL.md bin/*
55-
rm -fR dist/bin
56-
57-
dist/windows-amd64:
58-
mkdir -p dist/bin
59-
env GOOS=windows GOARCH=amd64 go build -o dist/bin/cligenerate.exe cmd/cligenerate/cligenerate.go
60-
env GOOS=windows GOARCH=amd64 go build -o dist/bin/pkgassets.exe cmd/pkgassets/pkgassets.go
61-
cd dist && zip -r $(PROJECT)-$(VERSION)-windows-amd64.zip README.md LICENSE INSTALL.md bin/*
62-
rm -fR dist/bin
63-
64-
dist/macos-amd64:
65-
mkdir -p dist/bin
66-
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/cligenerate cmd/cligenerate/cligenerate.go
67-
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/pkgassets cmd/pkgassets/pkgassets.go
68-
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-amd64.zip README.md LICENSE INSTALL.md bin/*
69-
rm -fR dist/bin
70-
71-
dist/macos-arm64:
72-
mkdir -p dist/bin
73-
env GOOS=darwin GOARCH=arm64 go build -o dist/bin/cligenerate cmd/cligenerate/cligenerate.go
74-
env GOOS=darwin GOARCH=arm64 go build -o dist/bin/pkgassets cmd/pkgassets/pkgassets.go
75-
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-arm64.zip README.md LICENSE INSTALL.md bin/*
76-
rm -fR dist/bin
77-
78-
dist/raspbian-arm7:
79-
mkdir -p dist/bin
80-
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/cligenerate cmd/cligenerate/cligenerate.go
81-
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/pkgassets cmd/pkgassets/pkgassets.go
82-
cd dist && zip -r $(PROJECT)-$(VERSION)-raspbian-amd7.zip README.md LICENSE INSTALL.md bin/*
83-
rm -fR dist/bin
71+
@echo "Installing programs in $(PREFIX)/bin"
72+
@for FNAME in $(PROGRAMS); do if [ -f "./bin/$${FNAME}$(EXT)" ]; then cp -v "./bin/$${FNAME}$(EXT)" "$(PREFIX)/bin/$${FNAME}$(EXT)"; fi; done
73+
@echo ""
74+
@echo "Make sure $(PREFIX)/bin is in your PATH"
75+
76+
uninstall: .FORCE
77+
@echo "Removing programs in $(PREFIX)/bin"
78+
@for FNAME in $(PROGRAMS); do if [ -f "$(PREFIX)/bin/$${FNAME}$(EXT)" ]; then rm -v "$(PREFIX)/bin/$${FNAME}$(EXT)"; fi; done
79+
80+
81+
dist/linux-amd64: $(PROGRAMS)
82+
@mkdir -p dist/bin
83+
@for FNAME in $(PROGRAMS); do env GOOS=linux GOARCH=amd64 go build -o "dist/bin/$${FNAME}" cmd/$${FNAME}/*.go; done
84+
@cd dist && zip -r $(PROJECT)-$(VERSION)-linux-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/*
85+
@rm -fR dist/bin
86+
87+
88+
dist/macos-amd64: $(PROGRAMS)
89+
@mkdir -p dist/bin
90+
@for FNAME in $(PROGRAMS); do env GOOS=darwin GOARCH=amd64 go build -o "dist/bin/$${FNAME}" cmd/$${FNAME}/*.go; done
91+
@cd dist && zip -r $(PROJECT)-$(VERSION)-macos-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/*
92+
@rm -fR dist/bin
93+
94+
95+
dist/macos-arm64: $(PROGRAMS)
96+
@mkdir -p dist/bin
97+
@for FNAME in $(PROGRAMS); do env GOOS=darwin GOARCH=arm64 go build -o "dist/bin/$${FNAME}" cmd/$${FNAME}/*.go; done
98+
@cd dist && zip -r $(PROJECT)-$(VERSION)-macos-arm64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/*
99+
@rm -fR dist/bin
100+
101+
102+
dist/windows-amd64: $(PROGRAMS)
103+
@mkdir -p dist/bin
104+
@for FNAME in $(PROGRAMS); do env GOOS=windows GOARCH=amd64 go build -o "dist/bin/$${FNAME}.exe" cmd/$${FNAME}/*.go; done
105+
@cd dist && zip -r $(PROJECT)-$(VERSION)-windows-amd64.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/*
106+
@rm -fR dist/bin
107+
108+
109+
dist/raspberry_pi_os-arm7: $(PROGRAMS)
110+
@mkdir -p dist/bin
111+
@for FNAME in $(PROGRAMS); do env GOOS=linux GOARCH=arm GOARM=7 go build -o "dist/bin/$${FNAME}" cmd/$${FNAME}/*.go; done
112+
@cd dist && zip -r $(PROJECT)-$(VERSION)-raspberry_pi_os-arm7.zip LICENSE codemeta.json CITATION.cff *.md bin/* docs/*
113+
@rm -fR dist/bin
84114

85115
distribute_docs:
86-
mkdir -p dist
87-
cp -v README.md dist/
88-
cp -v LICENSE dist/
89-
cp -v INSTALL.md dist/
90-
./package-versions.bash > dist/package-versions.txt
91-
92-
release: bootstrap distribute_docs dist/linux-amd64 dist/windows-amd64 dist/macos-amd64 dist/macos-arm64 dist/raspbian-arm7
93-
94-
website:
95-
./mk-website.bash
96-
97-
publish:
98-
./mk-website.bash
99-
./publish.bash
100-
116+
@mkdir -p dist/
117+
@cp -v codemeta.json dist/
118+
@cp -v CITATION.cff dist/
119+
@cp -v README.md dist/
120+
@cp -v LICENSE dist/
121+
@cp -v INSTALL.md dist/
122+
@cp -vR docs dist/
123+
124+
release: distribute_docs dist/linux-amd64 dist/macos-amd64 dist/macos-arm64 dist/windows-amd64 dist/raspberry_pi_os-arm7
125+
126+
127+
.FORCE:

cli.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,6 @@ import (
3131
"time"
3232
)
3333

34-
const (
35-
Version = `v0.0.17`
36-
37-
LicenseText = `
38-
%s %s
39-
40-
Copyright (c) 2021, Caltech
41-
All rights not granted herein are expressly reserved by Caltech.
42-
43-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44-
45-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
46-
47-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
48-
49-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
50-
51-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52-
`
53-
)
54-
5534
// v0.0.17 Added go1.16 support
5635
//
5736
// v0.0.16 Verb.AddParams() was renamed Verb.SetParams()

codemeta.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"codeRepository": "https://github.com/caltechlibrary/cli",
77
"issueTracker": "https://github.com/caltechlibrary/cli/issues",
88
"license": "https://data.caltech.edu/license",
9-
"version": "0.0.17",
9+
"version": "0.0.18",
1010
"author": [
1111
{
1212
"@type": "Person",
13-
"givenName": "Robert",
13+
"givenName": "R. S.",
1414
"familyName": "Doiel",
1515
"affiliation": "Caltech Library",
1616
"email": "rsdoiel@caltech.edu",
@@ -27,5 +27,12 @@
2727
"maintainer": "https://orcid.org/0000-0003-0900-6903",
2828
"programmingLanguage": [
2929
"Go"
30-
]
30+
],
31+
"funder": [
32+
{
33+
"@id": "https://doi.org/10.13039/100006961",
34+
"@type": "Organization",
35+
"name": "Caltech Library"
36+
}
37+
]
3138
}

license.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cli
2+
3+
const (
4+
LicenseText = `
5+
%s %s
6+
7+
Copyright (c) 2021, Caltech
8+
All rights not granted herein are expressly reserved by Caltech.
9+
10+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
11+
12+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
13+
14+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19+
`
20+
)

package-versions.bash

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)