提交 a6dc0001 编写于 作者: J Jaime Iniesta

Replace <pre> by <shell>, <ruby> and <yaml> on plugins guide; making it validate XHTML 1.0 Strict

上级 62fd691a
...@@ -35,14 +35,14 @@ h4. Create the Basic Application ...@@ -35,14 +35,14 @@ h4. Create the Basic Application
The examples in this guide require that you have a working rails application. To create a simple rails app execute: The examples in this guide require that you have a working rails application. To create a simple rails app execute:
<pre> <shell>
gem install rails gem install rails
rails yaffle_guide rails yaffle_guide
cd yaffle_guide cd yaffle_guide
rails generate scaffold bird name:string rails generate scaffold bird name:string
rake db:migrate rake db:migrate
rails server rails server
</pre> </shell>
Then navigate to http://localhost:3000/birds. Make sure you have a functioning rails app before continuing. Then navigate to http://localhost:3000/birds. Make sure you have a functioning rails app before continuing.
...@@ -56,22 +56,22 @@ Rails ships with a plugin generator which creates a basic plugin skeleton. Pass ...@@ -56,22 +56,22 @@ Rails ships with a plugin generator which creates a basic plugin skeleton. Pass
This creates a plugin in 'vendor/plugins' including an 'init.rb' and 'README' as well as standard 'lib', 'task', and 'test' directories. This creates a plugin in 'vendor/plugins' including an 'init.rb' and 'README' as well as standard 'lib', 'task', and 'test' directories.
Examples: Examples:
<pre> <shell>
rails generate plugin yaffle rails generate plugin yaffle
rails generate plugin yaffle --with-generator rails generate plugin yaffle --with-generator
</pre> </shell>
To get more detailed help on the plugin generator, type +rails generate plugin+. To get more detailed help on the plugin generator, type +rails generate plugin+.
Later on this guide will describe how to work with generators, so go ahead and generate your plugin with the +--with-generator+ option now: Later on this guide will describe how to work with generators, so go ahead and generate your plugin with the +--with-generator+ option now:
<pre> <shell>
rails generate plugin yaffle --with-generator rails generate plugin yaffle --with-generator
</pre> </shell>
You should see the following output: You should see the following output:
<pre> <shell>
create vendor/plugins/yaffle/lib create vendor/plugins/yaffle/lib
create vendor/plugins/yaffle/tasks create vendor/plugins/yaffle/tasks
create vendor/plugins/yaffle/test create vendor/plugins/yaffle/test
...@@ -89,20 +89,20 @@ create vendor/plugins/yaffle/generators/yaffle ...@@ -89,20 +89,20 @@ create vendor/plugins/yaffle/generators/yaffle
create vendor/plugins/yaffle/generators/yaffle/templates create vendor/plugins/yaffle/generators/yaffle/templates
create vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb create vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb
create vendor/plugins/yaffle/generators/yaffle/USAGE create vendor/plugins/yaffle/generators/yaffle/USAGE
</pre> </shell>
h4. Organize Your Files h4. Organize Your Files
To make it easy to organize your files and to make the plugin more compatible with GemPlugins, start out by altering your file system to look like this: To make it easy to organize your files and to make the plugin more compatible with GemPlugins, start out by altering your file system to look like this:
<pre> <shell>
|-- lib |-- lib
| |-- yaffle | |-- yaffle
| `-- yaffle.rb | `-- yaffle.rb
`-- rails `-- rails
| |
`-- init.rb `-- init.rb
</pre> </shell>
*vendor/plugins/yaffle/init.rb* *vendor/plugins/yaffle/init.rb*
...@@ -124,7 +124,7 @@ h4. Test Setup ...@@ -124,7 +124,7 @@ h4. Test Setup
*vendor/plugins/yaffle/test/database.yml:* *vendor/plugins/yaffle/test/database.yml:*
<pre> <yaml>
sqlite: sqlite:
:adapter: sqlite :adapter: sqlite
:dbfile: vendor/plugins/yaffle/test/yaffle_plugin.sqlite.db :dbfile: vendor/plugins/yaffle/test/yaffle_plugin.sqlite.db
...@@ -146,7 +146,7 @@ mysql: ...@@ -146,7 +146,7 @@ mysql:
:username: root :username: root
:password: password :password: password
:database: yaffle_plugin_test :database: yaffle_plugin_test
</pre> </yaml>
For this guide you'll need 2 tables/models, Hickwalls and Wickwalls, so add the following: For this guide you'll need 2 tables/models, Hickwalls and Wickwalls, so add the following:
...@@ -239,10 +239,10 @@ end ...@@ -239,10 +239,10 @@ end
To run this, go to the plugin directory and run +rake+: To run this, go to the plugin directory and run +rake+:
<pre> <shell>
cd vendor/plugins/yaffle cd vendor/plugins/yaffle
rake rake
</pre> </shell>
You should see output like: You should see output like:
...@@ -1511,4 +1511,5 @@ h3. Changelog ...@@ -1511,4 +1511,5 @@ h3. Changelog
"Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213/tickets/32-update-plugins-guide "Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213/tickets/32-update-plugins-guide
* April 4, 2010: Fixed document to validate XHTML 1.0 Strict. "Jaime Iniesta":credits.html#jaimeiniesta
* November 17, 2008: Major revision by Jeff Dean * November 17, 2008: Major revision by Jeff Dean
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册