Gem Version Build Status Coverage Status Dependency Status Code Climate


Zachary's Tool Kit contains a collection of reusable classes meant to simplify development of complex systems in Ruby. These classes provide functionality I often find myself needing from project to project. Instead of reinventing the wheel each time, I've started building a collection of reusable classes. Easy-bake DSLs, parallel processing, complex logging, templating and many other useful design patterns, for example are all contained in simple, reusable classes with a common interface and configuration style.


Add this line to your application's Gemfile:

gem 'ztk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ztk

Then run the pry console to play with it:

$ bundle exec ztk


This mixin module gives you the ability to easily add ANSI colors to strings. It also has a method for stripping all ANSI codes out of a string. Read more at the ZTK::ANSI documentation.

Easily run a processes in the background. Read more at the ZTK::Background documentation.

Benchmark your code and optionally display messages and/or an "activity" indicator (i.e. spinning cursor). Read more at the ZTK::Benchmark documentation.

Execute local commands controlling STDOUT, STDERR and STDIN as needed plus enhanced Logger support. Read more at the ZTK::Command documentation.

Use Ruby based configuration files with ease. Inspired by Chef's mixlib-config. Read more at the ZTK::Config documentation.

Create your own DSL in seconds by inheriting this DSL class. Featuring ActiveRecord style associations where DSL objects can belong_to or has_many other DSL objects. Read more at the ZTK::DSL::Base documentation.

Search for files or directories backwards up the present working directory tree. Read more at the ZTK::Locator documentation.

Based off the core Ruby logger, this is meant to be a drop in replacement. Features added logging information, including PID, uSec time resolution, method and line numbers of logging statements (i.e. the caller). One can seamlessly chain Ruby loggers using ZTK:Logger, for example to output logs to both STDOUT and a log file on disk at the same time; all while maintaining compatibility with the core Ruby logger. Read more at the ZTK::Logger documentation.

Easily turn linear iterative tasks into parallel tasks and leverage multiple cores to speed up processing of your large sets of data. Read more at the ZTK::Parallel documentation.

Build timing profiles easily with this class. Allows for arbitrary nesting of profiles and provides full reporting. Read more at the ZTK::Profiler documentation.

Console based reporting class which allows you to easily output either list or spreadsheet based reports from sets of data. Read more at the ZTK::Report documentation.

Certain cases warrant retries when exceptions occur. With this class you can wrap code allowing retries in certain scenarios. The class allows for full customization so you can fit it easily to your needs. Read more at the ZTK::RescueRetry documentation.

The spinner ZTK::Benchmark relies on. With this class you can bend it to YOUR will! Read more at ZTK::Spinner documentation.

An SSH class that nicely wraps up all of the SSH gems into a nice uniform interface, complete with transfer progress callbacks and enhanced Logger support. It is meant to function as a drop in replacement, but I admit this has not been heavily tested like in the case of the ZTK::Logger class. It provides the ability to switch between SCP and SFTP for file transfers seamlessly. Full SSH proxy support as well, plus methods to spawn up interactive SSH consoles via Kernel.exec. Read more at the ZTK::SSH documentation.

This class provides a convient way to test if something is listening on a TCP port. One can test a varity of scenarios, including sending data across the socket and waiting for a response. Read more at the ZTK::TCPSocketCheck documentation.

Easily create Erubis based content with this class. Read more at the ZTK::Template documentation.

UI management; this class encapsulates STDOUT, STDERR, STDIN and a Ruby logger; as well as some other helpful flags. This allows you to easily present a unified UI interface and allows for easy redirection of that interface (really helpful when using StringIO's with rspec to test program output for example). Read more at the ZTK::UI documentation.


I await your pull request.








ZTK - Zachary's Tool Kit

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.