railties 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2201 -0
- data/README +286 -0
- data/bin/rails +11 -0
- data/builtin/rails_info/rails/info.rb +147 -0
- data/builtin/rails_info/rails/info_controller.rb +15 -0
- data/builtin/rails_info/rails/info_helper.rb +2 -0
- data/builtin/routes.rb +3 -0
- data/guides/files/javascripts/code_highlighter.js +188 -0
- data/guides/files/javascripts/guides.js +7 -0
- data/guides/files/javascripts/highlighters.js +90 -0
- data/guides/files/stylesheets/main.css +441 -0
- data/guides/files/stylesheets/print.css +52 -0
- data/guides/files/stylesheets/reset.css +43 -0
- data/guides/files/stylesheets/style.css +13 -0
- data/guides/files/stylesheets/syntax.css +31 -0
- data/guides/images/belongs_to.png +0 -0
- data/guides/images/book_icon.gif +0 -0
- data/guides/images/bullet.gif +0 -0
- data/guides/images/chapters_icon.gif +0 -0
- data/guides/images/check_bullet.gif +0 -0
- data/guides/images/credits_pic_blank.gif +0 -0
- data/guides/images/csrf.png +0 -0
- data/guides/images/customized_error_messages.png +0 -0
- data/guides/images/error_messages.png +0 -0
- data/guides/images/feature_tile.gif +0 -0
- data/guides/images/footer_tile.gif +0 -0
- data/guides/images/fxn.png +0 -0
- data/guides/images/grey_bullet.gif +0 -0
- data/guides/images/habtm.png +0 -0
- data/guides/images/has_many.png +0 -0
- data/guides/images/has_many_through.png +0 -0
- data/guides/images/has_one.png +0 -0
- data/guides/images/has_one_through.png +0 -0
- data/guides/images/header_backdrop.png +0 -0
- data/guides/images/header_tile.gif +0 -0
- data/guides/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/images/i18n/demo_translated_en.png +0 -0
- data/guides/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/images/i18n/demo_translation_missing.png +0 -0
- data/guides/images/i18n/demo_untranslated.png +0 -0
- data/guides/images/icons/README +5 -0
- data/guides/images/icons/callouts/1.png +0 -0
- data/guides/images/icons/callouts/10.png +0 -0
- data/guides/images/icons/callouts/11.png +0 -0
- data/guides/images/icons/callouts/12.png +0 -0
- data/guides/images/icons/callouts/13.png +0 -0
- data/guides/images/icons/callouts/14.png +0 -0
- data/guides/images/icons/callouts/15.png +0 -0
- data/guides/images/icons/callouts/2.png +0 -0
- data/guides/images/icons/callouts/3.png +0 -0
- data/guides/images/icons/callouts/4.png +0 -0
- data/guides/images/icons/callouts/5.png +0 -0
- data/guides/images/icons/callouts/6.png +0 -0
- data/guides/images/icons/callouts/7.png +0 -0
- data/guides/images/icons/callouts/8.png +0 -0
- data/guides/images/icons/callouts/9.png +0 -0
- data/guides/images/icons/caution.png +0 -0
- data/guides/images/icons/example.png +0 -0
- data/guides/images/icons/home.png +0 -0
- data/guides/images/icons/important.png +0 -0
- data/guides/images/icons/next.png +0 -0
- data/guides/images/icons/note.png +0 -0
- data/guides/images/icons/prev.png +0 -0
- data/guides/images/icons/tip.png +0 -0
- data/guides/images/icons/up.png +0 -0
- data/guides/images/icons/warning.png +0 -0
- data/guides/images/nav_arrow.gif +0 -0
- data/guides/images/polymorphic.png +0 -0
- data/guides/images/posts_index.png +0 -0
- data/guides/images/rails_guides_logo.gif +0 -0
- data/guides/images/rails_logo_remix.gif +0 -0
- data/guides/images/rails_welcome.png +0 -0
- data/guides/images/session_fixation.png +0 -0
- data/guides/images/tab_grey.gif +0 -0
- data/guides/images/tab_info.gif +0 -0
- data/guides/images/tab_note.gif +0 -0
- data/guides/images/tab_red.gif +0 -0
- data/guides/images/tab_yellow.gif +0 -0
- data/guides/images/tab_yellow.png +0 -0
- data/guides/images/validation_error_messages.png +0 -0
- data/guides/rails_guides.rb +44 -0
- data/guides/rails_guides/generator.rb +178 -0
- data/guides/rails_guides/helpers.rb +34 -0
- data/guides/rails_guides/indexer.rb +55 -0
- data/guides/rails_guides/levenshtein.rb +31 -0
- data/guides/rails_guides/textile_extensions.rb +41 -0
- data/guides/source/2_2_release_notes.textile +422 -0
- data/guides/source/2_3_release_notes.textile +610 -0
- data/guides/source/3_0_release_notes.textile +560 -0
- data/guides/source/action_controller_overview.textile +783 -0
- data/guides/source/action_mailer_basics.textile +437 -0
- data/guides/source/action_view_overview.textile +1481 -0
- data/guides/source/active_record_basics.textile +204 -0
- data/guides/source/active_record_querying.textile +961 -0
- data/guides/source/active_support_core_extensions.textile +1835 -0
- data/guides/source/activerecord_validations_callbacks.textile +1127 -0
- data/guides/source/ajax_on_rails.textile +342 -0
- data/guides/source/association_basics.textile +1816 -0
- data/guides/source/caching_with_rails.textile +390 -0
- data/guides/source/command_line.textile +589 -0
- data/guides/source/configuring.textile +290 -0
- data/guides/source/contribute.textile +71 -0
- data/guides/source/contributing_to_rails.textile +272 -0
- data/guides/source/credits.textile.erb +52 -0
- data/guides/source/debugging_rails_applications.textile +709 -0
- data/guides/source/form_helpers.textile +768 -0
- data/guides/source/generators.textile +378 -0
- data/guides/source/getting_started.textile +1310 -0
- data/guides/source/i18n.textile +879 -0
- data/guides/source/index.textile.erb +124 -0
- data/guides/source/layout.html.erb +103 -0
- data/guides/source/layouts_and_rendering.textile +979 -0
- data/guides/source/migrations.textile +591 -0
- data/guides/source/nested_model_forms.textile +222 -0
- data/guides/source/performance_testing.textile +531 -0
- data/guides/source/plugins.textile +1512 -0
- data/guides/source/rails_application_templates.textile +238 -0
- data/guides/source/rails_on_rack.textile +306 -0
- data/guides/source/routing.textile +903 -0
- data/guides/source/security.textile +984 -0
- data/guides/source/testing.textile +946 -0
- data/lib/generators/erb.rb +8 -0
- data/lib/generators/erb/controller/controller_generator.rb +21 -0
- data/lib/generators/erb/controller/templates/view.html.erb +2 -0
- data/lib/generators/erb/mailer/mailer_generator.rb +20 -0
- data/lib/generators/erb/mailer/templates/view.text.erb +3 -0
- data/lib/generators/erb/scaffold/scaffold_generator.rb +53 -0
- data/lib/generators/erb/scaffold/templates/_form.html.erb +13 -0
- data/lib/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/lib/generators/erb/scaffold/templates/index.html.erb +27 -0
- data/lib/generators/erb/scaffold/templates/layout.html.erb +16 -0
- data/lib/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/lib/generators/erb/scaffold/templates/show.html.erb +10 -0
- data/lib/generators/rails/app/USAGE +9 -0
- data/lib/generators/rails/app/app_generator.rb +262 -0
- data/lib/generators/rails/app/templates/Gemfile +34 -0
- data/lib/generators/rails/app/templates/README +243 -0
- data/lib/generators/rails/app/templates/Rakefile +10 -0
- data/lib/generators/rails/app/templates/app/controllers/application_controller.rb +3 -0
- data/lib/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/lib/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/app/views/layouts/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/config.ru +4 -0
- data/lib/generators/rails/app/templates/config/application.rb +51 -0
- data/lib/generators/rails/app/templates/config/boot.rb +17 -0
- data/lib/generators/rails/app/templates/config/databases/frontbase.yml +28 -0
- data/lib/generators/rails/app/templates/config/databases/ibm_db.yml +71 -0
- data/lib/generators/rails/app/templates/config/databases/mysql.yml +60 -0
- data/lib/generators/rails/app/templates/config/databases/oracle.yml +39 -0
- data/lib/generators/rails/app/templates/config/databases/postgresql.yml +51 -0
- data/lib/generators/rails/app/templates/config/databases/sqlite3.yml +22 -0
- data/lib/generators/rails/app/templates/config/environment.rb +5 -0
- data/lib/generators/rails/app/templates/config/environments/development.rb.tt +19 -0
- data/lib/generators/rails/app/templates/config/environments/production.rb.tt +33 -0
- data/lib/generators/rails/app/templates/config/environments/test.rb.tt +29 -0
- data/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt +7 -0
- data/lib/generators/rails/app/templates/config/initializers/inflections.rb +10 -0
- data/lib/generators/rails/app/templates/config/initializers/mime_types.rb +5 -0
- data/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt +15 -0
- data/lib/generators/rails/app/templates/config/locales/en.yml +5 -0
- data/lib/generators/rails/app/templates/config/routes.rb +58 -0
- data/lib/generators/rails/app/templates/db/seeds.rb +7 -0
- data/lib/generators/rails/app/templates/doc/README_FOR_APP +2 -0
- data/lib/generators/rails/app/templates/gitignore +4 -0
- data/lib/generators/rails/app/templates/public/404.html +26 -0
- data/lib/generators/rails/app/templates/public/422.html +26 -0
- data/lib/generators/rails/app/templates/public/500.html +26 -0
- data/lib/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/generators/rails/app/templates/public/images/rails.png +0 -0
- data/lib/generators/rails/app/templates/public/index.html +278 -0
- data/lib/generators/rails/app/templates/public/javascripts/application.js +2 -0
- data/lib/generators/rails/app/templates/public/javascripts/controls.js +963 -0
- data/lib/generators/rails/app/templates/public/javascripts/dragdrop.js +973 -0
- data/lib/generators/rails/app/templates/public/javascripts/effects.js +1128 -0
- data/lib/generators/rails/app/templates/public/javascripts/prototype.js +4320 -0
- data/lib/generators/rails/app/templates/public/javascripts/rails.js +110 -0
- data/lib/generators/rails/app/templates/public/robots.txt +5 -0
- data/lib/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/script/rails +9 -0
- data/lib/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/generators/rails/app/templates/test/performance/browsing_test.rb +9 -0
- data/lib/generators/rails/app/templates/test/test_helper.rb +13 -0
- data/lib/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/generators/rails/controller/USAGE +18 -0
- data/lib/generators/rails/controller/controller_generator.rb +14 -0
- data/lib/generators/rails/controller/templates/controller.rb +7 -0
- data/lib/generators/rails/generator/USAGE +11 -0
- data/lib/generators/rails/generator/generator_generator.rb +25 -0
- data/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt +5 -0
- data/lib/generators/rails/generator/templates/USAGE.tt +8 -0
- data/lib/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/generators/rails/helper/USAGE +17 -0
- data/lib/generators/rails/helper/helper_generator.rb +13 -0
- data/lib/generators/rails/helper/templates/helper.rb +2 -0
- data/lib/generators/rails/integration_test/USAGE +10 -0
- data/lib/generators/rails/integration_test/integration_test_generator.rb +7 -0
- data/lib/generators/rails/mailer/USAGE +15 -0
- data/lib/generators/rails/mailer/mailer_generator.rb +14 -0
- data/lib/generators/rails/mailer/templates/mailer.rb +16 -0
- data/lib/generators/rails/metal/USAGE +8 -0
- data/lib/generators/rails/metal/metal_generator.rb +11 -0
- data/lib/generators/rails/metal/templates/metal.rb +12 -0
- data/lib/generators/rails/migration/USAGE +29 -0
- data/lib/generators/rails/migration/migration_generator.rb +8 -0
- data/lib/generators/rails/model/USAGE +30 -0
- data/lib/generators/rails/model/model_generator.rb +8 -0
- data/lib/generators/rails/model_subclass/model_subclass_generator.rb +12 -0
- data/lib/generators/rails/observer/USAGE +12 -0
- data/lib/generators/rails/observer/observer_generator.rb +7 -0
- data/lib/generators/rails/performance_test/USAGE +10 -0
- data/lib/generators/rails/performance_test/performance_test_generator.rb +7 -0
- data/lib/generators/rails/plugin/USAGE +13 -0
- data/lib/generators/rails/plugin/plugin_generator.rb +47 -0
- data/lib/generators/rails/plugin/templates/MIT-LICENSE.tt +20 -0
- data/lib/generators/rails/plugin/templates/README.tt +13 -0
- data/lib/generators/rails/plugin/templates/Rakefile.tt +10 -0
- data/lib/generators/rails/plugin/templates/init.rb +1 -0
- data/lib/generators/rails/plugin/templates/install.rb +1 -0
- data/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt +1 -0
- data/lib/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +4 -0
- data/lib/generators/rails/plugin/templates/uninstall.rb +1 -0
- data/lib/generators/rails/resource/USAGE +23 -0
- data/lib/generators/rails/resource/resource_generator.rb +34 -0
- data/lib/generators/rails/scaffold/USAGE +29 -0
- data/lib/generators/rails/scaffold/scaffold_generator.rb +13 -0
- data/lib/generators/rails/scaffold_controller/USAGE +20 -0
- data/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb +27 -0
- data/lib/generators/rails/scaffold_controller/templates/controller.rb +85 -0
- data/lib/generators/rails/session_migration/USAGE +8 -0
- data/lib/generators/rails/session_migration/session_migration_generator.rb +8 -0
- data/lib/generators/rails/stylesheets/USAGE +5 -0
- data/lib/generators/rails/stylesheets/stylesheets_generator.rb +9 -0
- data/lib/generators/rails/stylesheets/templates/scaffold.css +61 -0
- data/lib/generators/test_unit.rb +8 -0
- data/lib/generators/test_unit/controller/controller_generator.rb +14 -0
- data/lib/generators/test_unit/controller/templates/functional_test.rb +8 -0
- data/lib/generators/test_unit/helper/helper_generator.rb +13 -0
- data/lib/generators/test_unit/helper/templates/helper_test.rb +4 -0
- data/lib/generators/test_unit/integration/integration_generator.rb +13 -0
- data/lib/generators/test_unit/integration/templates/integration_test.rb +10 -0
- data/lib/generators/test_unit/mailer/mailer_generator.rb +21 -0
- data/lib/generators/test_unit/mailer/templates/fixture +3 -0
- data/lib/generators/test_unit/mailer/templates/functional_test.rb +22 -0
- data/lib/generators/test_unit/model/model_generator.rb +24 -0
- data/lib/generators/test_unit/model/templates/fixtures.yml +23 -0
- data/lib/generators/test_unit/model/templates/unit_test.rb +8 -0
- data/lib/generators/test_unit/observer/observer_generator.rb +13 -0
- data/lib/generators/test_unit/observer/templates/unit_test.rb +8 -0
- data/lib/generators/test_unit/performance/performance_generator.rb +13 -0
- data/lib/generators/test_unit/performance/templates/performance_test.rb +9 -0
- data/lib/generators/test_unit/plugin/plugin_generator.rb +13 -0
- data/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +8 -0
- data/lib/generators/test_unit/plugin/templates/test_helper.rb +3 -0
- data/lib/generators/test_unit/scaffold/scaffold_generator.rb +18 -0
- data/lib/generators/test_unit/scaffold/templates/functional_test.rb +47 -0
- data/lib/rails.rb +95 -0
- data/lib/rails/all.rb +14 -0
- data/lib/rails/application.rb +125 -0
- data/lib/rails/application/bootstrap.rb +85 -0
- data/lib/rails/application/configurable.rb +19 -0
- data/lib/rails/application/configuration.rb +86 -0
- data/lib/rails/application/finisher.rb +49 -0
- data/lib/rails/application/metal_loader.rb +50 -0
- data/lib/rails/application/railties.rb +31 -0
- data/lib/rails/application/routes_reloader.rb +46 -0
- data/lib/rails/backtrace_cleaner.rb +54 -0
- data/lib/rails/code_statistics.rb +107 -0
- data/lib/rails/commands.rb +72 -0
- data/lib/rails/commands/application.rb +13 -0
- data/lib/rails/commands/console.rb +55 -0
- data/lib/rails/commands/dbconsole.rb +104 -0
- data/lib/rails/commands/destroy.rb +9 -0
- data/lib/rails/commands/generate.rb +9 -0
- data/lib/rails/commands/performance/benchmarker.rb +23 -0
- data/lib/rails/commands/performance/profiler.rb +46 -0
- data/lib/rails/commands/plugin.rb +542 -0
- data/lib/rails/commands/runner.rb +51 -0
- data/lib/rails/commands/server.rb +75 -0
- data/lib/rails/commands/update.rb +9 -0
- data/lib/rails/configuration.rb +191 -0
- data/lib/rails/console/app.rb +33 -0
- data/lib/rails/console/helpers.rb +5 -0
- data/lib/rails/console/sandbox.rb +6 -0
- data/lib/rails/deprecation.rb +62 -0
- data/lib/rails/dispatcher.rb +24 -0
- data/lib/rails/engine.rb +130 -0
- data/lib/rails/engine/configurable.rb +25 -0
- data/lib/rails/engine/configuration.rb +49 -0
- data/lib/rails/generators.rb +289 -0
- data/lib/rails/generators/actions.rb +309 -0
- data/lib/rails/generators/active_model.rb +78 -0
- data/lib/rails/generators/base.rb +362 -0
- data/lib/rails/generators/generated_attribute.rb +48 -0
- data/lib/rails/generators/migration.rb +64 -0
- data/lib/rails/generators/named_base.rb +95 -0
- data/lib/rails/generators/resource_helpers.rb +80 -0
- data/lib/rails/generators/test_case.rb +239 -0
- data/lib/rails/initializable.rb +97 -0
- data/lib/rails/paths.rb +144 -0
- data/lib/rails/performance_test_help.rb +3 -0
- data/lib/rails/plugin.rb +64 -0
- data/lib/rails/rack.rb +8 -0
- data/lib/rails/rack/debugger.rb +23 -0
- data/lib/rails/rack/log_tailer.rb +33 -0
- data/lib/rails/rack/logger.rb +34 -0
- data/lib/rails/rack/static.rb +5 -0
- data/lib/rails/railtie.rb +74 -0
- data/lib/rails/railtie/configurable.rb +23 -0
- data/lib/rails/railtie/configuration.rb +9 -0
- data/lib/rails/railties_path.rb +1 -0
- data/lib/rails/ruby_version_check.rb +10 -0
- data/lib/rails/rubyprof_ext.rb +35 -0
- data/lib/rails/source_annotation_extractor.rb +102 -0
- data/lib/rails/subscriber.rb +108 -0
- data/lib/rails/subscriber/test_helper.rb +98 -0
- data/lib/rails/tasks.rb +16 -0
- data/lib/rails/tasks/annotations.rake +20 -0
- data/lib/rails/tasks/documentation.rake +96 -0
- data/lib/rails/tasks/framework.rake +69 -0
- data/lib/rails/tasks/log.rake +9 -0
- data/lib/rails/tasks/middleware.rake +7 -0
- data/lib/rails/tasks/misc.rake +71 -0
- data/lib/rails/tasks/routes.rake +17 -0
- data/lib/rails/tasks/statistics.rake +16 -0
- data/lib/rails/tasks/tmp.rake +37 -0
- data/lib/rails/test_help.rb +30 -0
- data/lib/rails/test_unit/railtie.rb +17 -0
- data/lib/rails/test_unit/testing.rake +130 -0
- data/lib/rails/version.rb +9 -0
- data/lib/rails/webrick_server.rb +156 -0
- metadata +427 -0
@@ -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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,44 @@
|
|
1
|
+
pwd = File.dirname(__FILE__)
|
2
|
+
$:.unshift pwd
|
3
|
+
|
4
|
+
# Loading Action Pack requires rack and erubis.
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
begin
|
8
|
+
as_lib = File.join(pwd, "../../activesupport/lib")
|
9
|
+
ap_lib = File.join(pwd, "../../actionpack/lib")
|
10
|
+
|
11
|
+
$: << as_lib if File.directory?(as_lib)
|
12
|
+
$: << ap_lib if File.directory?(ap_lib)
|
13
|
+
|
14
|
+
require "action_controller"
|
15
|
+
require "action_view"
|
16
|
+
rescue LoadError
|
17
|
+
gem "actionpack", '>= 2.3'
|
18
|
+
|
19
|
+
require "action_controller"
|
20
|
+
require "action_view"
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
gem 'RedCloth', '>= 4.1.1'
|
25
|
+
rescue Gem::LoadError
|
26
|
+
$stderr.puts %(Generating Guides requires RedCloth 4.1.1+)
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'redcloth'
|
31
|
+
|
32
|
+
module RailsGuides
|
33
|
+
autoload :Generator, "rails_guides/generator"
|
34
|
+
autoload :Indexer, "rails_guides/indexer"
|
35
|
+
autoload :Helpers, "rails_guides/helpers"
|
36
|
+
autoload :TextileExtensions, "rails_guides/textile_extensions"
|
37
|
+
autoload :Levenshtein, "rails_guides/levenshtein"
|
38
|
+
end
|
39
|
+
|
40
|
+
RedCloth.send(:include, RailsGuides::TextileExtensions)
|
41
|
+
|
42
|
+
if $0 == __FILE__
|
43
|
+
RailsGuides::Generator.new.generate
|
44
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
class String
|
4
|
+
def html_safe!
|
5
|
+
self
|
6
|
+
end unless "post 9415935902f120a9bac0bfce7129725a0db38ed3".respond_to?(:html_safe!)
|
7
|
+
end
|
8
|
+
|
9
|
+
module RailsGuides
|
10
|
+
class Generator
|
11
|
+
attr_reader :output, :view_path, :view, :guides_dir
|
12
|
+
|
13
|
+
def initialize(output = nil)
|
14
|
+
@guides_dir = File.join(File.dirname(__FILE__), '..')
|
15
|
+
|
16
|
+
@output = output || File.join(@guides_dir, "output")
|
17
|
+
|
18
|
+
unless ENV["ONLY"]
|
19
|
+
FileUtils.rm_r(@output) if File.directory?(@output)
|
20
|
+
FileUtils.mkdir(@output)
|
21
|
+
end
|
22
|
+
|
23
|
+
@view_path = File.join(@guides_dir, "source")
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate
|
27
|
+
guides = Dir.entries(view_path).find_all {|g| g =~ /\.textile(?:\.erb)?$/ }
|
28
|
+
|
29
|
+
if ENV["ONLY"]
|
30
|
+
only = ENV["ONLY"].split(",").map{|x| x.strip }.map {|o| "#{o}.textile" }
|
31
|
+
guides = guides.find_all {|g| only.include?(g) }
|
32
|
+
puts "GENERATING ONLY #{guides.inspect}"
|
33
|
+
end
|
34
|
+
|
35
|
+
guides.each do |guide|
|
36
|
+
generate_guide(guide)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Copy images and css files to html directory
|
40
|
+
FileUtils.cp_r File.join(guides_dir, 'images'), File.join(output, 'images')
|
41
|
+
FileUtils.cp_r File.join(guides_dir, 'files'), File.join(output, 'files')
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_guide(guide)
|
45
|
+
guide =~ /(.*?)\.textile(?:\.erb)?$/
|
46
|
+
name = $1
|
47
|
+
|
48
|
+
puts "Generating #{name}"
|
49
|
+
|
50
|
+
file = File.join(output, "#{name}.html")
|
51
|
+
File.open(file, 'w') do |f|
|
52
|
+
@view = ActionView::Base.new(view_path)
|
53
|
+
@view.extend(Helpers)
|
54
|
+
|
55
|
+
if guide =~ /\.textile\.erb$/
|
56
|
+
# Generate the erb pages with textile formatting - e.g. index/authors
|
57
|
+
result = view.render(:layout => 'layout', :file => guide)
|
58
|
+
f.write textile(result)
|
59
|
+
else
|
60
|
+
body = File.read(File.join(view_path, guide))
|
61
|
+
body = set_header_section(body, @view)
|
62
|
+
body = set_index(body, @view)
|
63
|
+
|
64
|
+
result = view.render(:layout => 'layout', :text => textile(body).html_safe!)
|
65
|
+
f.write result
|
66
|
+
warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def set_header_section(body, view)
|
72
|
+
new_body = body.gsub(/(.*?)endprologue\./m, '').strip
|
73
|
+
header = $1
|
74
|
+
|
75
|
+
header =~ /h2\.(.*)/
|
76
|
+
page_title = $1.strip
|
77
|
+
|
78
|
+
header = textile(header)
|
79
|
+
|
80
|
+
view.content_for(:page_title) { page_title.html_safe! }
|
81
|
+
view.content_for(:header_section) { header.html_safe! }
|
82
|
+
new_body
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_index(body, view)
|
86
|
+
index = <<-INDEX
|
87
|
+
<div id="subCol">
|
88
|
+
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
|
89
|
+
<ol class="chapters">
|
90
|
+
INDEX
|
91
|
+
|
92
|
+
i = Indexer.new(body)
|
93
|
+
i.index
|
94
|
+
|
95
|
+
# Set index for 2 levels
|
96
|
+
i.level_hash.each do |key, value|
|
97
|
+
link = view.content_tag(:a, :href => key[:id]) { textile(key[:title]) }
|
98
|
+
|
99
|
+
children = value.keys.map do |k|
|
100
|
+
l = view.content_tag(:a, :href => k[:id]) { textile(k[:title]) }
|
101
|
+
view.content_tag(:li, l)
|
102
|
+
end
|
103
|
+
|
104
|
+
children_ul = view.content_tag(:ul, children.join(" "))
|
105
|
+
|
106
|
+
index << view.content_tag(:li, link + children_ul)
|
107
|
+
end
|
108
|
+
|
109
|
+
index << '</ol>'
|
110
|
+
index << '</div>'
|
111
|
+
|
112
|
+
view.content_for(:index_section) { index.html_safe! }
|
113
|
+
|
114
|
+
i.result
|
115
|
+
end
|
116
|
+
|
117
|
+
def textile(body)
|
118
|
+
# If the issue with notextile is fixed just remove the wrapper.
|
119
|
+
with_workaround_for_notextile(body) do |body|
|
120
|
+
t = RedCloth.new(body)
|
121
|
+
t.hard_breaks = false
|
122
|
+
t.to_html(:notestuff, :plusplus, :code, :tip)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# For some reason the notextile tag does not always turn off textile. See
|
127
|
+
# LH ticket of the security guide (#7). As a temporary workaround we deal
|
128
|
+
# with code blocks by hand.
|
129
|
+
def with_workaround_for_notextile(body)
|
130
|
+
code_blocks = []
|
131
|
+
body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)</\1>}m) do |m|
|
132
|
+
es = ERB::Util.h($2)
|
133
|
+
css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
|
134
|
+
code_blocks << %{<div class="code_container"><code class="#{css_class}">#{es}</code></div>}
|
135
|
+
"\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n"
|
136
|
+
end
|
137
|
+
|
138
|
+
body = yield body
|
139
|
+
|
140
|
+
body.gsub(%r{<p>dirty_workaround_for_notextile_(\d+)</p>}) do |_|
|
141
|
+
code_blocks[$1.to_i]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def warn_about_broken_links(html)
|
146
|
+
anchors = extract_anchors(html)
|
147
|
+
check_fragment_identifiers(html, anchors)
|
148
|
+
end
|
149
|
+
|
150
|
+
def extract_anchors(html)
|
151
|
+
# Textile generates headers with IDs computed from titles.
|
152
|
+
anchors = Set.new
|
153
|
+
html.scan(/<h\d\s+id="([^"]+)/).flatten.each do |anchor|
|
154
|
+
if anchors.member?(anchor)
|
155
|
+
puts "*** DUPLICATE HEADER ID: #{anchor}, please consider rewording" if ENV.key?("WARN_DUPLICATE_HEADERS")
|
156
|
+
else
|
157
|
+
anchors << anchor
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Also, footnotes are rendered as paragraphs this way.
|
162
|
+
anchors += Set.new(html.scan(/<p\s+class="footnote"\s+id="([^"]+)/).flatten)
|
163
|
+
return anchors
|
164
|
+
end
|
165
|
+
|
166
|
+
def check_fragment_identifiers(html, anchors)
|
167
|
+
html.scan(/<a\s+href="#([^"]+)/).flatten.each do |fragment_identifier|
|
168
|
+
next if fragment_identifier == 'mainCol' # in layout, jumps to some DIV
|
169
|
+
unless anchors.member?(fragment_identifier)
|
170
|
+
guess = anchors.min { |a, b|
|
171
|
+
Levenshtein.distance(fragment_identifier, a) <=> Levenshtein.distance(fragment_identifier, b)
|
172
|
+
}
|
173
|
+
puts "*** BROKEN LINK: ##{fragment_identifier}, perhaps you meant ##{guess}."
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|