Coder Social home page Coder Social logo

createkata's Introduction

createkata – a stupid simple tool for getting a new kata up and running

To try and stay sharp, I’m trying to do a code kata once every few days, with cucumber and rspec.

While setting up the default project file / directory layout isn’t all that difficult, it was starting to get tedious. By default project layout, I mean:


project/
— bin/
— features/
- step_definitions/
-
support/
– env.rb
— lib/
— spec/
– spec_helper.rb

Also, I like to keep track of the different katas that I run… sometimes I’ll try challenging myself and see if I can solve the same problem a different way, or sometimes once I’ve solved the inherent problem, I’ll try to take the code further, imagining what a more developed (ie – actually useful) implementation might look like. As such, I prefer to have my katas stored in a special location, and I like to keep them numbered, like so:


~/Code/katas/
— bowling/
- bowling_kata/
-
bowling_kata_1/
- bowling_kata_2/
-
mastermind/
- mastermind_kata/
-
mastermind_kata_1/
— mastermind_kata_2/
..
..

This code is a little shell script that will manage all of this for you.

Installation

  1. Download the code.
  2. Put it somewhere you won’t want to move it from. I like to keep this kind of code in my default ~/Code directory… but then again, I wrote it. Point is, put it someplace you don’t expect will change very often.
  3. From this directory run ruby install.rb. This will install a tiny shell script in /usr/local/bin that points back to the bin/ directory of this project (hence why the code probably shouldn’t move around too much). If, however, for some reason, you do move the code, no matter, just re-run ruby install.rb and it’ll update the installed binary.

Usage

All you really need to do is run createkata and it will generate a bowling/ directory with your first bowling_kata/ directory inside, in whatever location you’re currently in. And, it’ll open this new directory in TextMate for you.

If you want to customize the name of the kata you’re doing, you can pass that to the createkata command like so: createkata mastermind. That will generate a mastermind/ directory, with a mastermind_kata/ directory inside.

If you want your katas to be stored in the same place all the time, add a KATA_DIR environment variable to your shell: export KATA_DIR="~/Code/katas". Now, no matter where you run createkata from, all the generated directories will be stored in ~/Code/katas/.

You can customize the location on the fly, as well by passing the location as a second argument: createkata mastermind ~/Desktop.

You can run the createkata command as many times as you want, with the same arguments, and each subsequent time, it will create a new directory with an auto-incremented number appended on the end.

createkata's People

Contributors

dgiunta avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.