Skip to content

Commit

Permalink
update generator help [#510 state:resolved] [#505 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Oct 23, 2009
1 parent 0fe8974 commit 528f6a1
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 4 deletions.
4 changes: 4 additions & 0 deletions hobo/rails_generators/hobo/USAGE
@@ -0,0 +1,4 @@
Description:

Adds support for the basic Hobo & DRYML system, not including
Rapid.
16 changes: 16 additions & 0 deletions hobo/rails_generators/hobo_admin_site/USAGE
@@ -0,0 +1,16 @@
Description:

Creates a subsite, a namespaced section of your application.

The subsite will use app/views/taglibs/<subsite_name>_site.dryml
instead of app/views/taglibs/appplication.dryml. This allows you
to easily set different themes and choose different CSS files for
the subsite.

Controllers for the subsite are created in
app/controllers/<subsite_name>/ and views are also in their own
subdirectory. This allows you to have two different controllers
and two different sets of views for the same model.

The difference between hobo_admin_site and hobo_subsite is that
hobo_admin_site limits the subsite to use by administrators only.
38 changes: 38 additions & 0 deletions hobo/rails_generators/hobo_model_resource/USAGE
@@ -0,0 +1,38 @@
Description:
The model generator creates stubs for a new model, corresponding
controller and it's views.

The generator takes a model name as its argument. The model name
may be given in CamelCase or under_score and should not be
suffixed with anything.

As additional parameters, the generator will take attribute pairs
described by name and type. These attributes will be used to
prepopulate the migration to create the table for the model and
give you a set of predefined fixture. You don't have to think up
all attributes up front, but it's a good idea of adding just the
baseline of what's needed to start really working with the
resource.

The generator creates a model class in app/models, a test suite in
test/unit and test fixtures in test/fixtures/singular_name.yml.
The generator creates a controller class in app/controllers with
view templates in app/views/controller_name, a helper class in
app/helpers, and a functional test suite in test/functional.

Examples:
./script/generate hobo_model_resource account

This will create an Account model:
Model: app/models/account.rb
Controller: app/controllers/accounts_controller.rb
Helper: app/helpers/accounts_helper.rb
Views: app/views/accounts
ViewHints: app/viewhints/account_hints.rb
Test: test/unit/account_test.rb
Test: test/functions/accounts_controller_test.rb
Fixtures: test/fixtures/accounts.yml

./script/generate hobo_model_resource post title:string created_on:date body:text published:boolean

Creates post model, controller & views with predefined attributes.
3 changes: 3 additions & 0 deletions hobo/rails_generators/hobo_rapid/USAGE
@@ -0,0 +1,3 @@
Description:

Adds support for Rapid to your application.
16 changes: 16 additions & 0 deletions hobo/rails_generators/hobo_subsite/USAGE
@@ -0,0 +1,16 @@
Description:

Creates a subsite, a namespaced section of your application.

The subsite will use app/views/taglibs/<subsite_name>_site.dryml
instead of app/views/taglibs/appplication.dryml. This allows you
to easily set different themes and choose different CSS files for
the subsite.

Controllers for the subsite are created in
app/controllers/<subsite_name>/ and views are also in their own
subdirectory. This allows you to have two different controllers
and two different sets of views for the same model.

The difference between hobo_admin_site and hobo_subsite is that
hobo_admin_site limits the subsite to use by administrators only.
Expand Up @@ -53,7 +53,7 @@ def manifest

protected
def banner
"Usage: #{$0} #{spec.name} [--make-front-site | --no-front-site]"
"Usage: #{$0} #{spec.name} <subsite_name> [--make-front-site | --no-front-site]"
end


Expand Down
47 changes: 47 additions & 0 deletions hobofields/rails_generators/hobo_migration/USAGE
@@ -0,0 +1,47 @@
Description:

This generator compares your existing schema against the
schema declared inside your fields declarations in your
models.

If the generator finds differences, it will display the
migration it has created, and ask you if you wish to
[g]enerate migration, generate and [m]igrate now or [c]ancel?
Enter "g" to just generate the migration but do not run it.
Enter "m" to generate the migration and run it, or press "c"
to do nothing.

The generator will then prompt you for the generator name,
supplying a numbered default name.

The generator is conservative and will prompt you to resolve
any ambiguities.

Examples:

$ ./script/generate hobo_migration

---------- Up Migration ----------
create_table :foos do |t|
t.datetime :created_at
t.datetime :updated_at
end
----------------------------------

---------- Down Migration --------
drop_table :foos
----------------------------------
What now: [g]enerate migration, generate and [m]igrate now or [c]ancel? m

Migration filename:
(you can type spaces instead of '_' -- every little helps)
Filename [hobo_migration_2]: create_foo
exists db/migrate
create db/migrate/20091023183838_create_foo.rb
(in /work/foo)
== CreateFoo: migrating ======================================================
-- create_table(:yos)
-> 0.0856s
== CreateFoo: migrated (0.0858s) =============================================


Expand Up @@ -133,8 +133,8 @@ def add_options!(opt)

opt.on("--force-drop", "Don't prompt with 'drop or rename' - just drop everything") { |v| options[:force_drop] = true }
opt.on("--default-name", "Dont' prompt for a migration name - just pick one") { |v| options[:default_name] = true }
opt.on("--generate", "Dont' prompt for action - generate the migration") { |v| options[:action] = 'g' }
opt.on("--migrate", "Dont' prompt for action - generate and migrate") { |v| options[:action] = 'm' }
opt.on("--generate", "Don't prompt for action - generate the migration") { |v| options[:action] = 'g' }
opt.on("--migrate", "Don't prompt for action - generate and migrate") { |v| options[:action] = 'm' }
end


Expand Down
Expand Up @@ -33,6 +33,6 @@ def add_options!(opt)
opt.on("--skip-timestamps",
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
opt.on("--skip-fixture",
"Don't generation a fixture file for this model") { |v| options[:skip_fixture] = v}
"Don't generate a fixture file for this model") { |v| options[:skip_fixture] = v}
end
end

0 comments on commit 528f6a1

Please sign in to comment.