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)?
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'
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With