views:

493

answers:

2

script/generate became very annoying since i started using rspec etc. i dont need unit test files and fixtures anymore, but script/generate makes them anyway.

is it possible to set --skip-fixtures and --skip-test to be default system-wide (or at least project-wide)?

+4  A: 

You can edit your applications script/generate file to auto append options

#!/usr/bin/env ruby

ARGV << "--skip-fixture" if ["model"].include?(ARGV[0])

require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
Corban Brook
I like that you can do that and I always forget, that's why I make aliases instead - so I don't have to do it everywhere.
Brian Hogan
Nice idea. Thanks.
Mantas
+4  A: 

Well, for starters,

ruby script/generate rspec_model
ruby script/generate rspec_controller

At least that doesn't generate unit tests and it gets the specs there for me :)

But --skip-fixtures still has to get passed. I've just made my own aliases in .bash_profile

alias model='ruby script/generate rspec_model $1 --skip-fixture'

Then I can just do

model bar name:string active:boolean

and it all works :)

Brian Hogan