Public | Automated Build

Last pushed: a year ago
Short Description
DEPRECATED: Please use the nib Ruby gem -
Full Description


nib is a docker-compose wrapper geared towards Ruby/Rails development.


To install:

> gem install nib


If there is an update available it's a good idea to remove the current version before installing the new version. If you skip the uninstall then gem update nib will install the new version along side the existing version.

> gem uninstall -ax nib && gem install nib


nib can be used as a replacement for docker-compose any commands that it does not recognize will be delegated to docker-compose.

The commands provided by nib are intended to provide a convenient and practical workflow for development, for example:

> nib shell web
  1. nib will start up a container for the web service and drop you into an interactive shell session (bash, ash or sh) depending on which shell is available.
  2. nib will also hook up a history file for your shell session (relative to the current project). This means that you will be able to use the history (up arrow) in future shell sessions, something that is not available with vanilla docker/docker-compose!
  3. Finally nib will ensure that the container is removed after you finish with the shell session

Some commands can have their behavior changed relative to a particular project. As an example - nib console expects a Ruby like environment (rails console or pry etc) by default but it can be augmented by adding a custom script on the host system ($pwd/bin/console)

Other commands like nib rake or nib guard behave as expected without the option to change the behavior.

For additional information and a list of supported commands review the help system.

> nib help


nib can help facilitate remote debugging of a running byebug server inside of a rails application. In order to make this work there are a couple of steps you'll need to take first.

Add the byebug gem to your Gemfile if it's not already present.

# Gemfile
gem 'byebug'

Enable byebug server for development. This will default the port to 9005 but that can be overridden by setting the RUBY_DEBUG_PORT environment variable (see below).

# config/envrionments/development.rb
require 'byebug/core'
Byebug.start_server '', (ENV.fetch 'RUBY_DEBUG_PORT', 9005).to_i

Expose the desired port and specify the RUBY_DEBUG_PORT environment variable (overrides the default).

# docker-compose.yml
    - "3001:3001"
    - "RUBY_DEBUG_PORT=3001"

Once all of this is in place and the web service is up and running (nib up) you can use the debug command to attach to the remote debugger.

> nib debug web

Running Specs

This project includes rspec and serverspec to help facilitate execution of automated tests. Running the tests is as simple as:

nib build # the first time (you are using `nib` right?)
nib rspec gem

Generating Docs

If you have added a new command you will want to regenerate the commands document. The following command should get that done:

docker run \
  --rm \
  -v $PWD:/usr/src/app \
  -w /usr/src/app \
  ruby:alpine bin/update_docs


nib is work of several contributors. You're encouraged to submit pull requests, propose features and discuss issues.



MIT License. See LICENSE for details.

Docker Pull Command
Source Repository