Skip to content

Commit

Permalink
prep for v1.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Mar 29, 2023
1 parent b0a0391 commit f40ceaa
Show file tree
Hide file tree
Showing 50 changed files with 654 additions and 132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ dataset.egg-info
py/test_*
idxdefs/*
*.bak
*.json
24 changes: 13 additions & 11 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: crossrefapi
type: software
title: "crossrefapi"
abstract: "A Golang package and command line tool for working with the
public CrossRef API"
authors:
- family-names: Doiel
given-names: Robert
orcid: https://orcid.org/0000-0003-0900-6903
abstract: A Golang package and command line tool for working with the public CrossRef API
orcid: "https://orcid.org/0000-0003-0900-6903"

maintainers:
- family-names: Doiel
given-names: Robert
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/crossrefapi"
type: software
version: 1.0.1-pre
version: 1.0.1
license-url: "https://caltechlibrary/crossrefapi/LICENSE"
keywords:
- CrossRef
- DOI
- GitHub
- metadata
date-released: 2022-07-27
keywords: [ "CrossRef", "DOI", "metadata" ]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2021, Caltech
Copyright (c) 2023, Caltech
All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
42 changes: 21 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ VERSION = $(shell grep '"version":' codemeta.json | cut -d \" -f 4)

BRANCH = $(shell git branch | grep '* ' | cut -d\ -f 2)

MAN_PAGES = $(shell ls -1 *.1.md | sed -E 's/\.1.md/.1/g')

PANDOC = $(shell which pandoc)

PROJECT_LIST = crossrefapi
Expand All @@ -18,7 +20,7 @@ ifeq ($(OS), Windows)
EXT = .exe
endif

build: version.go $(PROJECT_LIST) CITATION.cff about.md
build: version.go man $(PROJECT_LIST) CITATION.cff about.md

version.go: .FORCE
@echo "package $(PROJECT)" >version.go
Expand All @@ -33,20 +35,26 @@ version.go: .FORCE
@echo '' >>version.go
@git add version.go

crossrefapi$(EXT): bin/crossrefapi$(EXT)
crossrefapi$(EXT): bin/crossrefapi$(EXT) CITATION.cff

bin/crossrefapi$(EXT): crossrefapi.go cmd/crossrefapi/crossrefapi.go
bin/crossrefapi$(EXT): crossrefapi.go works.go cmd/crossrefapi/crossrefapi.go
go build -o bin/crossrefapi$(EXT) cmd/crossrefapi/crossrefapi.go
./bin/crossrefapi -help>crossrefapi.1.md

man: $(MAN_PAGES)

$(MAN_PAGES): .FORCE
mkdir -p man/man1
$(PANDOC) $@.md --from markdown --to man -s >man/man1/$@

install:
env GOBIN=$(GOPATH)/bin go install cmd/crossrefapi/crossrefapi.go

website: page.tmpl README.md nav.md INSTALL.md LICENSE css/site.css about.md
bash mk-website.bash
website: page.tmpl codemeta.json README.md INSTALL.md LICENSE css/site.css about.md
make -f website.mak


CITATION.cff: codemeta.json
CITATION.cff: codemeta.json .FORCE
@cat codemeta.json | sed -E 's/"@context"/"at__context"/g;s/"@type"/"at__type"/g;s/"@id"/"at__id"/g' >_codemeta.json
@if [ -f $(PANDOC) ]; then echo "" | $(PANDOC) --metadata title="Cite $(PROJECT)" --metadata-file=_codemeta.json --template=codemeta-cff.tmpl >CITATION.cff; fi

Expand Down Expand Up @@ -74,40 +82,36 @@ clean:
if [ -d bin ]; then rm -fR bin; fi
if [ -d dist ]; then rm -fR dist; fi
if [ -d testout ]; then rm -fR testout; fi
if [ -d man ]; then rm -fR man; fi

man: build
mkdir -p man/man1
bin/crossrefapi -generate-manpage | nroff -Tutf8 -man > man/man1/crossrefapi.1

dist/linux-amd64:
mkdir -p dist/bin
env GOOS=linux GOARCH=amd64 go build -o dist/bin/crossrefapi cmd/crossrefapi/crossrefapi.go
cd dist && zip -r $(PROJECT)-$(VERSION)-linux-amd64.zip README.md LICENSE INSTALL.md bin/*
cd dist && zip -r $(PROJECT)-$(VERSION)-linux-amd64.zip README.md LICENSE INSTALL.md bin/* man/*
rm -fR dist/bin

dist/windows-amd64:
mkdir -p dist/bin
env GOOS=windows GOARCH=amd64 go build -o dist/bin/crossrefapi.exe cmd/crossrefapi/crossrefapi.go
cd dist && zip -r $(PROJECT)-$(VERSION)-windows-amd64.zip README.md LICENSE INSTALL.md bin/*
cd dist && zip -r $(PROJECT)-$(VERSION)-windows-amd64.zip README.md LICENSE INSTALL.md bin/* man/*
rm -fR dist/bin

dist/macos-amd64:
mkdir -p dist/bin
env GOOS=darwin GOARCH=amd64 go build -o dist/bin/crossrefapi cmd/crossrefapi/crossrefapi.go
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-amd64.zip README.md LICENSE INSTALL.md bin/*
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-amd64.zip README.md LICENSE INSTALL.md bin/* man/*
rm -fR dist/bin

dist/macos-arm64:
mkdir -p dist/bin
env GOOS=darwin GOARCH=arm64 go build -o dist/bin/crossrefapi cmd/crossrefapi/crossrefapi.go
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-arm64.zip README.md LICENSE INSTALL.md bin/*
cd dist && zip -r $(PROJECT)-$(VERSION)-macos-arm64.zip README.md LICENSE INSTALL.md bin/* man/*
rm -fR dist/bin

dist/raspbian-arm7:
mkdir -p dist/bin
env GOOS=linux GOARCH=arm GOARM=7 go build -o dist/bin/crossrefapi cmd/crossrefapi/crossrefapi.go
cd dist && zip -r $(PROJECT)-$(VERSION)-raspbian-arm7.zip README.md LICENSE INSTALL.md bin/*
cd dist && zip -r $(PROJECT)-$(VERSION)-raspbian-arm7.zip README.md LICENSE INSTALL.md bin/* man/*
rm -fR dist/bin

distribute_docs:
Expand All @@ -116,10 +120,7 @@ distribute_docs:
cp -v README.md dist/
cp -v LICENSE dist/
cp -v INSTALL.md dist/
bash package-versions.bash > dist/package-versions.txt

update_version:
./update_version.py --yes
cp -vR man dist/

release: clean crossrefapi.go distribute_docs dist/linux-amd64 dist/windows-amd64 dist/macos-amd64 dist/macos-arm64 dist/raspbian-arm7

Expand All @@ -130,8 +131,7 @@ save:
if [ "$(msg)" != "" ]; then git commit -am "$(msg)"; else git commit -am "Quick Save"; fi
git push origin $(BRANCH)

publish:
bash mk-website.bash
publish: website
bash publish.bash


Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@ with the public API at api.crossref.org.
// continue processing your "works" result...
```

You can compare two copies of a "works" response and see what has changed.

```go

appName := path.Base(os.Args[0])
client, err := crossrefapi.NewCrossRefClient(appName, "[email protected]")
if err != nil {
// handle error...
}
newWorks, err := client.Works("10.1037/0003-066x.59.1.29")
if err != nil {
// handle error...
}
// Fetch our previously saved works document.
src, err := os.ReadFile("0003-066x.59.1.29.json")
if err != nil {
// handle error...
}
oldWorks := new(crossrefapi.Works)
if err := json.Unmarshal(src, &oldWorks); err != nil {
// handle error...
}
src, err = oldWorks.DiffAsJSON(newWorks)
if err != nil {
// handle error...
}
fmt.Println("Diff for 10.1037/0003-066x.59.1.29")
fmt.Printf("\n%s\n", src)
```

## Command line example

```
Expand All @@ -30,6 +60,6 @@ with the public API at api.crossref.org.

## Reference

+ [CrossRef API Docs](https://github.com/CrossRef/rest-api-doc)
+ [CrossRef Schemas](https://www.crossref.org/schema/)
+ [CrossRefAPI](https://github.com/fabiobatalha/crossrefapi) - Python implementation
- [CrossRef API Docs](https://github.com/CrossRef/rest-api-doc)
- [CrossRef Schemas](https://api.crossref.org/swagger-ui/index.html)
- [CrossRefAPI](https://github.com/fabiobatalha/crossrefapi) - Python implementation
7 changes: 3 additions & 4 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ authors:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/crossrefapi"
version: 1.0.1-pre
version: 1.0.1
license-url: "https://caltechlibrary/crossrefapi/LICENSE"
keywords: [ "CrossRef", "DOI", "GitHub", "metadata" ]
keywords: [ "CrossRef", "DOI", "metadata" ]

---

About this software
===================

## crossrefapi 1.0.1-pre
## crossrefapi 1.0.1

### Authors

Expand All @@ -34,7 +34,6 @@ CrossRef API

- CrossRef
- DOI
- GitHub
- metadata

### Software
Expand Down
Loading

0 comments on commit f40ceaa

Please sign in to comment.