Kit

A framework for making simple management tools called kits.

Write your shell scripts in beautiful Ruby, put them in a kit, and keep them DRY.

What is Kit?

Kit is written using Active Record, so if you have worked with Rails, then Kit should feel familiar.

Each kit keeps track of a set of objects (the bits) and info about them. Bits know how to preform actions you create for them, and can be put into groups so each type of bit can have its own set of actions. Users and permissions can be set to control access to bits and actions.

Kit supports a robust action queue though Delayed_job. One process can be responsible for queuing tasks and another for running them.

Example use scenario

What can you use kit for? Here is an example a web server admin might be familiar with.

Say you are running Apache with multiple virtual hosts (vhosts). You are constantly adding new domain names, updating their configurations, etc. Here is how a Kit could manage the vhosts.

  • Each vhost is a bit.

  • Actions might look like

    vhost.create                 #=> set up directory structure
    vhost.generate_apache_config #=> generate new apache config files from ERB template
    vhost.online                 #=> make website accessible
    vhost.offline                #=> set a static 'site is down' page
    vhost.destroy                #=> remove all trace of the vhost
    
  • By grouping the vhosts, each action can depend on the type of web application the vhost will be running.

  • Kit can store metadata about the vhosts which you can use when defining actions.

Installation

Add this line to your application’s Gemfile:

gem 'kit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kit

Getting started with kit

Documentation

Kit basics

To use Kit, you will need a kit. You can either

If you skipped the above links and just want to get started, run

$ mkdir my_kit && cd my_kit && git init && git pull git://github.com/razor-x/skeleton-kit.git

Once you have a kit, navigate to the root directory and run

$ rake db:migrate

This will set up the database. Create an action by adding a method to the KitActionsDefault module located in actions/default.rb.

Open the kit

require 'kit'
Kit.open 'config.yml'

and make a new bit.

Kit::Bit.create :name => 'lilac'

Now you can call the action with

Kit::Bit.find_by_name('lilac').plant_seeds

If you got this far, refer to the documentation listed above for more examples of what kit can do.

Development

Source Repository

The Kit source is currently hosted at github. To clone the project run

$ git clone git://github.com/razor-x/kit.git

After cloning, you can run yard to generate documentation for the source

$ cd kit
$ yard

You will also need to set up the test-kit to run specs. Do this with

$ rake develop:prepare

License

Kit is licensed under the MIT license.

Warranty

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.