Project

cknife

0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
A collection of command line tools, especially for popular API services.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 2.0

Runtime

>= 4.2.9
~> 3.0
< 3.0
>= 0.6.6
~> 2.2.3
~> 2.5.5
>= 0.1, ~> 0
>= 1.10.4, ~> 1
>= 1.8.0, ~> 1
>= 0.14, ~> 0
 Project Readme

Gem Version

Quickstart

cknife is a set of command line tools. They...do different things.

> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> gem install cknife

Create $CWD/tmp/cknife.yml and put in a AWS key-secret pair:

---
key: AKIAblahblahb...
secret: 8xILhOsecretsecretsecretsecret...

Then invoke the cknifeaws tool.

> cknifeaws afew your-bucket-name

That will show you a few files in that Amazon S3 bucket of yours named your-bucket-name.

> cknifeaws afew my-bucket --count=50

That will show you 50 of them. You can see the help for this command, too.

> cknifeaws help

See the Wiki for details on the tools cknife has. A complete list of the tools is below under 'usage'.

Requirements

  • Ruby >= 2.4. Older versions work to some extent with older rubies.

The cknife executables are implemented with the Ruby Thor gem.

Installation

Install Ruby and possibly bundler:

> \curl -sSL https://get.rvm.io | bash -s stable --ruby
> gem install bundler

Add cknife to a Gemfile.

source "http://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "cknife", '~> 1.1.0'

Run bundle.

> bundle

Usage

The cknife tools make use of a common configuration file. It uses a YAML format. It is named cknife.yml and the tools look for it in these two places, in order:

  • $CWD/cknife.yml
  • $CWD/tmp/cknife.yml

Here are the command line executables:

  • cknifeaws - AWS wrappers.
  • cknifemail - SMTP email sender.
  • cknifemon - Daemon that sends heartbeat signals to a place of your choosing.
  • cknifemysql - MySQL utilities.
  • cknifepg - PostgreSQL utilities.
  • cknifewcdir - Lines-of-code calculator.
  • cknifedub - Spot directories that are particularly space-consuming.
  • cknifenowtimestamp - Get a now() timestamp string.

You can invoke any of them like this:

bundle exec cknifeaws

Security Awareness

Since the cknife.yml holds sensitive information in the name of convenience, you may choose to erase it after you're done with what you're doing with it. It depends on your use, of course. You probably want to add it to your .gitignore file if you're using it on a per-project basis.

Development

Making a release

One of the following, like patch. This will create a git commit.

bundle exec rake version:bump:major
bundle exec rake version:bump:minor
bundle exec rake version:bump:patch

Do a git flow release. Create the gem spec and commit it:

bundle exec rake gemspec:generate
git commit -am "Generated gemspec for version 1.3.0"

Do a git flow finish release. Push to github. You can then do a release to Rubygems. This command will try to generate the gemspec, but nothing will happen since the gemspec is already valid.

rake release

Building Locally (Optional)

You may build a local gem:

bundle exec rake build

And remove it:

rm pkg/cknife-0.1.6.gem

Invoking commands without clobbering the gemspec

You can uncommente the 'gem cknife' line in the Gemfile.

Then you can invoke the executables as you work on them.

Do not generate the .gemspec with this line uncommented, or you'll create a self-dependency in this gem.

Run bundle after uncommenting the line then use bundle exec cmd to invoke a given command named "cmd".