Skip to content

A rebar3 plugin for running shell commands (os:cmd)

License

Notifications You must be signed in to change notification settings

erlsci/rebar3_oscmd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Erlang Versions Tags

rebar3_oscmd

Run custom shell commands with rebar3 oscmd <shell command>

Purpose

The goal of this plugin is to allow rebar3 to run additional commands via the system shell, 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.

Note about the fork: this project differs from the original in a few minor ways:

  • No uncessary, old, or broken deps
  • Latest version of Erlang is supported in CI/CD
  • More explicit project name (mostly just to avoid confusion in Hex.pm)

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 oscmd <shell command>.

Usage

Add the plugin to your rebar.config:

    {plugins, [
        {rebar3_oscmd, "0.5.0"}
    ]}.

    {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 oscmd sync
===> Analyzing applications...
===> Compiling rebar3_oscmd
===> Command sync resulted in: "Already up to date."

About

A rebar3 plugin for running shell commands (os:cmd)

Resources

License

Stars

Watchers

Forks

Languages

  • Erlang 100.0%