+Makefile

+init script
+packaging hints
~adjust Travis script to prepare for the tests
This commit is contained in:
Daniel Maslowski 2016-04-20 11:12:33 +02:00
parent e813978fab
commit eb25045c94
4 changed files with 64 additions and 2 deletions

View file

@ -4,5 +4,8 @@ before_install:
- sudo apt-get update
- sudo apt-get -y install fish
script:
- bin/install
- fish -c "fisher i fishery/fishtape; fishtape test/*.fish"
- sudo make install
- mkdir -p ~/.config/fish
- echo "source /usr/share/fish/config-fisherman.fish" >> ~/.config/fish/config.fish
- fish -c "fisher i fishtape"
- fish -c "fishtape test/*.fish"

25
Makefile Normal file
View file

@ -0,0 +1,25 @@
sharepath = $(DESTDIR)/usr/share
fishpath = $(sharepath)/fish
fisherpath = $(sharepath)/fisherman
manpath = $(sharepath)/man
.PHONY: all
all:
.PHONY: install
install:
# prepare directories because install -Dt won't do it on the CI server
mkdir -p "$(fisherpath)/completions" "$(fisherpath)/functions"
# the main config, which can be sourced by the user
install -Dm 644 config-fisherman.fish "$(fishpath)/config-fisherman.fish"
install -Dm 644 config.fish "$(fisherpath)/config.fish"
install -Dm 644 config-fisherman.fish "$(fishpath)/config-fisherman.fish"
# completions
install -Dt "$(fisherpath)/completions" completions/*
# functions
install -Dt "$(fisherpath)/functions" functions/*
# man pages, README and LICENSE
install -Dt "$(manpath)/man1" man/man1/*
.PHONY: clean
clean:

View file

@ -27,6 +27,19 @@
curl -sL get.fisherman.sh | fish
```
## Packaging
Fisherman supports the [DESTDIR convention](https://www.gnu.org/prep/standards/html_node/DESTDIR.html). Using the Makefile (`DESTDIR` should be adjusted with respect to your OS/distribution or simply not provided):
```bash
make install DESTDIR=/path/to/stage
```
### Usage prerequisites
In order for users who install the package to actually use Fisherman, they need to source the provided `/usr/share/fish/config-fisherman.git`. In your package, you should thus provide a hint such as the following:
Please run `echo "source /usr/share/fish/config-fisherman.git" >> ~/.config/fish/config.fish` to enable Fisherman for your current user.
## Usage
Install plugins.

21
config-fisherman.fish Normal file
View file

@ -0,0 +1,21 @@
# If fisher_home is not provided, use the global directory:
set -q fisher_home; or set -g fisher_home (dirname (status -f))/../fisherman
# If fisher_config is not provided, set it up:
set -q fisher_config
or if test ! -z "$XDG_CONFIG_HOME"
set -g fisher_config $XDG_CONFIG_HOME/fisherman
else
# if XDG home is unset or empty, use ~/.config as a fallback
set -g fisher_config ~/.config/fisherman
end
# To not break fish, we need to make sure the config dir exists:
if test ! -d "$fisher_config"
echo "Setting up Fisherman config dir..."
mkdir -p "$fisher_config/cache"
touch "$fisher_config/fishfile"
echo "Done."
end
source "$fisher_home/config.fish"