Lazy scripting in Ruby.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples Finalising the documented template Jul 13, 2015
lib closes stdin in shellcmd to prevent some commands for hanging May 22, 2018
spec Adding tests for instance methods Jul 12, 2015
.gitignore initial commit Oct 22, 2014
.travis.yml Updating changelog for 0.2.2 Jul 12, 2015
Gemfile initial commit Oct 22, 2014
LICENSE.txt initial commit Oct 22, 2014 Fix Jul 15, 2015
Rakefile initial commit Oct 22, 2014
scriptster.gemspec Updating the gemspec and bumping the version Jul 11, 2015


Gem Version Inline docs Build Status

Scriptster is a small Ruby gem that will help you write scripts in Ruby. It only consists of two functions and it's especially useful for apps which depend on many external tools.

Example output

This library focuses on these two basic things:

  • Running shell commands
  • Providing nice logs and status messages about what happened

See the examples bellow.


require 'scriptster'

It's not necessary to configure scriptster before using it, if you're happy with the default settings. But chances are you won't be, in which case the configure method is exactly what you're after. Bellow is a quick example (for the full list of options, please refer to the docs):

Scriptster::configure do |conf| = "my-script"
  conf.verbosity = :verbose
  conf.file = nil
  conf.colours = :dark
  conf.log_format = "%{timestamp} %{name} %{type} %{message}"

The following snippet demonstrates how can you use scriptster in practice:

Scriptster::log :info, "Checking branches"

git_cmd = Scriptster::cmd "git branch",
  :show_out => true,
  :show_err => true

branch = "develop"
branch_exists = git_cmd.out.split("\n").grep(/#{branch}/).length > 0
Scriptster::log(:warn, "Branch '#{branch}' not found") unless branch_exists

The first log method will format and print a status message to stdout. The latter cmd method executes the given git command, prints it's output, but it also keeps it for processing. You will find more about the options and parameters of these functions in the documentation.


Add this line to your application's Gemfile:

gem 'scriptster'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scriptster


  1. Fork it ([my-github-username]/scriptster/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request