2
0
mirror of https://github.com/bpkg/bpkg synced 2024-11-08 01:10:36 +00:00
Go to file
Alexandre Dantas 9813d715a9 Fixed basename error on bpkg --help
Added basename option to support multiple arguments
2014-06-03 00:51:58 -03:00
lib Add bpkg-init script 2014-05-29 11:42:41 -04:00
bpkg init 2014-05-22 15:52:58 -04:00
bpkg-init Add bpkg-init script 2014-05-29 11:42:41 -04:00
bpkg-install init 2014-05-22 15:52:58 -04:00
bpkg-json init 2014-05-22 15:52:58 -04:00
bpkg-package init 2014-05-22 15:52:58 -04:00
bpkg-suggest Add suggest and show helpful commands in help menu 2014-05-25 17:19:13 -04:00
bpkg-term add term 2014-05-24 13:05:32 -04:00
bpkg.sh Fixed basename error on bpkg --help 2014-06-03 00:51:58 -03:00
install.sh fix install script 2014-05-25 16:34:13 -04:00
LICENSE Initial commit 2014-05-22 12:52:28 -07:00
Makefile Add suggest and show helpful commands in help menu 2014-05-25 17:19:13 -04:00
package.json prevent sourcing bpkg and bump minor 2014-05-29 12:45:24 -04:00
README.md more info in readme about new installs 2014-05-27 19:31:43 -04:00

bpkg

Lightweight bash package manager

install

Install script:

$ curl -Lo- https://raw.githubusercontent.com/bpkg/bpkg/master/install.sh | bash

clib:

$ clib install bpkg/bpkg

source:

$ git clone https://github.com/bpkg/bpkg.git
$ cd bpkg
$ make install

usage

installing package

global:

$ bpkg install term -g

project: (installs into deps/)

$ bpkg install term

versioned:

$ bpkg install jwerle/suggest.sh@0.0.1 -g

note: Versioned packages must be tagged releases by the author.

installing packages without a package.json:

As long as there is a Makefile in the repository it will try to invoke make install so long as the -g or --global flags are set when invoking bpkg install.

One could install git-standup with an omitted package.json because of the Makefile and the install target found in it.

$ bpkg install stephenmathieson/git-standup -g

    info: Using latest (master)
    warn: Package doesn't exist
    warn: Mssing build script
    warn: Trying `make install'...
    info: install: `make install'
cp -f git-standup /usr/local/bin

package info

From the root of a package directory:

$ bpkg package name
 "bpkg"
$ bpkg package version
 "0.0.5"
$ bpkg package
["name"]        "bpkg"
["version"]     "0.0.5"
["description"] "Lightweight bash package manager"
["global"]      true
["install"]     "make install"

package.json

name

The name attribute is required as it is used to tell bpkg where to put it in the deps/ directory in you project.

  "name": "my-script"

version

The version attribute is not required but can be useful. It should correspond to the version that is associated with the installed package.

  "version": "0.0.1"

description

A human readable description of what the package offers for functionality.

  "description": "This script makes monkeys jump out of your keyboard"

global

Indicates that the package is only intended to be install as a script. This allows the ommition of the -g or --global flag during installation.

  "global": "true"

install

Shell script used to invoke in the install script. This is required if the global attribute is set to true or if the -g or --global flags are provided.

  "install": "make install"

scripts

This is an array of scripts that will be installed into a project.

  "scripts": ["script.sh"]

best practices

package exports

Its nice to have a bash package that can be used in the terminal and also be invoked as a command line function. To achieve this the exporting of your functionality should follow this pattern:

if [[ ${BASH_SOURCE[0]} != $0 ]]; then
  export -f my_script
else
  my_script "${@}"
  exit $?
fi

This allows a user to source your script or invoke as a script.

$ ./my_script.sh some args --blah

or

$ source my_script.sh
$ my_script some more args --blah

license

MIT