Skip to content

A rebar plugin for running custom commands

License

Notifications You must be signed in to change notification settings

gootik/rebar_cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rebar_cmd Build Status Hex.pm

Run custom shell commands with rebar3 cmd <command>.

Purpose

The goal of this plugin is to allow rebar3 to run additional commands, so that one can use it solely to manage everything in an Erlang project.

Whether it is bringing Docker containers up, tagging a new Git release or deleting log files, you should be able to use a single build tool.

How it works

This is a very simple and straightforward plugin. Simply describe your command in rebar.config and execute (just like you would Linux aliases) with rebar3 cmd <command>.

Usage

Add the plugin to your rebar.config:

    {plugins, [
        {rebar_cmd, "0.2.6"}
    ]}.

    {commands, [
        {docker_up, "docker-compose up -d"},
        {sync, "git fetch upstream && git merge upstream/master"}
    ]}.

The example above shows you how to describe a command to bring your Docker containers up, as well as another one to sync a Git repository with remote master.

Some options are available, as described below:

  • [{timeout, <Ms>}] (defaults to 15000)
  • [{verbose, <Verbose>}] (defaults to false)

e.g. you could change the previous docker_up command to have it fail after 5s with {docker_up, "docker-compose up -d", [{timeout, 5000}]},. You could also get more info from the shell for the above command sync with {sync, "git fetch upstream && git merge upstream/master", [{verbose, true}]}

Check it out:

$ rebar3 cmd sync
===> Analyzing applications...
===> Compiling rebar_cmd
===> Command sync resulted in: "Already up to date."