rails 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (77) hide show
  1. data/CHANGELOG +46 -0
  2. data/README +36 -8
  3. data/Rakefile +18 -25
  4. data/bin/console +17 -30
  5. data/bin/console_sandbox.rb +6 -0
  6. data/bin/destroy +5 -0
  7. data/bin/generate +2 -70
  8. data/bin/rails +4 -28
  9. data/bin/server +4 -2
  10. data/bin/update +5 -0
  11. data/configs/apache.conf +7 -54
  12. data/configs/empty.log +0 -0
  13. data/configs/routes.rb +15 -0
  14. data/environments/shared.rb +14 -6
  15. data/environments/shared_for_gem.rb +12 -6
  16. data/fresh_rakefile +40 -8
  17. data/html/index.html +70 -1
  18. data/lib/breakpoint.rb +6 -1
  19. data/lib/breakpoint_client.rb +196 -193
  20. data/lib/dispatcher.rb +16 -38
  21. data/lib/rails_generator.rb +39 -198
  22. data/lib/rails_generator/base.rb +203 -0
  23. data/lib/rails_generator/commands.rb +409 -0
  24. data/lib/rails_generator/generators/applications/app/USAGE +16 -0
  25. data/lib/rails_generator/generators/applications/app/app_generator.rb +120 -0
  26. data/lib/rails_generator/generators/components/controller/USAGE +30 -0
  27. data/lib/rails_generator/generators/components/controller/controller_generator.rb +37 -0
  28. data/{generators → lib/rails_generator/generators/components}/controller/templates/controller.rb +1 -1
  29. data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +18 -0
  30. data/{generators → lib/rails_generator/generators/components}/controller/templates/helper.rb +0 -0
  31. data/{generators → lib/rails_generator/generators/components}/controller/templates/view.rhtml +0 -0
  32. data/lib/rails_generator/generators/components/mailer/USAGE +19 -0
  33. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +32 -0
  34. data/{generators → lib/rails_generator/generators/components}/mailer/templates/fixture.rhtml +0 -0
  35. data/{generators → lib/rails_generator/generators/components}/mailer/templates/mailer.rb +0 -0
  36. data/{generators → lib/rails_generator/generators/components}/mailer/templates/unit_test.rb +7 -1
  37. data/{generators → lib/rails_generator/generators/components}/mailer/templates/view.rhtml +0 -0
  38. data/lib/rails_generator/generators/components/model/USAGE +17 -0
  39. data/lib/rails_generator/generators/components/model/model_generator.rb +18 -0
  40. data/{generators/scaffold → lib/rails_generator/generators/components/model}/templates/fixtures.yml +0 -2
  41. data/{generators → lib/rails_generator/generators/components}/model/templates/model.rb +0 -0
  42. data/{generators → lib/rails_generator/generators/components}/model/templates/unit_test.rb +5 -1
  43. data/lib/rails_generator/generators/components/scaffold/USAGE +32 -0
  44. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +178 -0
  45. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/controller.rb +1 -1
  46. data/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +5 -0
  47. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/functional_test.rb +7 -6
  48. data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +2 -0
  49. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/layout.rhtml +1 -1
  50. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/style.css +17 -17
  51. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_edit.rhtml +1 -1
  52. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_list.rhtml +1 -1
  53. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_new.rhtml +1 -1
  54. data/{generators → lib/rails_generator/generators/components}/scaffold/templates/view_show.rhtml +0 -0
  55. data/lib/rails_generator/lookup.rb +200 -0
  56. data/lib/rails_generator/manifest.rb +53 -0
  57. data/lib/rails_generator/options.rb +134 -0
  58. data/lib/rails_generator/scripts.rb +83 -0
  59. data/lib/rails_generator/scripts/destroy.rb +7 -0
  60. data/lib/rails_generator/scripts/generate.rb +7 -0
  61. data/lib/rails_generator/scripts/update.rb +12 -0
  62. data/lib/rails_generator/simple_logger.rb +46 -0
  63. data/lib/rails_generator/spec.rb +44 -0
  64. data/lib/webrick_server.rb +15 -65
  65. metadata +92 -48
  66. data/doc/apache_protection +0 -3
  67. data/doc/index.html +0 -70
  68. data/generators/controller/USAGE +0 -28
  69. data/generators/controller/controller_generator.rb +0 -26
  70. data/generators/controller/templates/functional_test.rb +0 -17
  71. data/generators/mailer/USAGE +0 -27
  72. data/generators/mailer/mailer_generator.rb +0 -22
  73. data/generators/model/USAGE +0 -17
  74. data/generators/model/model_generator.rb +0 -10
  75. data/generators/model/templates/fixtures.yml +0 -1
  76. data/generators/scaffold/USAGE +0 -27
  77. data/generators/scaffold/scaffold_generator.rb +0 -60
@@ -1,3 +0,0 @@
1
- Order Deny,Allow
2
- Deny from all
3
- Allow from 127.0.0.1
@@ -1,70 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Rails: Welcome on board</title>
4
- <style>
5
- body { background-color: #fff; color: #333; }
6
-
7
- body, p, ol, ul, td {
8
- font-family: verdana, arial, helvetica, sans-serif;
9
- font-size: 12px;
10
- line-height: 18px;
11
- }
12
-
13
- li {
14
- margin-bottom: 7px;
15
- }
16
-
17
- pre {
18
- background-color: #eee;
19
- padding: 10px;
20
- font-size: 11px;
21
- }
22
-
23
- a { color: #000; }
24
- a:visited { color: #666; }
25
- a:hover { color: #fff; background-color:#000; }
26
- </style>
27
- </head>
28
- <body>
29
-
30
- <h1>Congratulations, you've put Ruby on Rails!</h1>
31
-
32
- <p><b>Before you move on</b>, verify that the following conditions have been met:</p>
33
-
34
- <ol>
35
- <li>The log directory and the empty log files must be writable to the web server (<code>chmod -R 666 log/*</code>).
36
- <li>
37
- The shebang line in the public/dispatch* files must reference your Ruby installation. <br/>
38
- You might need to change it to <code>#!/usr/bin/env ruby</code> or point directly at the installation.
39
- </li>
40
- <li>
41
- Rails on Apache needs to have the cgi handler and mod_rewrite enabled. <br/>
42
- Somewhere in your httpd.conf, you should have:<br/>
43
- <code>AddHandler cgi-script .cgi</code><br/>
44
- <code>LoadModule rewrite_module libexec/httpd/mod_rewrite.so</code><br/>
45
- <code>AddModule mod_rewrite.c</code>
46
- </li>
47
- </ol>
48
-
49
- <p>Take the following steps to get started:</p>
50
-
51
- <ol>
52
- <li>Create empty development and test databases for your application.<br/>
53
- <small>Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test</small><br/>
54
- <small>Warning: Don't point your test database at your development database, it'll destroy the latter on test runs!</small>
55
- <li>Edit config/database.yml with your database settings.
56
- <li>Create controllers and models using the generator in <code>script/generate</code> <br/>
57
- <small>Help: Run the generator with no arguments for documentation</small>
58
- <li>See all the tests run by running <code>rake</code>.
59
- <li>Develop your Rails application!
60
- <li>Setup Apache with <a href="http://www.fastcgi.com">FastCGI</a> (and <a href="http://raa.ruby-lang.org/list.rhtml?name=fcgi">Ruby bindings</a>), if you need better performance
61
- </ol>
62
-
63
- <p>
64
- Having problems getting up and running? First try debugging it yourself by looking at the log files. <br/>
65
- Then try the friendly Rails community <a href="http://www.rubyonrails.org">on the web</a> or <a href="http://www.rubyonrails.org/show/IRC">on IRC</a>
66
- (<a href="irc://irc.freenode.net/#rubyonrails">FreeNode#rubyonrails</a>).
67
- </p>
68
-
69
- </body>
70
- </html>
@@ -1,28 +0,0 @@
1
- GENERATOR
2
- controller - create controller and view stub files
3
-
4
- SYNOPSIS
5
- generate controller ControllerName action [action ...]
6
-
7
- DESCRIPTION
8
- The controller generator takes the name of the new controller as the
9
- first argument and a variable number of view names as subsequent arguments.
10
- The controller name should be supplied without a "Controller" suffix. The
11
- generator will add that itself.
12
-
13
- Controller generates a controller file in app/controllers with a render
14
- action for each of the view names passed, a test suite in test/functional
15
- with one passing test case, and HTML stubs for each view in app/views
16
- under a directory with the same name as the controller.
17
-
18
- EXAMPLE
19
- ./script/generate controller Blog list display new edit
20
-
21
- This will generate a BlogController class in
22
- app/controllers/blog_controller.rb, a BlogHelper class in
23
- app/helpers/blog_helper.rb and a BlogControllerTest in
24
- test/functional/blog_controller_test.rb, and list.rhtml,
25
- display.rhtml, new.rhtml, and edit.rhtml in app/views/blog.
26
-
27
- The BlogController class will have list, display, new, and edit actions.
28
- Each action will render the associated view by default.
@@ -1,26 +0,0 @@
1
- require 'rails_generator'
2
-
3
- class ControllerGenerator < Rails::Generator::Base
4
- attr_reader :actions
5
-
6
- def generate
7
- @actions = args
8
-
9
- # Controller class, functional test, and helper class.
10
- template "controller.rb", "app/controllers/#{file_name}_controller.rb"
11
- template "functional_test.rb", "test/functional/#{file_name}_controller_test.rb"
12
- template "helper.rb", "app/helpers/#{file_name}_helper.rb"
13
-
14
- # Create the views directory even if there are no actions.
15
- FileUtils.mkdir_p "app/views/#{file_name}"
16
-
17
- # Create a view for each action.
18
- actions.each do |action|
19
- template "view.rhtml", "app/views/#{file_name}/#{action}.rhtml", binding
20
- end
21
- end
22
-
23
- def full_class_name
24
- class_name + "Controller"
25
- end
26
- end
@@ -1,17 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
2
- require '<%= file_name %>_controller'
3
-
4
- # Re-raise errors caught by the controller.
5
- class <%= full_class_name %>; def rescue_action(e) raise e end; end
6
-
7
- class <%= full_class_name %>Test < Test::Unit::TestCase
8
- def setup
9
- @controller = <%= full_class_name %>.new
10
- @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
11
- end
12
-
13
- # Replace this with your real tests.
14
- def test_truth
15
- assert true
16
- end
17
- end
@@ -1,27 +0,0 @@
1
- GENERATOR
2
- mailer - create mailer and view stub files
3
-
4
- SYNOPSIS
5
- generate mailer MailerName action [action ...]
6
-
7
- DESCRIPTION
8
- The mailer generator takes the name of the new mailer class as the
9
- first argument and a variable number of mail action names as subsequent
10
- arguments.
11
-
12
- Mailer generates a class file in app/models with action methods for each
13
- of the mail action names passed, a test suite in test/unit with a stub
14
- test case and fixture per action, and template stubs for each action in
15
- app/views under a directory with the same name as the class.
16
-
17
- EXAMPLE
18
- ./script/generate mailer Notifications signup forgot_password invoice
19
-
20
- This will generate a Notifications class in
21
- app/models/notifications.rb, a NotificationsTest in
22
- test/unit/notifications_test.rb, and signup, forgot_password, and invoice
23
- in test/fixture/notification. It will also create signup.rhtml,
24
- forgot_password.rhtml, and invoice.rhtml in app/views/notifications.
25
-
26
- The Notifications class will have the following methods: signup,
27
- forgot_password, and invoice.
@@ -1,22 +0,0 @@
1
- require 'rails_generator'
2
-
3
- class MailerGenerator < Rails::Generator::Base
4
- attr_reader :actions
5
-
6
- def generate
7
- @actions = args
8
-
9
- # Mailer class and unit test.
10
- template "mailer.rb", "app/models/#{file_name}.rb"
11
- template "unit_test.rb", "test/unit/#{file_name}_test.rb"
12
-
13
- # Test fixtures directory.
14
- FileUtils.mkdir_p "test/fixtures/#{table_name}"
15
-
16
- # View template and fixture for each action.
17
- args.each do |action|
18
- template "view.rhtml", "app/views/#{file_name}/#{action}.rhtml", binding
19
- template "fixture.rhtml", "test/fixtures/#{table_name}/#{action}", binding
20
- end
21
- end
22
- end
@@ -1,17 +0,0 @@
1
- GENERATOR
2
- model - create model stub files
3
-
4
- SYNOPSIS
5
- generate model ModelName
6
-
7
- DESCRIPTION
8
- The model generator takes a model name and generates an empty model in
9
- app/models, a test suite in test/unit with one passing test case, and a
10
- fixtures YAML file in the test/fixtures directory.
11
-
12
- EXAMPLE
13
- ./script/generate model Account
14
-
15
- This will generate an Account class in app/models/account.rb, an
16
- AccountTest in test/unit/account_test.rb, and the fixtures file
17
- test/fixtures/account.yml.
@@ -1,10 +0,0 @@
1
- require 'rails_generator'
2
-
3
- class ModelGenerator < Rails::Generator::Base
4
- def generate
5
- # Model class, unit test, and fixtures.
6
- template "model.rb", "app/models/#{file_name}.rb"
7
- template "unit_test.rb", "test/unit/#{file_name}_test.rb"
8
- template "fixtures.yml", "test/fixtures/#{table_name}.yml"
9
- end
10
- end
@@ -1 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
@@ -1,27 +0,0 @@
1
- GENERATOR
2
- scaffold - create a model and basic controller
3
-
4
- SYNOPSIS
5
- generate scaffold ModelName [ControllerName] [action ...]
6
-
7
- DESCRIPTION
8
- The scaffold generator takes the name of the new model as the
9
- first argument, an optional controller name as the second, and
10
- an optional list of controller actions as the subsequent arguments.
11
- If the controller name is not specified, the plural form of the model
12
- name will be used. Any actions with scaffolding code available
13
- will be generated in your controller; others will be left as stubs.
14
-
15
- The generated controller has the same code that "scaffold :model"
16
- uses, so it's easy to migrate when you want to start customizing
17
- your controller.
18
-
19
- EXAMPLE
20
- ./script/generate scaffold Account Bank debit credit
21
-
22
- This will generate the Account model with unit tests and fixtures,
23
- the BankController controller with actions, views, and tests for
24
- index, list, show, new, create, edit, update, and destroy.
25
-
26
- Now create the accounts table in your database and browse to
27
- http://localhost/bank/ -- voila, you're on Rails!
@@ -1,60 +0,0 @@
1
- require 'rails_generator'
2
-
3
- class ScaffoldGenerator < Rails::Generator::Base
4
- def generate
5
- # Model.
6
- generator('model').generate
7
-
8
- # Fixtures.
9
- template "fixtures.yml", "test/fixtures/#{table_name}.yml"
10
-
11
- @controller_class_name = args.empty? ? Inflector.pluralize(class_name) : args.shift.sub(/^[a-z]?/) { |m| m.capitalize }
12
- @controller_name = Inflector.underscore(@controller_class_name)
13
-
14
- # Controller class, functional test, helper, and views.
15
- template "controller.rb", "app/controllers/#{@controller_name}_controller.rb"
16
- template "functional_test.rb", "test/functional/#{@controller_name}_controller_test.rb"
17
- template "controller/helper.rb", "app/helpers/#{@controller_name}_helper.rb"
18
-
19
- # Layout and stylesheet.
20
- unless File.file?("app/views/layouts/#{@controller_name}.rhtml")
21
- template "layout.rhtml", "app/views/layouts/#{@controller_name}.rhtml"
22
- end
23
- unless File.file?("public/stylesheets/scaffold.css")
24
- template "style.css", "public/stylesheets/scaffold.css"
25
- end
26
-
27
- # Scaffolded views.
28
- scaffold_views.each do |action|
29
- template "view_#{action}.rhtml", "app/views/#{@controller_name}/#{action}.rhtml"
30
- end
31
-
32
- # Unscaffolded views.
33
- unscaffolded_actions.each do |action|
34
- template "controller/view.rhtml",
35
- "app/views/#{@controller_name}/#{action}.rhtml",
36
- binding
37
- end
38
- end
39
-
40
- def full_class_name
41
- class_name + "Controller"
42
- end
43
-
44
- protected
45
- def scaffold_views
46
- %w(list show new edit)
47
- end
48
-
49
- def scaffold_actions
50
- scaffold_views + %w(index create update destroy)
51
- end
52
-
53
- def unscaffolded_actions
54
- args - scaffold_actions
55
- end
56
-
57
- def suffix
58
- "_#{singular_name}" if options[:suffix]
59
- end
60
- end