rails 4.0.0 → 4.2.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +30 -23
  3. data/guides/CHANGELOG.md +108 -6
  4. data/guides/Rakefile +21 -6
  5. data/guides/assets/images/akshaysurve.jpg +0 -0
  6. data/guides/assets/images/edge_badge.png +0 -0
  7. data/guides/assets/images/feature_tile.gif +0 -0
  8. data/guides/assets/images/footer_tile.gif +0 -0
  9. data/guides/assets/images/fxn.png +0 -0
  10. data/guides/assets/images/getting_started/article_with_comments.png +0 -0
  11. data/guides/assets/images/getting_started/challenge.png +0 -0
  12. data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
  13. data/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  14. data/guides/assets/images/getting_started/form_with_errors.png +0 -0
  15. data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
  16. data/guides/assets/images/getting_started/new_article.png +0 -0
  17. data/guides/assets/images/getting_started/rails_welcome.png +0 -0
  18. data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
  19. data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
  20. data/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
  21. data/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
  22. data/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
  23. data/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
  24. data/guides/assets/images/header_tile.gif +0 -0
  25. data/guides/assets/images/icons/README +1 -1
  26. data/guides/assets/images/icons/callouts/11.png +0 -0
  27. data/guides/assets/images/icons/callouts/12.png +0 -0
  28. data/guides/assets/images/icons/callouts/13.png +0 -0
  29. data/guides/assets/images/icons/callouts/15.png +0 -0
  30. data/guides/assets/images/icons/caution.png +0 -0
  31. data/guides/assets/images/icons/example.png +0 -0
  32. data/guides/assets/images/radar.png +0 -0
  33. data/guides/assets/images/rails4_features.png +0 -0
  34. data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
  35. data/guides/assets/images/vijaydev.jpg +0 -0
  36. data/guides/assets/javascripts/guides.js +36 -34
  37. data/guides/assets/stylesheets/main.css +6 -2
  38. data/guides/assets/stylesheets/print.css +1 -1
  39. data/guides/bug_report_templates/action_controller_gem.rb +47 -0
  40. data/guides/bug_report_templates/action_controller_master.rb +54 -0
  41. data/guides/bug_report_templates/active_record_gem.rb +5 -2
  42. data/guides/bug_report_templates/active_record_master.rb +3 -2
  43. data/guides/bug_report_templates/generic_gem.rb +15 -0
  44. data/guides/bug_report_templates/generic_master.rb +26 -0
  45. data/guides/rails_guides.rb +23 -4
  46. data/guides/rails_guides/generator.rb +1 -1
  47. data/guides/rails_guides/helpers.rb +4 -2
  48. data/guides/rails_guides/levenshtein.rb +27 -21
  49. data/guides/rails_guides/markdown.rb +11 -7
  50. data/guides/rails_guides/markdown/renderer.rb +1 -1
  51. data/guides/source/2_2_release_notes.md +3 -3
  52. data/guides/source/2_3_release_notes.md +12 -12
  53. data/guides/source/3_0_release_notes.md +10 -13
  54. data/guides/source/3_1_release_notes.md +7 -4
  55. data/guides/source/3_2_release_notes.md +17 -14
  56. data/guides/source/4_0_release_notes.md +110 -54
  57. data/guides/source/4_1_release_notes.md +730 -0
  58. data/guides/source/4_2_release_notes.md +877 -0
  59. data/guides/source/_license.html.erb +1 -1
  60. data/guides/source/_welcome.html.erb +6 -2
  61. data/guides/source/action_controller_overview.md +223 -57
  62. data/guides/source/action_mailer_basics.md +129 -76
  63. data/guides/source/action_view_overview.md +247 -246
  64. data/guides/source/active_job_basics.md +339 -0
  65. data/guides/source/active_model_basics.md +374 -20
  66. data/guides/source/active_record_basics.md +46 -45
  67. data/guides/source/active_record_callbacks.md +83 -28
  68. data/guides/source/{migrations.md → active_record_migrations.md} +191 -275
  69. data/guides/source/active_record_postgresql.md +433 -0
  70. data/guides/source/active_record_querying.md +382 -300
  71. data/guides/source/active_record_validations.md +64 -55
  72. data/guides/source/active_support_core_extensions.md +229 -187
  73. data/guides/source/active_support_instrumentation.md +23 -22
  74. data/guides/source/api_documentation_guidelines.md +167 -15
  75. data/guides/source/asset_pipeline.md +768 -294
  76. data/guides/source/association_basics.md +188 -96
  77. data/guides/source/autoloading_and_reloading_constants.md +1311 -0
  78. data/guides/source/caching_with_rails.md +45 -11
  79. data/guides/source/command_line.md +96 -65
  80. data/guides/source/configuring.md +404 -70
  81. data/guides/source/contributing_to_ruby_on_rails.md +270 -130
  82. data/guides/source/credits.html.erb +7 -3
  83. data/guides/source/debugging_rails_applications.md +471 -284
  84. data/guides/source/development_dependencies_install.md +115 -21
  85. data/guides/source/documents.yaml +31 -9
  86. data/guides/source/engines.md +737 -291
  87. data/guides/source/form_helpers.md +137 -89
  88. data/guides/source/generators.md +60 -28
  89. data/guides/source/getting_started.md +1007 -596
  90. data/guides/source/i18n.md +178 -96
  91. data/guides/source/index.html.erb +2 -1
  92. data/guides/source/initialization.md +248 -104
  93. data/guides/source/kindle/toc.html.erb +1 -1
  94. data/guides/source/layout.html.erb +14 -22
  95. data/guides/source/layouts_and_rendering.md +78 -46
  96. data/guides/source/maintenance_policy.md +78 -0
  97. data/guides/source/nested_model_forms.md +10 -7
  98. data/guides/source/plugins.md +66 -57
  99. data/guides/source/rails_application_templates.md +49 -12
  100. data/guides/source/rails_on_rack.md +50 -60
  101. data/guides/source/routing.md +190 -139
  102. data/guides/source/ruby_on_rails_guides_guidelines.md +12 -13
  103. data/guides/source/security.md +134 -83
  104. data/guides/source/testing.md +322 -200
  105. data/guides/source/upgrading_ruby_on_rails.md +834 -37
  106. data/guides/source/working_with_javascript_in_rails.md +36 -26
  107. data/guides/w3c_validator.rb +2 -0
  108. metadata +93 -116
  109. data/guides/assets/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
  110. data/guides/assets/images/getting_started/new_post.png +0 -0
  111. data/guides/assets/images/getting_started/post_with_comments.png +0 -0
  112. data/guides/assets/images/getting_started/show_action_for_posts.png +0 -0
  113. data/guides/assets/images/getting_started/template_is_missing_posts_new.png +0 -0
  114. data/guides/assets/images/getting_started/undefined_method_post_path.png +0 -0
  115. data/guides/assets/images/getting_started/unknown_action_create_for_posts.png +0 -0
  116. data/guides/assets/images/getting_started/unknown_action_new_for_posts.png +0 -0
  117. data/guides/assets/images/jaimeiniesta.jpg +0 -0
  118. data/guides/code/getting_started/Gemfile +0 -43
  119. data/guides/code/getting_started/Gemfile.lock +0 -150
  120. data/guides/code/getting_started/README.rdoc +0 -28
  121. data/guides/code/getting_started/Rakefile +0 -6
  122. data/guides/code/getting_started/app/assets/javascripts/application.js +0 -16
  123. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
  124. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
  125. data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
  126. data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
  127. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
  128. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
  129. data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
  130. data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
  131. data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -17
  132. data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -47
  133. data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
  134. data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
  135. data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
  136. data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
  137. data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
  138. data/guides/code/getting_started/app/models/comment.rb +0 -3
  139. data/guides/code/getting_started/app/models/post.rb +0 -7
  140. data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
  141. data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
  142. data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
  143. data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
  144. data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
  145. data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
  146. data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
  147. data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
  148. data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -3
  149. data/guides/code/getting_started/bin/bundle +0 -4
  150. data/guides/code/getting_started/bin/rails +0 -4
  151. data/guides/code/getting_started/bin/rake +0 -4
  152. data/guides/code/getting_started/config.ru +0 -4
  153. data/guides/code/getting_started/config/application.rb +0 -18
  154. data/guides/code/getting_started/config/boot.rb +0 -4
  155. data/guides/code/getting_started/config/database.yml +0 -25
  156. data/guides/code/getting_started/config/environment.rb +0 -5
  157. data/guides/code/getting_started/config/environments/development.rb +0 -30
  158. data/guides/code/getting_started/config/environments/production.rb +0 -80
  159. data/guides/code/getting_started/config/environments/test.rb +0 -36
  160. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
  161. data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
  162. data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
  163. data/guides/code/getting_started/config/initializers/locale.rb +0 -9
  164. data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
  165. data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
  166. data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
  167. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
  168. data/guides/code/getting_started/config/locales/en.yml +0 -23
  169. data/guides/code/getting_started/config/routes.rb +0 -7
  170. data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
  171. data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
  172. data/guides/code/getting_started/db/schema.rb +0 -33
  173. data/guides/code/getting_started/db/seeds.rb +0 -7
  174. data/guides/code/getting_started/public/404.html +0 -58
  175. data/guides/code/getting_started/public/422.html +0 -58
  176. data/guides/code/getting_started/public/500.html +0 -57
  177. data/guides/code/getting_started/public/favicon.ico +0 -0
  178. data/guides/code/getting_started/public/robots.txt +0 -5
  179. data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
  180. data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
  181. data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
  182. data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
  183. data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
  184. data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
  185. data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
  186. data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
  187. data/guides/code/getting_started/test/models/comment_test.rb +0 -7
  188. data/guides/code/getting_started/test/models/post_test.rb +0 -7
  189. data/guides/code/getting_started/test/test_helper.rb +0 -15
  190. data/guides/source/kindle/KINDLE.md +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c148de96944cdc710c952ce6e00ea9c908d4023c
4
- data.tar.gz: 4aab2814d3df58278f6d8d8cda0d3f00bd261382
2
+ SHA256:
3
+ metadata.gz: d4073c294efe444213b93605bd058bdfcfe7fd21df0673d411aaacb8444d6311
4
+ data.tar.gz: 6ced0776f690d103fd1ae235809fe9244f59538b6153c5f75247e76a35c9f600
5
5
  SHA512:
6
- metadata.gz: a4d284b3843be9401d64129127c5ebc88238d16a24ec10f6f6309f43d3c0d3a8bb163e1097d3782dbf39a76154e1f3bfff0291252f4cedcb10a59db7c12e60ad
7
- data.tar.gz: 8f323b334a9dd4aad5d0d791e43f00e51b56d4b2f2323c6f8ee9c5e65598450c1e896f575673ce94588efdd5f80e8e1b1fe593d2a5bb35b539a477dfcce81200
6
+ metadata.gz: e399f8b1df884ceb451de70d9e0a821f1a0c4621eb7ee8af0e9fdc1a955661aab731e6b9a7b3928f09d2a86d492ec737f5c488709d2ba734cbb9a42a1ef5e829
7
+ data.tar.gz: d302ab1709953482477f8ca896e45e54d69c8dcc16edf1f49e09ce1c8b451d0a1725baf3d3c7a2b138b97ca0018813e2cf907db01768188a8a025e68c4679b16
data/README.md CHANGED
@@ -2,38 +2,45 @@
2
2
 
3
3
  Rails is a web-application framework that includes everything needed to
4
4
  create database-backed web applications according to the
5
- [Model-View-Controller (MVC)](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller)
5
+ [Model-View-Controller (MVC)](http://en.wikipedia.org/wiki/Model-view-controller)
6
6
  pattern.
7
7
 
8
8
  Understanding the MVC pattern is key to understanding Rails. MVC divides your
9
9
  application into three layers, each with a specific responsibility.
10
10
 
11
- The _View layer_ is composed of "templates" that are responsible for providing
12
- appropriate representations of your application's resources. Templates can
13
- come in a variety of formats, but most view templates are HTML with embedded
14
- Ruby code (ERB files).
15
-
16
11
  The _Model layer_ represents your domain model (such as Account, Product,
17
12
  Person, Post, etc.) and encapsulates the business logic that is specific to
18
13
  your application. In Rails, database-backed model classes are derived from
19
14
  `ActiveRecord::Base`. Active Record allows you to present the data from
20
15
  database rows as objects and embellish these data objects with business logic
21
- methods. Although most Rails models are backed by a database, models can also
22
- be ordinary Ruby classes, or Ruby classes that implement a set of interfaces
23
- as provided by the Active Model module. You can read more about Active Record
24
- in its [README](activerecord/README.rdoc).
16
+ methods. You can read more about Active Record in its [README](activerecord/README.rdoc).
17
+ Although most Rails models are backed by a database, models can also be ordinary
18
+ Ruby classes, or Ruby classes that implement a set of interfaces as provided by
19
+ the Active Model module. You can read more about Active Model in its [README](activemodel/README.rdoc).
25
20
 
26
21
  The _Controller layer_ is responsible for handling incoming HTTP requests and
27
- providing a suitable response. Usually this means returning HTML, but Rails
28
- controllers can also generate XML, JSON, PDFs, mobile-specific views, and
29
- more. Controllers manipulate models and render view templates in order to
30
- generate the appropriate HTTP response.
22
+ providing a suitable response. Usually this means returning HTML, but Rails controllers
23
+ can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
24
+ manipulate models, and render view templates in order to generate the appropriate HTTP response.
25
+ In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
26
+ controller classes are derived from `ActionController::Base`. Action Dispatch and Action Controller
27
+ are bundled together in Action Pack. You can read more about Action Pack in its
28
+ [README](actionpack/README.rdoc).
31
29
 
32
- In Rails, the Controller and View layers are handled together by Action Pack.
33
- These two layers are bundled in a single package due to their heavy interdependence.
34
- This is unlike the relationship between Active Record and Action Pack, which are
35
- independent. Each of these packages can be used independently outside of Rails. You
36
- can read more about Action Pack in its [README](actionpack/README.rdoc).
30
+ The _View layer_ is composed of "templates" that are responsible for providing
31
+ appropriate representations of your application's resources. Templates can
32
+ come in a variety of formats, but most view templates are HTML with embedded
33
+ Ruby code (ERB files). Views are typically rendered to generate a controller response,
34
+ or to generate the body of an email. In Rails, View generation is handled by Action View.
35
+ You can read more about Action View in its [README](actionview/README.rdoc).
36
+
37
+ Active Record, Action Pack, and Action View can each be used independently outside Rails.
38
+ In addition to them, Rails also comes with Action Mailer ([README](actionmailer/README.rdoc)), a library
39
+ to generate and send emails; Active Job ([README](activejob/README.md)), a
40
+ framework for declaring jobs and making them run on a variety of queueing
41
+ backends; and Active Support ([README](activesupport/README.rdoc)), a collection
42
+ of utility classes and standard library extensions that are useful for Rails,
43
+ and may also be used independently outside Rails.
37
44
 
38
45
  ## Getting Started
39
46
 
@@ -54,14 +61,15 @@ can read more about Action Pack in its [README](actionpack/README.rdoc).
54
61
 
55
62
  Run with `--help` or `-h` for options.
56
63
 
57
- 4. Go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"
64
+ 4. Using a browser, go to `http://localhost:3000` and you'll see:
65
+ "Welcome aboard: You're riding Ruby on Rails!"
58
66
 
59
67
  5. Follow the guidelines to start developing your application. You may find
60
68
  the following resources handy:
61
69
  * [Getting Started with Rails](http://guides.rubyonrails.org/getting_started.html)
62
70
  * [Ruby on Rails Guides](http://guides.rubyonrails.org)
63
71
  * [The API Documentation](http://api.rubyonrails.org)
64
- * [Ruby on Rails Tutorial](http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)
72
+ * [Ruby on Rails Tutorial](http://www.railstutorial.org/book)
65
73
 
66
74
  ## Contributing
67
75
 
@@ -70,8 +78,7 @@ We encourage you to contribute to Ruby on Rails! Please check out the
70
78
 
71
79
  ## Code Status
72
80
 
73
- * [![Build Status](https://api.travis-ci.org/rails/rails.png)](https://travis-ci.org/rails/rails)
74
- * [![Dependencies](https://gemnasium.com/rails/rails.png?travis)](https://gemnasium.com/rails/rails)
81
+ * [![Build Status](https://travis-ci.org/rails/rails.svg?branch=4-2-stable)](https://travis-ci.org/rails/rails)
75
82
 
76
83
  ## License
77
84
 
data/guides/CHANGELOG.md CHANGED
@@ -1,11 +1,113 @@
1
- ## Rails 4.0.0 (June 25, 2013) ##
1
+ ## Rails 4.2.11.3 (May 15, 2020) ##
2
2
 
3
- * Change Service pages(404, etc). *Stanislav Sobolev*
3
+ * No changes.
4
4
 
5
- * Split Validations and Callbacks guide into two. *Steve Klabnik*
6
5
 
7
- * New guide _Working with JavaScript in Rails_. *Steve Klabnik*
6
+ ## Rails 4.2.11.2 (May 15, 2020) ##
8
7
 
9
- * Guides updated to reflect new test locations. *Mike Moore*
8
+ * No changes.
10
9
 
11
- * Guides have a responsive design. *Joe Fiorini*
10
+
11
+ ## Rails 4.2.11.1 (March 11, 2019) ##
12
+
13
+ * No changes.
14
+
15
+
16
+ ## Rails 4.2.11 (November 27, 2018) ##
17
+
18
+ * No changes.
19
+
20
+
21
+ ## Rails 4.2.10 (September 27, 2017) ##
22
+
23
+ * No changes.
24
+
25
+
26
+ ## Rails 4.2.9 (June 26, 2017) ##
27
+
28
+ * No changes.
29
+
30
+
31
+ ## Rails 4.2.8 (February 21, 2017) ##
32
+
33
+ * No changes.
34
+
35
+
36
+ ## Rails 4.2.7 (July 12, 2016) ##
37
+
38
+ * No changes.
39
+
40
+
41
+ ## Rails 4.2.6 (March 07, 2016) ##
42
+
43
+ * No changes.
44
+
45
+
46
+ ## Rails 4.2.5.2 (February 26, 2016) ##
47
+
48
+ * No changes.
49
+
50
+
51
+ ## Rails 4.2.5.1 (January 25, 2016) ##
52
+
53
+ * No changes.
54
+
55
+
56
+ ## Rails 4.2.5 (November 12, 2015) ##
57
+
58
+ * No changes.
59
+
60
+
61
+ ## Rails 4.2.4 (August 24, 2015) ##
62
+
63
+ * No Changes *
64
+
65
+
66
+ ## Rails 4.2.3 (June 25, 2015) ##
67
+
68
+ * No Changes *
69
+
70
+
71
+ ## Rails 4.2.2 (June 16, 2015) ##
72
+
73
+ * No Changes *
74
+
75
+
76
+ ## Rails 4.2.1 (March 19, 2015) ##
77
+
78
+ * No changes.
79
+
80
+
81
+ ## Rails 4.2.0 (December 20, 2014) ##
82
+
83
+ * New guide about constant autoloading and reloading.
84
+
85
+ *Xavier Noria*
86
+
87
+ * Change Posts to Articles in Getting Started sample application in order to
88
+ better align with the actual guides.
89
+
90
+ *John Kelly Ferguson*
91
+
92
+ * Update all Rails 4.1.0 references to 4.1.1 within the guides and code.
93
+
94
+ *John Kelly Ferguson*
95
+
96
+ * Split up rows in the Explain Queries table of the ActiveRecord Querying section
97
+ in order to improve readability.
98
+
99
+ *John Kelly Ferguson*
100
+
101
+ * Change all non-HTTP method 'post' references to 'article'.
102
+
103
+ *John Kelly Ferguson*
104
+
105
+ * Updates the maintenance policy to match the latest versions of Rails
106
+
107
+ *Matias Korhonen*
108
+
109
+ * Switched the order of `Applying a default scope` and `Merging of scopes` subsections so default scopes are introduced first.
110
+
111
+ *Alex Riabov*
112
+
113
+ Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/guides/CHANGELOG.md) for previous changes.
data/guides/Rakefile CHANGED
@@ -3,18 +3,31 @@ namespace :guides do
3
3
  desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"'
4
4
  task :generate => 'generate:html'
5
5
 
6
+ # Guides are written in UTF-8, but the environment may be configured for some
7
+ # other locale, these tasks are responsible for ensuring the default external
8
+ # encoding is UTF-8.
9
+ #
10
+ # Real use cases: Generation was reported to fail on a machine configured with
11
+ # GBK (Chinese). The docs server once got misconfigured somehow and had "C",
12
+ # which broke generation too.
13
+ task :encoding do
14
+ %w(LANG LANGUAGE LC_ALL).each do |env_var|
15
+ ENV[env_var] = "en_US.UTF-8"
16
+ end
17
+ end
18
+
6
19
  namespace :generate do
7
20
 
8
21
  desc "Generate HTML guides"
9
- task :html do
22
+ task :html => :encoding do
10
23
  ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this
11
24
  ruby "rails_guides.rb"
12
25
  end
13
26
 
14
27
  desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/kindlepublishing"
15
- task :kindle do
16
- unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
17
- abort "Please `gem install kindlerb`"
28
+ task :kindle => :encoding do
29
+ unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
30
+ abort "Please `gem install kindlerb` and make sure you have `kindlegen` in your PATH"
18
31
  end
19
32
  unless `convert` =~ /convert/
20
33
  abort "Please install ImageMagick`"
@@ -26,7 +39,7 @@ namespace :guides do
26
39
 
27
40
  # Validate guides -------------------------------------------------------------------------
28
41
  desc 'Validate guides, use ONLY=foo to process just "foo.html"'
29
- task :validate do
42
+ task :validate => :encoding do
30
43
  ruby "w3c_validator.rb"
31
44
  end
32
45
 
@@ -34,10 +47,12 @@ namespace :guides do
34
47
  task :help do
35
48
  puts <<-help
36
49
 
37
- Guides are taken from the source directory, and the resulting HTML goes into the
50
+ Guides are taken from the source directory, and the result goes into the
38
51
  output directory. Assets are stored under files, and copied to output/files as
39
52
  part of the generation process.
40
53
 
54
+ You can generate HTML, Kindle or both formats using the `guides:generate` task.
55
+
41
56
  All this process is handled via rake tasks, here's a full list of them:
42
57
 
43
58
  #{%x[rake -T]}
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook
2
2
  icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency
3
- from the Jimmac icons to get round MS IE and FOP PNG incompatibilies.
3
+ from the Jimmac icons to get round MS IE and FOP PNG incompatibilities.
4
4
 
5
5
  Stuart Rackham
Binary file
Binary file
Binary file
Binary file
@@ -1,57 +1,59 @@
1
- function guideMenu(){
2
- if (document.getElementById('guides').style.display == "none") {
3
- document.getElementById('guides').style.display = "block";
4
- } else {
5
- document.getElementById('guides').style.display = "none";
6
- }
7
- }
8
-
9
- $.fn.selectGuide = function(guide){
1
+ $.fn.selectGuide = function(guide) {
10
2
  $("select", this).val(guide);
11
- }
3
+ };
12
4
 
13
- guidesIndex = {
14
- bind: function(){
5
+ var guidesIndex = {
6
+ bind: function() {
15
7
  var currentGuidePath = window.location.pathname;
16
8
  var currentGuide = currentGuidePath.substring(currentGuidePath.lastIndexOf("/")+1);
17
9
  $(".guides-index-small").
18
10
  on("change", "select", guidesIndex.navigate).
19
11
  selectGuide(currentGuide);
20
- $(".more-info-button:visible").click(function(e){
12
+ $(document).on("click", ".more-info-button", function(e){
21
13
  e.stopPropagation();
22
- if($(".more-info-links").is(":visible")){
14
+ if ($(".more-info-links").is(":visible")) {
23
15
  $(".more-info-links").addClass("s-hidden").unwrap();
24
16
  } else {
25
17
  $(".more-info-links").wrap("<div class='more-info-container'></div>").removeClass("s-hidden");
26
18
  }
27
- $(document).on("click", function(e){
28
- var $button = $(".more-info-button");
29
- var element;
19
+ });
20
+ $("#guidesMenu").on("click", function(e) {
21
+ $("#guides").toggle();
22
+ return false;
23
+ });
24
+ $(document).on("click", function(e){
25
+ e.stopPropagation();
26
+ var $button = $(".more-info-button");
27
+ var element;
30
28
 
31
- // Cross browser find the element that had the event
32
- if (e.target) element = e.target;
33
- else if (e.srcElement) element = e.srcElement;
29
+ // Cross browser find the element that had the event
30
+ if (e.target) element = e.target;
31
+ else if (e.srcElement) element = e.srcElement;
34
32
 
35
- // Defeat the older Safari bug:
36
- // http://www.quirksmode.org/js/events_properties.html
37
- if (element.nodeType == 3) element = element.parentNode;
33
+ // Defeat the older Safari bug:
34
+ // http://www.quirksmode.org/js/events_properties.html
35
+ if (element.nodeType === 3) element = element.parentNode;
38
36
 
39
- var $element = $(element);
37
+ var $element = $(element);
40
38
 
41
- var $container = $element.parents(".more-info-container");
39
+ var $container = $element.parents(".more-info-container");
42
40
 
43
- // We've captured a click outside the popup
44
- if($container.length == 0){
45
- $container = $button.next(".more-info-container");
46
- $container.find(".more-info-links").addClass("s-hidden").unwrap();
47
- $(document).off("click");
48
- }
49
- });
41
+ // We've captured a click outside the popup
42
+ if($container.length === 0){
43
+ $container = $button.next(".more-info-container");
44
+ $container.find(".more-info-links").addClass("s-hidden").unwrap();
45
+ }
50
46
  });
51
47
  },
52
48
  navigate: function(e){
53
49
  var $list = $(e.target);
54
- url = $list.val();
50
+ var url = $list.val();
55
51
  window.location = url;
56
52
  }
57
- }
53
+ };
54
+
55
+ // Disable autolink inside example code blocks of guides.
56
+ $(document).ready(function() {
57
+ SyntaxHighlighter.defaults['auto-links'] = false;
58
+ SyntaxHighlighter.all();
59
+ });