Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
runeimp committed Feb 11, 2021
2 parents 1733ffb + bf27a21 commit 772516e
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 17 deletions.
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

# Created by https://www.gitignore.io/api/linux,macos,windows
# Edit at https://www.gitignore.io/?templates=linux,macos,windows

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/linux,macos,windows
70 changes: 70 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: gzipdate
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- freebsd
- linux
- netbsd
- openbsd
- windows
ignore:
- goos: darwin
goarch: 386
ldflags:
- -s -w
main: ./main.go
archives:
- files:
- CHANGELOG.md
- LICENSE
- README.md
format_overrides:
- goos: windows
format: zip
replacements:
386: i386
amd64: x86_64
darwin: macos
# darwin: macOS
# freebsd: FreeBSD
# linux: Linux
# netbsd: NetBSD
# openbsd: OpenBSD
# gzipdate: GzipDate
# windows: Windows
wrap_in_directory: true
nfpms:
# note that this is an array of nfpm configs
- formats:
- deb
- rpm
# ID of the nfpm config, must be unique.
# Defaults to "default".
id: gzipdate
homepage: "https://github.com/runeimp/gzipdate"
license: MIT
replacements:
386: i386
amd64: x86_64
darwin: macos
checksum:
name_template: 'checksums.txt'
# signs:
# - artifacts: checksum
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ChangeLog:
==========

v1.0.0
------

Initial release

* Added all initially planned features
* Added INSTALL.md
* Updated README.md

78 changes: 78 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

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`
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`
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.
* 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
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.


Finding YOUR_PREFERED_PATH (Windows)
------------------------------------

On Windows systems you can review your path list by:

1. Open a Command Prompt
2. Type `ECHO "%PATH:;="&ECHO "%"`


Finding YOUR_PREFERED_PATH (POSIX)
----------------------------------

On POSIX systems (\*BSD, Linux, macOS, Solaris, UNIX, etc.) you can review your path list with

```text
$ echo $PATH | tr : "\n"
/Users/runeimp/.local/bin
/Users/runeimp/bin
/Users/runeimp/dev/lang/go/bin
/opt/local/bin
/usr/local/bin
/usr/local/sbin
/usr/bin
/usr/sbin
/bin
/sbin
```

If you use the command `echo $PATH | tr : "\n"` you should see a list similar to the example with `runeimp` replaced with whatever your username is on the system. Directory search priority is from top to bottom when you type in a command.


### Which Paths to Avoid

On any system there are certain paths you should not install apps into. On POSIX systems any path that ends with `sbin` means system binary. **NEVER** manually install apps into an `sbin` path. Following is a general order of preference when installing apps on a system for all users:

* `/opt/local/bin` - This is generally best as `opt` paths are intended for _option software_ when it is present.
* This is where most package managers will install binaries. If it doesn't exist you should probably install something wonderful like [`just`][] or [`kitty`][] with your package manager to kickstart the path.
* `/usr/local/opt` - This is a good path to use if it exists in your list and `/opt/local/bin` is not available.
* This is where many package managers will install binaries. If it doesn't exist you should probably install something wonderful like [`git`][] or [`wget`][] with your package manager to kickstart the path.
* `/usr/local/bin` - This is a good path to use if neither `opt` path is available. Almost always available on all POSIX systems.
* This is where most package managers will install binaries. If it doesn't exist you should probably install something wonderful like [`jq`][] or [`htop`][] with your package manager to kickstart the path.
* `/usr/bin` - This is acceptable if none of the above paths are available. Though it should be avoided if possible.
* If this seems to be your only option **definitely** try to install something with your package manager if you haven't already. Doing so should create one of the above paths which are _much_ preferred over `/usr/bin`.
* `/bin` - While you could _technically_ install binaries to this path it's a very bad idea. System updates expect full control over this path and may remove or overwrite binaries you install there without warning before hand or notice after the fact.





[`git`]: https://git-scm.com/
[`htop`]: https://hisham.hm/htop/
[`jq`]: https://stedolan.github.io/jq/
[`just`]: https://github.com/casey/just
[`kitty`]: https://sw.kovidgoyal.net/kitty/
[`wget`]: https://www.gnu.org/software/wget/

71 changes: 71 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
PROJECT_NAME := "GzipDate"

alias arc := archive

@_default:
just _term-wipe
just --list

# Archive GoReleaser dist
archive:
#!/bin/sh
just _term-wipe
tag="$(git tag --points-at master)"
app="{{PROJECT_NAME}}"
arc="${app}_${tag}"

# echo "app = '${app}'"
# echo "tag = '${tag}'"
# echo "arc = '${arc}'"
if [ -e dist ]; then
echo "Move dist -> distro/${arc}"
mv dist "distro/${arc}"

# echo "cd distro"
cd distro

printf "pwd = "
pwd

ls -Alh
else
echo "dist directory not found for archiving"
fi

# Build and install app
build:
@just _term-wipe
go build -o gzipdate main.go
mv gzipdate "${GOBIN}/"
@# go install main.go


# Build distro
distro:
#!/bin/sh
goreleaser
just archive


# Run code
run +args='':
@just _term-wipe
go run main.go {{args}}


_term-wipe:
#!/bin/sh
if [[ ${#VISUAL_STUDIO_CODE} -gt 0 ]]; then
clear
elif [[ ${KITTY_WINDOW_ID} -gt 0 ]] || [[ ${#TMUX} -gt 0 ]] || [[ "${TERM_PROGRAM}" = 'vscode' ]]; then
printf '\033c'
elif [[ "$(uname)" == 'Darwin' ]] || [[ "${TERM_PROGRAM}" = 'Apple_Terminal' ]] || [[ "${TERM_PROGRAM}" = 'iTerm.app' ]]; then
osascript -e 'tell application "System Events" to keystroke "k" using command down'
elif [[ -x "$(which tput)" ]]; then
tput reset
elif [[ -x "$(which reset)" ]]; then
reset
else
clear
fi

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 RuneImp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 772516e

Please sign in to comment.