Giter VIP home page Giter VIP logo

i18n_shoulda_generator's Introduction

Shoulda generators

One night at a Boston Ruby hackfest, I finally got sick of using the Rails default generators, and then having to twiddle them to meet my needs and tastes. This includes using things like:

The next morning, I was struck awake at 5am with the inspiration to start implementing it. shoulda_generator is the result of this effort.

What you get

shoulda_model

  • A new model
  • A migration for the model
  • Skip using --skip-migration
  • A factory defined with factory_girl
  • Skip using --skip-factory
  • A shoulda unit test with a few simple 'should's

Prereqs:

shoulda_scaffold

  • Everything included in shoulda_model
  • A controller (sans unnecessary comments)
  • Choice of haml (default) or ERB
    • Specify which with the --templating option
  • Simple layout styled with blueprint
    • Skip using --skip-layout
  • A helper
  • A shoulda functional test using factory_girl factory, using should_be_restful or not
    • Specify with --functional-test-style, accepts basic and should_be_restful

Prereqs:

  • shoulda installed as a plugin
  • factory_girl gem installed
  • haml gem installed on the system, and the project has been hamlified using haml --rails

Getting it

shoulda_generator is available as a gem via GitHub. If you haven't done so already, you need to setup GitHub as a gem source:

$ gem sources -a http://gems.github.com

Now you can install it:

$ sudo gem install technicalpickles-shoulda_generator

Example usage

Usage is the same as the default Rails generators.

$ script/generate shoulda_model post title:string body:text published:boolean 
$ script/generate shoulda_scaffold post title:string body:text published:boolean

Configuring it

You can override the default values for templating by placing a .shoulda_generator file in your home directory.

Here's an example .shoulda_generator:

:templating: erb              # supported options: haml|erb

Developing it

Source is hosted on GitHub: http://github.com/technicalpickles/shoulda_generator/tree/master

You can do the usual fork/commit cycle until you have something ready to share. Send pull requests my way.

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.