diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-24 01:04:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-24 01:04:44 +0000 |
commit | db045dbbf60b53dbe013ef25554fd013baf88134 (patch) | |
tree | 257830e3c76458c8ff3d1329de83f32b23926028 /railties/generators/new_model.rb | |
download | rails-db045dbbf60b53dbe013ef25554fd013baf88134.tar.gz rails-db045dbbf60b53dbe013ef25554fd013baf88134.tar.bz2 rails-db045dbbf60b53dbe013ef25554fd013baf88134.zip |
Initial
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/generators/new_model.rb')
-rwxr-xr-x | railties/generators/new_model.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/railties/generators/new_model.rb b/railties/generators/new_model.rb new file mode 100755 index 0000000000..f6fbf5f002 --- /dev/null +++ b/railties/generators/new_model.rb @@ -0,0 +1,31 @@ +#!/usr/local/bin/ruby +require File.dirname(__FILE__) + '/../config/environment' +require 'generator' + +if ARGV.size == 1 + rails_root = File.dirname(__FILE__) + '/..' + name = ARGV.shift + Generator::Model.new(rails_root, name).generate +else + puts <<-HELP + +NAME + new_model - create model stub files + +SYNOPSIS + new_model ModelName + +DESCRIPTION + The new_model generator takes a model name (in CamelCase) and generates + a new, empty model in app/models, a test suite in test/unit with one + failing test case, and a fixtures directory in test/fixtures. + +EXAMPLE + new_model Account + + This will generate an Account class in app/models/account.rb, an + AccountTest in test/unit/account_test.rb, and the directory + test/fixtures/account. + +HELP +end |