From 6b65cd57ca20381e7d0f169d7b8cfd7db10e6efb Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 19 Dec 2010 17:57:20 +0530 Subject: deleting trailing whitespaces --- railties/guides/source/generators.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/guides/source/generators.textile') diff --git a/railties/guides/source/generators.textile b/railties/guides/source/generators.textile index 6945f6f9bb..f21984e754 100644 --- a/railties/guides/source/generators.textile +++ b/railties/guides/source/generators.textile @@ -403,7 +403,7 @@ Whilst the final section of this guide doesn't cover how to generate the most aw h3. Generator methods -The following are methods available for both generators and templates for Rails. +The following are methods available for both generators and templates for Rails. NOTE: Methods provided by Thor are not covered this guide and can be found in "Thor's documentation":http://rdoc.info/github/wycats/thor/master/Thor/Actions.html @@ -546,7 +546,7 @@ This method also takes a block: %Q{ task :rock => :environment do puts "Rockin'" - end + end } end -- cgit v1.2.3 From 6909fb6cff49e11574909b55864af8673d044eb7 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 20 Dec 2010 02:34:08 +0530 Subject: indentation fixes --- railties/guides/source/generators.textile | 63 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'railties/guides/source/generators.textile') diff --git a/railties/guides/source/generators.textile b/railties/guides/source/generators.textile index f21984e754..4fec1760c4 100644 --- a/railties/guides/source/generators.textile +++ b/railties/guides/source/generators.textile @@ -371,16 +371,16 @@ h3. Application templates Now that you've seen how generators can be used _inside_ an application, did you know they can also be used to _generate_ applications too? This kind of generator is referred as a "template". - gem("rspec-rails", :group => "test") - gem("cucumber-rails", :group => "test") - - if yes?("Would you like to install Devise?") - gem("devise") - generate("devise:install") - model_name = ask("What would you like the user model to be called? [user]") - model_name = "user" if model_name.blank? - generate("devise", model_name) - end +gem("rspec-rails", :group => "test") +gem("cucumber-rails", :group => "test") + +if yes?("Would you like to install Devise?") + gem("devise") + generate("devise:install") + model_name = ask("What would you like the user model to be called? [user]") + model_name = "user" if model_name.blank? + generate("devise", model_name) +end In the above template we specify that the application relies on the +rspec-rails+ and +cucumber-rails+ gem so these two will be added to the +test+ group in the +Gemfile+. Then we pose a question to the user about whether or not they would like to install Devise. If the user replies "y" or "yes" to this question, then the template will add Devise to the +Gemfile+ outside of any group and then runs the +devise:install+ generator. This template then takes the users input and runs the +devise+ generator, with the user's answer from the last question being passed to this generator. @@ -428,8 +428,8 @@ h4. +gem+ Specifies a gem dependency of the application. - gem("rspec", :group => "test", :version => "2.1.0") - gem("devise", "1.1.5") +gem("rspec", :group => "test", :version => "2.1.0") +gem("devise", "1.1.5") Available options are: @@ -470,10 +470,9 @@ Adds a line to +config/application.rb+ directly after the application class defi This method can also take a block: - application do - "config.asset_host = 'http://example.com'" - end - end +application do + "config.asset_host = 'http://example.com'" +end Available options are: @@ -481,9 +480,9 @@ Available options are: * +:env+ - Specify an environment for this configuration option. If you wish to use this option with the block syntax the recommended syntax is as follows: - application(nil, :env => "development") do - "config.asset_host = 'http://localhost:3000'" - end +application(nil, :env => "development") do + "config.asset_host = 'http://localhost:3000'" +end h4. +git+ @@ -526,9 +525,9 @@ Places a file into +lib+ which contains the specified code. This method also takes a block: - lib("super_special.rb") do - puts "Super special!" - end +lib("super_special.rb") do + puts "Super special!" +end h4. +rakefile+ @@ -542,13 +541,13 @@ Creates a Rake file in the +lib/tasks+ directory of the application. This method also takes a block: - rakefile("test.rake") do - %Q{ - task :rock => :environment do - puts "Rockin'" - end - } - end +rakefile("test.rake") do + %Q{ + task :rock => :environment do + puts "Rockin'" + end + } +end h4. +initializer+ @@ -562,9 +561,9 @@ Creates an initializer in the +config/initializers+ directory of the application This method also takes a block: - initializer("begin.rb") do - puts "Almost done!" - end +initializer("begin.rb") do + puts "Almost done!" +end h4. +generate+ -- cgit v1.2.3