Skip to content

Latest commit

 

History

History
115 lines (84 loc) · 3.58 KB

INSTALL.md

File metadata and controls

115 lines (84 loc) · 3.58 KB

Installing Bashcov

Installation as a Ruby gem

Bashcov is distributed as a Ruby gem -- that is, as a software package for the Ruby programming language. It is hosted on https://rubygems.org/ and is installable with tools distributed with Ruby itself.

Prerequisites

  • Ruby (installation instructions here).
  • Development tools (primarily, a C compiler and make). These are needed because certain of Bashcov's Ruby gem dependencies include native extensions that must be compiled for your host platform. Installation instructions are OS- and distribution-specific; please consult your OS and/or distribution's documentation.

Installation with the gem command

The gem executable is included with the Ruby distribution. To install Bashcov for your current user, run:

$ gem install bashcov

Now you can run Bashcov with:

$ bashcov -- <your-bash-script> <and-options>

Installation with Bundler

Bundler, an environment manager for Ruby, is included in (quoting the https://bundler.io/ landing page) "[a]ny modern distribution of Ruby". To install Bashcov with Bundler, create a file named Gemfile in your project's top-level directory and ensure it contains the following:

source 'https://rubygems.org'
gem 'bashcov'

Then, run this to install Bashcov (and the other gems specified in your Gemfile):

$ bundle install

Finally, to run Bashcov, execute:

$ bundle exec bashcov -- <your-bash-script> <and-options>

For more on Bundler, please see its "Getting Started" guide.

Installation with the Nix package manager

Bashcov is available using the Nix package manager. Specifically, Bashcov exposes a Nix flake (a sort of supercharged package) consumable via various subcommands of the nix command line tool.

Running Bashcov as a Nix application

You can use Nix to run Bashcov without first explicitly installing it:

$ nix run 'github:infertux/bashcov' -- <your-bash-script> <and-options>

Adding Bashcov to a Nix shell environment

You can start a shell with Bashcov available like so:

$ command -v bashcov || echo ':(' 1>&2
:(
$ nix shell 'github:infertux/bashcov'
$ command -v bashcov || echo ':(' 1>&2
/nix/store/ns3phdbmfxkf6xqbz0lzha0846ngbmwc-bashcov-3.0.2/bin/bashcov

Incorporating Bashcov into your Nix flake

You can incorporate Bashcov into your own flake by declaring it as an input and then referencing its output attribute packages.<system>.bashcov. For instance, to include Bashcov in a nix develop environment, you could do something like the following:

# flake.nix

{
  inputs = {
    bashcov.url = "github:infertux/bashcov";
    bashcov.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs @ { nixpkgs, bashcov, ... }: let
    system = "x86_64-linux";
  in {
    devShells.${system}.default = nixpkgs.legacyPackages.${system}.mkShell {
      packages = [inputs.bashcov.packages.${system}.bashcov];
    };
  };
}

Now, when you execute nix develop from within your flake project, the bashcov command will be available in your environment.