Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
runeimp committed Apr 14, 2021
2 parents 772516e + 7aa1d24 commit 2a245bb
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 69 deletions.
8 changes: 8 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ before:
builds:
- env:
- CGO_ENABLED=0
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 6
- 7
goos:
- darwin
- freebsd
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
ChangeLog:
==========

v1.1.0
------

* Added option to add timezone to datetime in filename
* Added option to base the datetime on the modification time of the file being compressed
* Added unit testing
* Updated option parsing
* Updated help display
* Updated docs


v1.0.0
------

Expand Down
14 changes: 7 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Installation
1. Download a release from `https://github.com/runeimp/gzipdate/releases`
2. For archives or packages:
* For Zip archives (`.zip`) I recommend:
1. `unzip gzipdate_1.0.1_windows_x86_64.zip`
2. `cd gzipdate_1.0.1_windows_x86_64`
1. `unzip gzipdate_1.1.0_windows_x86_64.zip`
2. `cd gzipdate_1.1.0_windows_x86_64`
3. `copy gzipdate.exe YOUR_PREFERED_PATH`
* For Tar-Gzip archives (`.tar.gz`) I recommend:
1. `tar xfz gzipdate_1.0.1_freebsd_x86_64.tar.gz`
2. `cd gzipdate_1.0.1_freebsd_x86_64`
1. `tar xfz gzipdate_1.1.0_freebsd_x86_64.tar.gz`
2. `cd gzipdate_1.1.0_freebsd_x86_64`
3. `cp gzipdate YOUR_PREFERED_PATH` or `ln -s gzipdate YOUR_PREFERED_PATH/gzipdate` if your source folder is not going to get deleted later.
* For the Debian packages (`.deb`) I recommend:
* `sudo dpkg -i /path/to/gzipdate_1.0.1_linux_x86_64.deb` to install and upgrade. There are no dependencies so dpkg is fine for this task.
* `sudo dpkg -i /path/to/gzipdate_1.1.0_linux_x86_64.deb` to install and upgrade. There are no dependencies so dpkg is fine for this task.
* For the RedHat Package Manager (`.rpm`) I recommend:
* `rpm -i /path/to/gzipdate_1.0.1_linux_x86_64.rpm` to install
* `rpm -U /path/to/gzipdate_1.0.1_linux_x86_64.rpm` to upgrade
* `rpm -i /path/to/gzipdate_1.1.0_linux_x86_64.rpm` to install
* `rpm -U /path/to/gzipdate_1.1.0_linux_x86_64.rpm` to upgrade
3. Copy the binary to a directory in your PATH and make sure it is executable for your system. It _should_ be ready to go by default.


Expand Down
18 changes: 17 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ alias arc := archive
archive:
#!/bin/sh
just _term-wipe
tag="$(git tag --points-at master)"
tag="$(git tag --points-at main)"
app="{{PROJECT_NAME}}"
arc="${app}_${tag}"

# echo "app = '${app}'"
# echo "tag = '${tag}'"
# echo "arc = '${arc}'"
if [ ! -e distro ]; then
mkdir distro
fi
if [ -e dist ]; then
echo "Move dist -> distro/${arc}"
mv dist "distro/${arc}"
Expand Down Expand Up @@ -53,6 +56,19 @@ run +args='':
go run main.go {{args}}


# Run a test
@test cmd="coverage":
just _term-wipe
just test-{{cmd}}

# Run Go Unit Tests
@test-coverage:
just _term-wipe
echo "You need to run:"
echo "go test -coverprofile=c.out"
echo "go tool cover -func=c.out"


_term-wipe:
#!/bin/sh
if [[ ${#VISUAL_STUDIO_CODE} -gt 0 ]]; then
Expand Down
46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
GzipDate
========
GzipDate v1.1.0
===============

Simple command line app for the specific creation and handling of Gzip archives.


Features
--------

* Create gzip archives for each of a list of files, adding a file system safe [ISO-8601][ISO 8601 - Wikipedia] datatime value to the filename when creating the archive. The format is `YYYY-MM-DD_HHmmss`.
* Create gzip archives for each of a list of files, adding a file system safe [ISO-8601][ISO 8601 - Wikipedia] datatime value to the filename when creating the archive.
* The format is either `YYYY-MM-DD_HHmmss_TZ` or `YYYY-MM-DD_HHmmss`.
* The default is `YYYY-MM-DD_HHmmss` but in v1.1+ you can use `YYYY-MM-DD_HHmmss_TZ` by specifying an environment variable `GZIPDATE=TIMEZONE` or `GZIPDATE=TZ`, or using the option `-t`, `-tz`, `-timezone`, or `--timezone` for a single execution.
* The default datetime is based on the current system time. But you can specify to use the modification time of the file with the options `-f`, `-file`, `-file-date`, or `--file-date`
* Extract the archived file from Gzip archives restoring their original names if available. The original name is always available for archives created by GzipDate.
* Does not delete source files by default. Though they can be automatically deleted with a command line switch.
* Always uses maximum compression when creating archives
Expand All @@ -20,43 +23,53 @@ Usage Examples

### Help

```text
$ gzipdate -h
GzipDate v1.0.0
```bash
runeimp$ gzipdate -h
GzipDate v1.1.0

USAGE: gzipdate [OPTIONS] [FILENAMES]

OPTIONS:
-d | -del | -delete Delete the source file after successful processing
-h | -help Display this help info
-v | -ver | -version Display this apps version number
-d | -del | --delete Delete the source file after processing
-f | -file | --file-date Use the files modification time for the date
instead of the current time
-h | -help | --help Display this help info
-t | -tz | --timezone Turn the timezone feature on
-v | -ver | --version Display this apps version number
-- Disable option parsing and consider all following
arguments as file names only


Options are not position dependent and may be interspersed with file names.
POSIX options in the first column can be grouped together with the exception
of -h and -v which must be independent. Long options in the third column can
use a Multics style single hyphen prefix or the Gnu style double hyphen prefix
as displayed.

Options may be interspersed with file names if so desired.
They are not position dependent.
```

### Brogue Save Game Backup

```text
```bash
runeimp$ ls -hl
total 112
-rw-r--r-- 1 runeimp staff 54K Apr 16 10:33 Saved game.broguesave

runeimp$ gzipdate -d *
Saving 21400 bytes from "Saved game.broguesave" to "Saved game.broguesave_2020-04-16_104846.gz"
runeimp$ gzipdate -dt *
Saving 21400 bytes from "Saved game.broguesave" to "Saved game.broguesave_2020-04-16_104846_PST.gz"
Deleting source: "Saved game.broguesave"

runeimp$ ls -hl
total 48
-rw-r--r-- 1 runeimp staff 21K Apr 16 10:48 Saved game.broguesave_2020-04-16_104846.gz
-rw-r--r-- 1 runeimp staff 21K Apr 16 10:48 Saved game.broguesave_2020-04-16_104846_PST.gz

runeimp$ gzipdate *.gz
54984 B written to "Saved game.broguesave"

runeimp$ ls -hl
total 160
-rw-r--r-- 1 runeimp staff 54K Apr 16 10:33 Saved game.broguesave
-rw-r--r-- 1 runeimp staff 21K Apr 16 10:48 Saved game.broguesave_2020-04-16_104846.gz
-rw-r--r-- 1 runeimp staff 21K Apr 16 10:48 Saved game.broguesave_2020-04-16_104846_PST.gz
```

Note that the size and date of "Saved game.broguesave" is the same in the original as in the version restored from the archive.
Expand All @@ -76,5 +89,6 @@ Installation
See the [installation docs](INSTALL.md)



[ISO 8601 - Wikipedia]: https://en.wikipedia.org/wiki/ISO_8601

1 change: 1 addition & 0 deletions distro/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/runeimp/gzipdate

go 1.14

require golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Loading

0 comments on commit 2a245bb

Please sign in to comment.