Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added section in README about generators (padrino-core, padrino-gen)

  • Loading branch information...
commit 93c87d2f1ede8b5e569d4311d56b752e84ffcfb1 1 parent ca23a6c
@nesquena nesquena authored
Showing with 230 additions and 17 deletions.
  1. +125 −8 README.rdoc
  2. +3 −0  TODO
  3. +102 −9 padrino-gen/README.rdoc
View
133 README.rdoc
@@ -473,7 +473,7 @@ single spot and then attach an alias which can be used to refer to the url throu
For a detailed look at all of padrino routing functionality, check out the documentation within the
{padrino-routing README}[http://github.com/padrino/padrino-framework/tree/master/padrino-routing/].
-The following is a whirlwind guide through useful helpers provided by this gem.
+The following is a whirlwind guide through useful route extensions provided by this gem.
=== Simple Route Aliases
@@ -586,20 +586,137 @@ This will put all named routes within this controller block into the 'admin' nam
<%= link_to 'admin index page', url_for(:admin, :index, :id => 25) %>
Note that controller namespaces are simply a shortcut for standard namespaces and do not differ in any other way.
-
-== Agnostic Application Generators (padrino-gen)
+== Simple Mailer Support (padrino-mailer)
...
-== Simple Mailer Support (padrino-mailer)
+== Agnostic Application Generators (padrino-gen)
-...
+Padrino provides support for advanced routing functionality not available within Sinatra. This routing
+supports named route aliases and easy access to url paths. The benefits of this is that instead of having to
+hard-code route urls into every area of your application, now we can just define the urls in a
+single spot and then attach an alias which can be used to refer to the url throughout the application.
-== Painless Page and Fragment Caching (padrino-cache)
+For a detailed look at all of padrino generator functionality, check out the documentation within the
+{padrino-generator README}[http://github.com/padrino/padrino-framework/tree/master/padrino-gen/].
+The following is a whirlwind guide through useful generators provided by this gem.
-...
+
+=== Application Generator ===
+
+Padrino provides generator support for quickly creating new Padrino applications. This provides many benefits
+such as constructing the recommended Padrino application structure, auto-generating a Gemfile listing
+all starting dependencies and guidelines provided within the generated files to help orient a new user
+to using Padrino.
+
+One important feature of the generators is that they were built from the ground up to support a wide variety
+of tools, libraries and gems for use within your padrino application.
+
+This means that Padrino generators do *not* lock you into using any particular database, ORM, testing framework,
+templating engine or javascript library. In fact, when generating an application you can actually tell
+Padrino which components you would like to use!
+
+Generating a brand new Padrino project is as simple as a single command on the terminal:
+
+ $ padrino-gen app demo_blog . --test=shoulda --renderer=haml --mock=rr --script=jquery --orm datamapper
+
+This will automatically create a new folder called 'demo_blog' containing a starting point for the
+'DemoBlog' Padrino application using all the components specified during construction.
+
+For information on generating appications, check out the
+{padrino-generator README}[http://github.com/padrino/padrino-framework/tree/master/padrino-gen/].
+
+=== Model Generator ===
+
+Padrino provides generator support for quickly creating new models within your Padrino application. Note that
+the models (and migrations) generated are specifically tailored towards the ORM component and testing framework
+chosen during application generation.
+
+Very important to note that model generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions. Using model generators
+within an existing application not generated by Padrino will likely not work as expected.
+
+Using the model generator is as simple as:
+
+ $ padrino-gen model User
+
+You can also specify desired fields to be contained within your User model:
+
+ $ padrino-gen model User name:string age:integer email:string
+
+The model generator will create multiple files within your application and based on your ORM component.
+Usually the model file will generate files similar to the following:
+
+ * model definition file [app/models/user.rb]
+ * migration declaration [db/migrate/xxx_create_users.rb]
+ * model unit test file [test/models/user_test.rb]
+
+You can define as many models as you would like in a Padrino application using this generator.
+
+=== Migration Generator ===
+
+Padrino provides generator for quickly generating new migrations to change or manipulate the database schema.
+These migrations generated will be tailored towards the ORM chosen when generating the application.
+
+Very important to note that migration generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions. Using migration generators
+within an existing application not generated by Padrino will likely not work as expected.
+
+Using the migration generator is as simple as:
+
+ $ padrino-gen migration AddFieldsToUsers
+ $ padrino-gen migration RemoveFieldsFromUsers
+
+You can also specify desired columns to be added to the migration file:
+
+ $ padrino-gen migration AddFieldsToUsers last_login:datetime crypted_password:string
+ $ padrino-gen migration RemoveFieldsFromUsers password:string ip_address:string
+
+The migration generator will then construct the migration file according to your ORM component chosen
+within <tt>db/migrate/xxx_add_fields_to_users.rb</tt> including the columns specified in the command.
+
+=== Controller Generator ===
+
+Padrino provides generator support for quickly creating new controllers within your Padrino application. Note that
+the controller tests are generated specifically tailored towards the testing framework chosen
+during application generation.
+
+Very important to note that controller generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions.
+
+Using the controller generator is as simple as:
+
+ $ padrino-gen controller Admin
+
+You can also specify desired actions to be added to your controller:
+
+ $ padrino-gen controller Admin :index [:admin, :index]
+
+The controller generator will then construct the controller file within <tt>app/controllers/admin.rb</tt>
+and also a controller test file at <tt>test/controllers/admin_controller_test.rb</tt> according to the
+test framework chosen during app generation.
+
+=== Mailer Generator ===
+
+Padrino provides generator support for quickly creating new mailers within your Padrino application.
+Very important to note that mailer generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions.
+
+Using the mailer generator is as simple as:
+
+ $ padrino-gen mailer UserNotifier
+
+You can also specify desired delivery actions to be added to the mailer:
+
+ $ padrino-gen mailer UserNotifier confirm_account welcome inactive_account
+
+The mailer generator will then construct the mailer file within <tt>app/mailers/user_notifier.rb</tt>
== Admin Dashboard and Authentication (padrino-admin)
-...
+...COMING SOON...
+
+== Painless Page and Fragment Caching (padrino-cache)
+
+...COMING SOON...
View
3  TODO
@@ -46,6 +46,9 @@
- allow for special names to be interpreted (http://guides.rubyonrails.org/migrations.html#creating-a-standalone-migration)
* Add app generator to specify orm=none, test=none, script=none
* Add support for destroying existing controller, model, migrations, mailer
+* Add support for specifying 'actions' within controller and mailer migrations
+ * padrino-gen controller User :index [:admin, :index]
+ * padrino-gen mailer User method1 method2 method3
* Implement padrino-cache gem functionality
* Add helpers to helpers gem:
* ajax helpers (http://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/ajax_helper.rb)
View
111 padrino-gen/README.rdoc
@@ -16,15 +16,31 @@ Thor gem (incidentally also used in the Rails 3 generators). These generators ar
generation both in creating new applications and building on existing ones. The generators have been built to be as
library-agnostic as possible, supporting a myriad of test frameworks, js libraries, mocking libraries, etc.
-The usage for the generator is quite simple:
+See the wiki article for additional information: <...WIKI...>
+
+=== Application Generator ===
+
+Padrino provides generator support for quickly creating new Padrino applications. This provides many benefits
+such as constructing the recommended Padrino application structure, auto-generating a Gemfile listing
+all starting dependencies and guidelines provided within the generated files to help orient a new user
+to using Padrino.
+
+One important feature of the generators is that they were built from the ground up to support a wide variety
+of tools, libraries and gems for use within your padrino application.
+
+This means that Padrino generators do *not* lock you into using any particular database, ORM, testing framework,
+templating engine or javascript library. In fact, when generating an application you can actually tell
+Padrino which components you would like to use!
- $ padrino-gen <the_app_name> </path/to/create/app> --<component-name> <value>
+The usage for the app generator is quite simple:
+
+ $ padrino-gen app <the_app_name> </path/to/create/app> --<component-name> <value>
The simplest possible command to generate a base application would be:
$ padrino-gen demo_app .
-This would construct a Sinatra application DemoApp (which extends from Sinatra::Application)
+This would construct a Padrino application DemoApp (which extends from Padrino::Application)
inside the folder 'demo_app' at our current path. Inside the application there would be configuration and
setup performed for the default components.
@@ -58,14 +74,91 @@ This would be achieved through forking our project and reading through the code
the setup instructions inside the relevant files within <tt>/generators/components/</tt>. We are happy to accept pull requests
for additional component types not originally included (although helping us maintain them would also be appreciated).
-We are also planning to add generator actions such as:
+=== Model Generator ===
-* Model generation (working for any of the available orms listed)
-* Routes generation
-* Mailer generation
-* Migrations generation
+Padrino provides generator support for quickly creating new models within your Padrino application. Note that
+the models (and migrations) generated are specifically tailored towards the ORM component and testing framework
+chosen during application generation.
-See the wiki article for additional information: <...WIKI...>
+Very important to note that model generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions. Using model generators
+within an existing application not generated by Padrino will likely not work as expected.
+
+Using the model generator is as simple as:
+
+ $ padrino-gen model User
+
+You can also specify desired fields to be contained within your User model:
+
+ $ padrino-gen model User name:string age:integer email:string
+
+The model generator will create multiple files within your application and based on your ORM component.
+Usually the model file will generate files similar to the following:
+
+ * model definition file [app/models/user.rb]
+ * migration declaration [db/migrate/xxx_create_users.rb]
+ * model unit test file [test/models/user_test.rb]
+
+You can define as many models as you would like in a Padrino application using this generator.
+
+=== Migration Generator ===
+
+Padrino provides generator for quickly generating new migrations to change or manipulate the database schema.
+These migrations generated will be tailored towards the ORM chosen when generating the application.
+
+Very important to note that migration generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions. Using migration generators
+within an existing application not generated by Padrino will likely not work as expected.
+
+Using the migration generator is as simple as:
+
+ $ padrino-gen migration AddFieldsToUsers
+ $ padrino-gen migration RemoveFieldsFromUsers
+
+You can also specify desired columns to be added to the migration file:
+
+ $ padrino-gen migration AddFieldsToUsers last_login:datetime crypted_password:string
+ $ padrino-gen migration RemoveFieldsFromUsers password:string ip_address:string
+
+The migration generator will then construct the migration file according to your ORM component chosen
+within <tt>db/migrate/xxx_add_fields_to_users.rb</tt> including the columns specified in the command.
+
+=== Controller Generator ===
+
+Padrino provides generator support for quickly creating new controllers within your Padrino application. Note that
+the controller tests are generated specifically tailored towards the testing framework chosen
+during application generation.
+
+Very important to note that controller generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions.
+
+Using the controller generator is as simple as:
+
+ $ padrino-gen controller Admin
+
+You can also specify desired actions to be added to your controller:
+
+ $ padrino-gen controller Admin :index [:admin, :index]
+
+The controller generator will then construct the controller file within <tt>app/controllers/admin.rb</tt>
+and also a controller test file at <tt>test/controllers/admin_controller_test.rb</tt> according to the
+test framework chosen during app generation.
+
+=== Mailer Generator ===
+
+Padrino provides generator support for quickly creating new mailers within your Padrino application.
+Very important to note that mailer generators are intended primarily to work within applications
+created through the Padrino application generator and that follow Padrino conventions.
+
+Using the mailer generator is as simple as:
+
+ $ padrino-gen mailer UserNotifier
+
+You can also specify desired delivery actions to be added to the mailer:
+
+ $ padrino-gen mailer UserNotifier confirm_account welcome inactive_account
+
+The mailer generator will then construct the mailer file within <tt>app/mailers/user_notifier.rb</tt>
== Copyright
Please sign in to comment.
Something went wrong with that request. Please try again.