rails 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (118) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +11 -9
  3. data/configs/routes.rb +1 -1
  4. data/guides/files/javascripts/code_highlighter.js +188 -0
  5. data/guides/files/javascripts/guides.js +8 -0
  6. data/guides/files/javascripts/highlighters.js +90 -0
  7. data/guides/files/stylesheets/main.css +441 -0
  8. data/guides/files/stylesheets/print.css +52 -0
  9. data/guides/files/stylesheets/reset.css +43 -0
  10. data/guides/files/stylesheets/style.css +13 -0
  11. data/guides/files/stylesheets/syntax.css +31 -0
  12. data/guides/images/belongs_to.png +0 -0
  13. data/guides/images/book_icon.gif +0 -0
  14. data/guides/images/bullet.gif +0 -0
  15. data/guides/images/chapters_icon.gif +0 -0
  16. data/guides/images/check_bullet.gif +0 -0
  17. data/guides/images/credits_pic_blank.gif +0 -0
  18. data/guides/images/csrf.png +0 -0
  19. data/guides/images/customized_error_messages.png +0 -0
  20. data/guides/images/error_messages.png +0 -0
  21. data/guides/images/feature_tile.gif +0 -0
  22. data/guides/images/footer_tile.gif +0 -0
  23. data/guides/images/fxn.jpg +0 -0
  24. data/guides/images/grey_bullet.gif +0 -0
  25. data/guides/images/habtm.png +0 -0
  26. data/guides/images/has_many.png +0 -0
  27. data/guides/images/has_many_through.png +0 -0
  28. data/guides/images/has_one.png +0 -0
  29. data/guides/images/has_one_through.png +0 -0
  30. data/guides/images/header_backdrop.png +0 -0
  31. data/guides/images/header_tile.gif +0 -0
  32. data/guides/images/i18n/demo_localized_pirate.png +0 -0
  33. data/guides/images/i18n/demo_translated_en.png +0 -0
  34. data/guides/images/i18n/demo_translated_pirate.png +0 -0
  35. data/guides/images/i18n/demo_translation_missing.png +0 -0
  36. data/guides/images/i18n/demo_untranslated.png +0 -0
  37. data/guides/images/icons/README +5 -0
  38. data/guides/images/icons/callouts/1.png +0 -0
  39. data/guides/images/icons/callouts/10.png +0 -0
  40. data/guides/images/icons/callouts/11.png +0 -0
  41. data/guides/images/icons/callouts/12.png +0 -0
  42. data/guides/images/icons/callouts/13.png +0 -0
  43. data/guides/images/icons/callouts/14.png +0 -0
  44. data/guides/images/icons/callouts/15.png +0 -0
  45. data/guides/images/icons/callouts/2.png +0 -0
  46. data/guides/images/icons/callouts/3.png +0 -0
  47. data/guides/images/icons/callouts/4.png +0 -0
  48. data/guides/images/icons/callouts/5.png +0 -0
  49. data/guides/images/icons/callouts/6.png +0 -0
  50. data/guides/images/icons/callouts/7.png +0 -0
  51. data/guides/images/icons/callouts/8.png +0 -0
  52. data/guides/images/icons/callouts/9.png +0 -0
  53. data/guides/images/icons/caution.png +0 -0
  54. data/guides/images/icons/example.png +0 -0
  55. data/guides/images/icons/home.png +0 -0
  56. data/guides/images/icons/important.png +0 -0
  57. data/guides/images/icons/next.png +0 -0
  58. data/guides/images/icons/note.png +0 -0
  59. data/guides/images/icons/prev.png +0 -0
  60. data/guides/images/icons/tip.png +0 -0
  61. data/guides/images/icons/up.png +0 -0
  62. data/guides/images/icons/warning.png +0 -0
  63. data/guides/images/nav_arrow.gif +0 -0
  64. data/guides/images/polymorphic.png +0 -0
  65. data/guides/images/posts_index.png +0 -0
  66. data/guides/images/rails_guides_logo.gif +0 -0
  67. data/guides/images/rails_logo_remix.gif +0 -0
  68. data/guides/images/rails_welcome.png +0 -0
  69. data/guides/images/session_fixation.png +0 -0
  70. data/guides/images/tab_grey.gif +0 -0
  71. data/guides/images/tab_info.gif +0 -0
  72. data/guides/images/tab_note.gif +0 -0
  73. data/guides/images/tab_red.gif +0 -0
  74. data/guides/images/tab_yellow.gif +0 -0
  75. data/guides/images/tab_yellow.png +0 -0
  76. data/guides/images/validation_error_messages.png +0 -0
  77. data/guides/rails_guides.rb +42 -0
  78. data/guides/rails_guides/generator.rb +138 -0
  79. data/guides/rails_guides/helpers.rb +34 -0
  80. data/guides/rails_guides/indexer.rb +55 -0
  81. data/guides/rails_guides/textile_extensions.rb +41 -0
  82. data/guides/source/2_2_release_notes.textile +422 -0
  83. data/guides/source/2_3_release_notes.textile +610 -0
  84. data/guides/source/action_controller_overview.textile +776 -0
  85. data/guides/source/action_mailer_basics.textile +424 -0
  86. data/guides/source/active_record_basics.textile +135 -0
  87. data/guides/source/active_record_querying.textile +969 -0
  88. data/guides/source/activerecord_validations_callbacks.textile +1086 -0
  89. data/guides/source/association_basics.textile +1781 -0
  90. data/guides/source/caching_with_rails.textile +524 -0
  91. data/guides/source/command_line.textile +589 -0
  92. data/guides/source/configuring.textile +234 -0
  93. data/guides/source/contribute.textile +71 -0
  94. data/guides/source/contributing_to_rails.textile +239 -0
  95. data/guides/source/credits.erb.textile +52 -0
  96. data/guides/source/debugging_rails_applications.textile +709 -0
  97. data/guides/source/form_helpers.textile +766 -0
  98. data/guides/source/getting_started.textile +1297 -0
  99. data/guides/source/i18n.textile +912 -0
  100. data/guides/source/index.erb.textile +124 -0
  101. data/guides/source/layout.html.erb +103 -0
  102. data/guides/source/layouts_and_rendering.textile +979 -0
  103. data/guides/source/migrations.textile +591 -0
  104. data/guides/source/nested_model_forms.textile +222 -0
  105. data/guides/source/performance_testing.textile +531 -0
  106. data/guides/source/plugins.textile +1512 -0
  107. data/guides/source/rails_on_rack.textile +309 -0
  108. data/guides/source/routing.textile +903 -0
  109. data/guides/source/security.textile +986 -0
  110. data/guides/source/testing.textile +951 -0
  111. data/lib/commands/performance/profiler.rb +1 -1
  112. data/lib/initializer.rb +27 -4
  113. data/lib/rails/gem_dependency.rb +35 -6
  114. data/lib/rails/rack/metal.rb +1 -1
  115. data/lib/rails/version.rb +1 -1
  116. data/lib/tasks/gems.rake +19 -6
  117. data/lib/test_help.rb +4 -1
  118. metadata +123 -7
@@ -0,0 +1,52 @@
1
+ /* Guides.rubyonrails.org */
2
+ /* Print.css */
3
+ /* Created January 30, 2009 */
4
+ /* Modified January 31, 2009
5
+ --------------------------------------- */
6
+
7
+ body, .wrapper, .note, .info, code, #topNav, .L, .R, #frame, #container, #header, #navigation, #footer, #feature, #mainCol, #subCol, #extraCol, .content {position: static; text-align: left; text-indent: 0; background: White; color: Black; border-color: Black; width: auto; height: auto; display: block; float: none; min-height: 0; margin: 0; padding: 0;}
8
+
9
+ body {
10
+ background: #FFF;
11
+ font-size: 10pt !important;
12
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
13
+ line-height: 1.5;
14
+ color: #000;
15
+ padding: 0 3%;
16
+ }
17
+
18
+ .hide, .nav {
19
+ display: none !important;
20
+ }
21
+
22
+ a:link, a:visited {
23
+ background: transparent;
24
+ font-weight: bold;
25
+ text-decoration: underline;
26
+ }
27
+
28
+ hr {
29
+ background:#ccc;
30
+ color:#ccc;
31
+ width:100%;
32
+ height:2px;
33
+ margin:2em 0;
34
+ padding:0;
35
+ border:none;
36
+ }
37
+
38
+ h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; }
39
+ code { font:.9em "Courier New", Monaco, Courier, monospace; }
40
+
41
+ img { float:left; margin:1.5em 1.5em 1.5em 0; }
42
+ a img { border:none; }
43
+
44
+ blockquote {
45
+ margin:1.5em;
46
+ padding:1em;
47
+ font-style:italic;
48
+ font-size:.9em;
49
+ }
50
+
51
+ .small { font-size: .9em; }
52
+ .large { font-size: 1.1em; }
@@ -0,0 +1,43 @@
1
+ /* Guides.rubyonrails.org */
2
+ /* Reset.css */
3
+ /* Created January 30, 2009
4
+ --------------------------------------- */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, font, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td {
15
+ margin: 0;
16
+ padding: 0;
17
+ border: 0;
18
+ outline: 0;
19
+ font-size: 100%;
20
+ background: transparent;
21
+ }
22
+
23
+ body {line-height: 1; color: black; background: white;}
24
+ a img {border:none;}
25
+ ins {text-decoration: none;}
26
+ del {text-decoration: line-through;}
27
+
28
+ :focus {
29
+ -moz-outline:0;
30
+ outline:0;
31
+ outline-offset:0;
32
+ }
33
+
34
+ /* tables still need 'cellspacing="0"' in the markup */
35
+ table {border-collapse: collapse; border-spacing: 0;}
36
+ caption, th, td {text-align: left; font-weight: normal;}
37
+
38
+ blockquote, q {quotes: none;}
39
+ blockquote:before, blockquote:after,
40
+ q:before, q:after {
41
+ content: '';
42
+ content: none;
43
+ }
@@ -0,0 +1,13 @@
1
+ /* Guides.rubyonrails.org */
2
+ /* Style.css */
3
+ /* Created January 30, 2009
4
+ --------------------------------------- */
5
+
6
+ /*
7
+ ---------------------------------------
8
+ Import advanced style sheet
9
+ ---------------------------------------
10
+ */
11
+
12
+ @import url("reset.css");
13
+ @import url("main.css");
@@ -0,0 +1,31 @@
1
+ .html .tag {
2
+ color : green;
3
+ }
4
+
5
+ .html .doctype {
6
+ color: #708090;
7
+ }
8
+
9
+ .erb .tag {
10
+ color : green;
11
+ }
12
+
13
+ .erb .doctype {
14
+ color: #708090;
15
+ }
16
+
17
+ .ruby .keywords {
18
+ color : red;
19
+ }
20
+
21
+ .ruby .ivar {
22
+ color : blue;
23
+ }
24
+
25
+ .ruby .comment {
26
+ color: #708090;
27
+ }
28
+
29
+ .ruby .symbol {
30
+ color: green;
31
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook
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.
4
+
5
+ Stuart Rackham
Binary file
@@ -0,0 +1,42 @@
1
+ pwd = File.dirname(__FILE__)
2
+ $: << pwd
3
+
4
+ begin
5
+ as_lib = File.join(pwd, "../../activesupport/lib")
6
+ ap_lib = File.join(pwd, "../../actionpack/lib")
7
+
8
+ $: << as_lib if File.directory?(as_lib)
9
+ $: << ap_lib if File.directory?(ap_lib)
10
+
11
+ require "action_controller"
12
+ require "action_view"
13
+ rescue LoadError
14
+ require 'rubygems'
15
+ gem "actionpack", '>= 2.3'
16
+
17
+ require "action_controller"
18
+ require "action_view"
19
+ end
20
+
21
+ begin
22
+ require 'rubygems'
23
+ gem 'RedCloth', '>= 4.1.1'
24
+ rescue Gem::LoadError
25
+ $stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
26
+ exit 1
27
+ end
28
+
29
+ require 'redcloth'
30
+
31
+ module RailsGuides
32
+ autoload :Generator, "rails_guides/generator"
33
+ autoload :Indexer, "rails_guides/indexer"
34
+ autoload :Helpers, "rails_guides/helpers"
35
+ autoload :TextileExtensions, "rails_guides/textile_extensions"
36
+ end
37
+
38
+ RedCloth.send(:include, RailsGuides::TextileExtensions)
39
+
40
+ if $0 == __FILE__
41
+ RailsGuides::Generator.new.generate
42
+ end
@@ -0,0 +1,138 @@
1
+ require 'set'
2
+
3
+ module RailsGuides
4
+ class Generator
5
+ attr_reader :output, :view_path, :view, :guides_dir
6
+
7
+ def initialize(output = nil)
8
+ @guides_dir = File.join(File.dirname(__FILE__), '..')
9
+
10
+ @output = output || File.join(@guides_dir, "output")
11
+
12
+ unless ENV["ONLY"]
13
+ FileUtils.rm_r(@output) if File.directory?(@output)
14
+ FileUtils.mkdir(@output)
15
+ end
16
+
17
+ @view_path = File.join(@guides_dir, "source")
18
+ end
19
+
20
+ def generate
21
+ guides = Dir.entries(view_path).find_all {|g| g =~ /textile$/ }
22
+
23
+ if ENV["ONLY"]
24
+ only = ENV["ONLY"].split(",").map{|x| x.strip }.map {|o| "#{o}.textile" }
25
+ guides = guides.find_all {|g| only.include?(g) }
26
+ puts "GENERATING ONLY #{guides.inspect}"
27
+ end
28
+
29
+ guides.each do |guide|
30
+ generate_guide(guide)
31
+ end
32
+
33
+ # Copy images and css files to html directory
34
+ FileUtils.cp_r File.join(guides_dir, 'images'), File.join(output, 'images')
35
+ FileUtils.cp_r File.join(guides_dir, 'files'), File.join(output, 'files')
36
+ end
37
+
38
+ def generate_guide(guide)
39
+ guide =~ /(.*?)(\.erb)?\.textile/
40
+ name = $1
41
+
42
+ puts "Generating #{name}"
43
+
44
+ file = File.join(output, "#{name}.html")
45
+ File.open(file, 'w') do |f|
46
+ @view = ActionView::Base.new(view_path)
47
+ @view.extend(Helpers)
48
+
49
+ if guide =~ /\.erb\.textile/
50
+ # Generate the erb pages with textile formatting - e.g. index/authors
51
+ result = view.render(:layout => 'layout', :file => name)
52
+ f.write textile(result)
53
+ else
54
+ body = File.read(File.join(view_path, guide))
55
+ body = set_header_section(body, @view)
56
+ body = set_index(body, @view)
57
+
58
+ result = view.render(:layout => 'layout', :text => textile(body))
59
+ f.write result
60
+ end
61
+ end
62
+ end
63
+
64
+ def set_header_section(body, view)
65
+ new_body = body.gsub(/(.*?)endprologue\./m, '').strip
66
+ header = $1
67
+
68
+ header =~ /h2\.(.*)/
69
+ page_title = $1.strip
70
+
71
+ header = textile(header)
72
+
73
+ view.content_for(:page_title) { page_title }
74
+ view.content_for(:header_section) { header }
75
+ new_body
76
+ end
77
+
78
+ def set_index(body, view)
79
+ index = <<-INDEX
80
+ <div id="subCol">
81
+ <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
82
+ <ol class="chapters">
83
+ INDEX
84
+
85
+ i = Indexer.new(body)
86
+ i.index
87
+
88
+ # Set index for 2 levels
89
+ i.level_hash.each do |key, value|
90
+ link = view.content_tag(:a, :href => key[:id]) { textile(key[:title]) }
91
+
92
+ children = value.keys.map do |k|
93
+ l = view.content_tag(:a, :href => k[:id]) { textile(k[:title]) }
94
+ view.content_tag(:li, l)
95
+ end
96
+
97
+ children_ul = view.content_tag(:ul, children)
98
+
99
+ index << view.content_tag(:li, link + children_ul)
100
+ end
101
+
102
+ index << '</ol>'
103
+ index << '</div>'
104
+
105
+ view.content_for(:index_section) { index }
106
+
107
+ i.result
108
+ end
109
+
110
+ def textile(body)
111
+ # If the issue with notextile is fixed just remove the wrapper.
112
+ with_workaround_for_notextile(body) do |body|
113
+ t = RedCloth.new(body)
114
+ t.hard_breaks = false
115
+ t.to_html(:notestuff, :plusplus, :code, :tip)
116
+ end
117
+ end
118
+
119
+ # For some reason the notextile tag does not always turn off textile. See
120
+ # LH ticket of the security guide (#7). As a temporary workaround we deal
121
+ # with code blocks by hand.
122
+ def with_workaround_for_notextile(body)
123
+ code_blocks = []
124
+ body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)</\1>}m) do |m|
125
+ es = ERB::Util.h($2)
126
+ css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
127
+ code_blocks << %{<div class="code_container"><code class="#{css_class}">#{es}</code></div>}
128
+ "\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n"
129
+ end
130
+
131
+ body = yield body
132
+
133
+ body.gsub(%r{<p>dirty_workaround_for_notextile_(\d+)</p>}) do |_|
134
+ code_blocks[$1.to_i]
135
+ end
136
+ end
137
+ end
138
+ end