dssg/install-cli

Name: install-cli

Owner: Data Science for Social Good

Description: Bash library for guided installation & bootstrapping

Created: 2018-03-01 16:29:35.0

Updated: 2018-04-23 00:29:34.0

Pushed: 2018-03-14 20:45:37.0

Homepage: null

Size: 12

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

install-cli

A Bash library for guided project bootstrapping & installation.

Why install-cli?

install-cli removes the boilerplate of providing a friendly, guided installation & bootstrapping script, such that with a minimum of shell scripting, you can provide your project with its optimal environment, and get straight away to working with the languages and tools you really want.

What isn't install-cli?

install-cli is not intended to handle all project building/installation/maintenance tasks. Depending on your project, it might not be appropriate to use this library to build your project at all.

Rather, this library is intended to provision the environment your project requires, either for building or execution.

If your project requires compilation via make, you might like to use install-cli to ensure make is installed.

Or, (this library's original impetus), your project might require a command-definition tool such as argcmdr, for building, maintenance, execution, etc. Use install-cli to ensure the appropriate version of Python is installed, as well as the argcmdr library.

Use

Simply copy install.example into your project, e.g. as an executable file install, and extend it for your purposes.

The main utility of install-cli is the function require:

require REQUIREMENT-NAME CHECK-FN [INSTALL-FN] [INSTALL-TEXT]

For example, the below will check that pyenv is installed, and install it if not:

exists_pyenv() {
  icli::check_command pyenv
}

install_pyenv() {
  curl -#L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
}

require pyenv \
  exists_pyenv \
  install_pyenv \
  --fail-prefix="not found"

An install file, extended by the above, will prompt the user with output like the following:

(install) begin

(pyenv) not found ? install?
1) yes, install {curl -#L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash}
2) no, ignore
#?

See install.example for more information.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.