rails 0.8.5 → 0.9.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 (66) hide show
  1. data/CHANGELOG +86 -0
  2. data/README +48 -8
  3. data/Rakefile +87 -108
  4. data/bin/breakpointer +3 -0
  5. data/bin/breakpointer_for_gem +4 -0
  6. data/bin/console +30 -0
  7. data/bin/generate +41 -0
  8. data/bin/rails +1 -1
  9. data/{dispatches/dispatch.servlet → bin/server} +15 -11
  10. data/configs/apache.conf +12 -27
  11. data/configs/database.yml +9 -2
  12. data/dispatches/dispatch.fcgi +2 -2
  13. data/dispatches/dispatch.rb +2 -2
  14. data/doc/index.html +12 -36
  15. data/environments/development.rb +5 -0
  16. data/environments/production.rb +3 -6
  17. data/environments/shared.rb +46 -20
  18. data/environments/shared_for_gem.rb +41 -8
  19. data/environments/test.rb +3 -6
  20. data/fresh_rakefile +25 -21
  21. data/generators/controller/USAGE +28 -0
  22. data/generators/controller/controller_generator.rb +22 -0
  23. data/generators/controller/templates/controller.rb +10 -0
  24. data/generators/{templates/controller_test.erb → controller/templates/functional_test.rb} +1 -1
  25. data/generators/{templates/helper.erb → controller/templates/helper.rb} +0 -0
  26. data/generators/controller/templates/view.rhtml +2 -0
  27. data/generators/mailer/USAGE +27 -0
  28. data/generators/mailer/mailer_generator.rb +22 -0
  29. data/generators/{templates/mailer_action.rhtml → mailer/templates/fixture.rhtml} +0 -0
  30. data/generators/{templates/mailer.erb → mailer/templates/mailer.rb} +4 -4
  31. data/generators/{templates/mailer_test.erb → mailer/templates/unit_test.rb} +2 -10
  32. data/generators/mailer/templates/view.rhtml +3 -0
  33. data/generators/model/USAGE +17 -0
  34. data/generators/model/model_generator.rb +10 -0
  35. data/generators/model/templates/fixtures.yml +1 -0
  36. data/generators/{templates/model.erb → model/templates/model.rb} +0 -2
  37. data/generators/{templates/model_test.erb → model/templates/unit_test.rb} +2 -3
  38. data/generators/scaffold/USAGE +25 -0
  39. data/generators/scaffold/scaffold_generator.rb +53 -0
  40. data/generators/scaffold/templates/controller.rb +57 -0
  41. data/generators/scaffold/templates/fixtures.yml +7 -0
  42. data/generators/scaffold/templates/functional_test.rb +79 -0
  43. data/generators/scaffold/templates/layout.rhtml +11 -0
  44. data/generators/scaffold/templates/style.css +53 -0
  45. data/generators/scaffold/templates/view_edit.rhtml +7 -0
  46. data/generators/scaffold/templates/view_list.rhtml +24 -0
  47. data/generators/scaffold/templates/view_new.rhtml +6 -0
  48. data/generators/scaffold/templates/view_show.rhtml +8 -0
  49. data/helpers/{abstract_application.rb → application.rb} +1 -4
  50. data/helpers/test_helper.rb +4 -5
  51. data/lib/binding_of_caller.rb +81 -0
  52. data/lib/breakpoint.rb +526 -0
  53. data/lib/breakpoint_client.rb +167 -0
  54. data/lib/dispatcher.rb +43 -12
  55. data/lib/rails_generator.rb +175 -0
  56. data/lib/webrick_server.rb +48 -52
  57. metadata +49 -21
  58. data/gem_snapshot +0 -14
  59. data/generators/new_controller.rb +0 -43
  60. data/generators/new_crud.rb +0 -34
  61. data/generators/new_mailer.rb +0 -43
  62. data/generators/new_model.rb +0 -31
  63. data/generators/templates/controller.erb +0 -24
  64. data/generators/templates/controller_view.rhtml +0 -10
  65. data/generators/templates/mailer_fixture.rhtml +0 -4
  66. data/lib/generator.rb +0 -112
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: rails
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.5
7
- date: 2004-11-18
6
+ version: 0.9.0
7
+ date: 2004-12-16
8
8
  summary: "Web-application framework with template engine, control-flow layer, and ORM."
9
9
  require_paths:
10
10
  - lib
@@ -33,7 +33,6 @@ files:
33
33
  - doc
34
34
  - environments
35
35
  - fresh_rakefile
36
- - gem_snapshot
37
36
  - generators
38
37
  - helpers
39
38
  - html
@@ -43,7 +42,12 @@ files:
43
42
  - Rakefile
44
43
  - README
45
44
  - test
45
+ - bin/breakpointer
46
+ - bin/breakpointer_for_gem
47
+ - bin/console
48
+ - bin/generate
46
49
  - bin/rails
50
+ - bin/server
47
51
  - configs/apache.conf
48
52
  - configs/database.yml
49
53
  - doc/apache_protection
@@ -51,35 +55,59 @@ files:
51
55
  - doc/README_FOR_APP
52
56
  - dispatches/dispatch.fcgi
53
57
  - dispatches/dispatch.rb
54
- - dispatches/dispatch.servlet
58
+ - environments/development.rb
55
59
  - environments/production.rb
56
60
  - environments/shared.rb
57
61
  - environments/shared_for_gem.rb
58
62
  - environments/test.rb
59
- - generators/new_controller.rb
60
- - generators/new_crud.rb
61
- - generators/new_mailer.rb
62
- - generators/new_model.rb
63
- - generators/templates
64
- - generators/templates/controller.erb
65
- - generators/templates/controller_test.erb
66
- - generators/templates/controller_view.rhtml
67
- - generators/templates/helper.erb
68
- - generators/templates/mailer.erb
69
- - generators/templates/mailer_action.rhtml
70
- - generators/templates/mailer_fixture.rhtml
71
- - generators/templates/mailer_test.erb
72
- - generators/templates/model.erb
73
- - generators/templates/model_test.erb
74
- - helpers/abstract_application.rb
63
+ - helpers/application.rb
75
64
  - helpers/application_helper.rb
76
65
  - helpers/test_helper.rb
66
+ - generators/controller
67
+ - generators/mailer
68
+ - generators/model
69
+ - generators/scaffold
70
+ - generators/controller/controller_generator.rb
71
+ - generators/controller/templates
72
+ - generators/controller/USAGE
73
+ - generators/controller/templates/controller.rb
74
+ - generators/controller/templates/functional_test.rb
75
+ - generators/controller/templates/helper.rb
76
+ - generators/controller/templates/view.rhtml
77
+ - generators/mailer/mailer_generator.rb
78
+ - generators/mailer/templates
79
+ - generators/mailer/USAGE
80
+ - generators/mailer/templates/fixture.rhtml
81
+ - generators/mailer/templates/mailer.rb
82
+ - generators/mailer/templates/unit_test.rb
83
+ - generators/mailer/templates/view.rhtml
84
+ - generators/model/model_generator.rb
85
+ - generators/model/templates
86
+ - generators/model/USAGE
87
+ - generators/model/templates/fixtures.yml
88
+ - generators/model/templates/model.rb
89
+ - generators/model/templates/unit_test.rb
90
+ - generators/scaffold/scaffold_generator.rb
91
+ - generators/scaffold/templates
92
+ - generators/scaffold/USAGE
93
+ - generators/scaffold/templates/controller.rb
94
+ - generators/scaffold/templates/fixtures.yml
95
+ - generators/scaffold/templates/functional_test.rb
96
+ - generators/scaffold/templates/layout.rhtml
97
+ - generators/scaffold/templates/style.css
98
+ - generators/scaffold/templates/view_edit.rhtml
99
+ - generators/scaffold/templates/view_list.rhtml
100
+ - generators/scaffold/templates/view_new.rhtml
101
+ - generators/scaffold/templates/view_show.rhtml
77
102
  - html/404.html
78
103
  - html/500.html
79
104
  - html/index.html
105
+ - lib/binding_of_caller.rb
106
+ - lib/breakpoint.rb
107
+ - lib/breakpoint_client.rb
80
108
  - lib/code_statistics.rb
81
109
  - lib/dispatcher.rb
82
- - lib/generator.rb
110
+ - lib/rails_generator.rb
83
111
  - lib/webrick_server.rb
84
112
  test_files: []
85
113
  rdoc_options: []
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
- WORK=$1-snapshot
3
- cd /tmp
4
- if [ -d $WORK ]; then
5
- cd $WORK
6
- cvs update
7
- else
8
- cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/$1 login
9
- cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/$1 checkout -d $WORK $1
10
- cd $WORK
11
- fi
12
- rm -rf pkg
13
- EDGE_RAILS=`date -u "+%Y%m%d"` rake gem
14
- cp pkg/$1*gem /tmp
@@ -1,43 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- require File.dirname(__FILE__) + '/../config/environments/production'
3
- require 'generator'
4
-
5
- unless ARGV.empty?
6
- rails_root = File.dirname(__FILE__) + '/..'
7
- name = ARGV.shift
8
- actions = ARGV
9
- Generator::Controller.new(rails_root, name, actions).generate
10
- else
11
- puts <<-END_HELP
12
-
13
- NAME
14
- new_controller - create controller and view stub files
15
-
16
- SYNOPSIS
17
- new_controller ControllerName action [action ...]
18
-
19
- DESCRIPTION
20
- The new_controller generator takes the name of the new controller as the
21
- first argument and a variable number of view names as subsequent arguments.
22
- The controller name should be supplied without a "Controller" suffix. The
23
- generator will add that itself.
24
-
25
- From the passed arguments, new_controller generates a controller file in
26
- app/controllers with a render action for each of the view names passed.
27
- It then creates a controller test suite in test/functional with one failing
28
- test case. Finally, it creates an HTML stub for each of the view names in
29
- app/views under a directory with the same name as the controller.
30
-
31
- EXAMPLE
32
- new_controller Blog list display new edit
33
-
34
- This will generate a BlogController class in
35
- app/controllers/blog_controller.rb, a BlogHelper class in
36
- app/helpers/blog_helper.rb and a BlogControllerTest in
37
- test/functional/blog_controller_test.rb. It will also create list.rhtml,
38
- display.rhtml, new.rhtml, and edit.rhtml in app/views/blog.
39
-
40
- The BlogController class will have the following methods: list, display, new, edit.
41
- Each will default to render the associated template file.
42
- END_HELP
43
- end
@@ -1,34 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- require File.dirname(__FILE__) + '/../config/environments/production'
3
- require 'generator'
4
-
5
- unless ARGV.empty?
6
- rails_root = File.dirname(__FILE__) + '/..'
7
- name = ARGV.shift
8
- actions = ARGV
9
- Generator::Model.new(rails_root, name).generate
10
- Generator::Controller.new(rails_root, name, actions, :scaffold => true).generate
11
- else
12
- puts <<-END_HELP
13
-
14
- NAME
15
- new_crud - create a model and a controller scaffold
16
-
17
- SYNOPSIS
18
- new_crud ModelName [action ...]
19
-
20
- DESCRIPTION
21
- The new_crud generator takes the name of the new model as the
22
- first argument and an optional list of controller actions as the
23
- subsequent arguments. All actions may be omitted since the controller
24
- will have scaffolding automatically set up for this model.
25
-
26
- EXAMPLE
27
- new_crud Account
28
-
29
- This will generate an Account model and controller with scaffolding.
30
- Now create the accounts table in your database and browse to
31
- http://localhost/account/ -- voila, you're on Rails!
32
-
33
- END_HELP
34
- end
@@ -1,43 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- require File.dirname(__FILE__) + '/../config/environments/production'
3
- require 'generator'
4
-
5
- unless ARGV.empty?
6
- rails_root = File.dirname(__FILE__) + '/..'
7
- name = ARGV.shift
8
- actions = ARGV
9
- Generator::Mailer.new(rails_root, name, actions).generate
10
- else
11
- puts <<-END_HELP
12
-
13
- NAME
14
- new_mailer - create mailer and view stub files
15
-
16
- SYNOPSIS
17
- new_mailer MailerName action [action ...]
18
-
19
- DESCRIPTION
20
- The new_mailer generator takes the name of the new mailer class as the
21
- first argument and a variable number of mail action names as subsequent
22
- arguments.
23
-
24
- From the passed arguments, new_mailer generates a class file in
25
- app/models with a mail action for each of the mail action names passed.
26
- It then creates a mail test suite in test/unit with one stub test case
27
- and one stub fixture per mail action. Finally, it creates a template stub
28
- for each of the mail action names in app/views under a directory with the
29
- same name as the class.
30
-
31
- EXAMPLE
32
- new_mailer Notifications signup forgot_password invoice
33
-
34
- This will generate a Notifications class in
35
- app/models/notifications.rb, a NotificationsTest in
36
- test/unit/notifications_test.rb, and signup, forgot_password, and invoice
37
- in test/fixture/notification. It will also create signup.rhtml,
38
- forgot_password.rhtml, and invoice.rhtml in app/views/notifications.
39
-
40
- The Notifications class will have the following methods: signup,
41
- forgot_password, and invoice.
42
- END_HELP
43
- end
@@ -1,31 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- require File.dirname(__FILE__) + '/../config/environments/production'
3
- require 'generator'
4
-
5
- if ARGV.size == 1
6
- rails_root = File.dirname(__FILE__) + '/..'
7
- name = ARGV.shift
8
- Generator::Model.new(rails_root, name).generate
9
- else
10
- puts <<-HELP
11
-
12
- NAME
13
- new_model - create model stub files
14
-
15
- SYNOPSIS
16
- new_model ModelName
17
-
18
- DESCRIPTION
19
- The new_model generator takes a model name (in CamelCase) and generates
20
- a new, empty model in app/models, a test suite in test/unit with one
21
- failing test case, and a fixtures directory in test/fixtures.
22
-
23
- EXAMPLE
24
- new_model Account
25
-
26
- This will generate an Account class in app/models/account.rb, an
27
- AccountTest in test/unit/account_test.rb, and the directory
28
- test/fixtures/account.
29
-
30
- HELP
31
- end
@@ -1,24 +0,0 @@
1
- require 'abstract_application'
2
- <% if options[:scaffold] -%>
3
- require '<%= file_name %>'
4
- <% end -%>
5
-
6
- class <%= class_name %>Controller < AbstractApplicationController
7
- helper :<%= file_name %>
8
-
9
- <% if options[:scaffold] -%>
10
- scaffold :<%= options[:scaffold] %>
11
-
12
- <%- for action in actions -%>
13
- #def <%= action %>
14
- #end
15
-
16
- <%- end -%>
17
- <% else -%>
18
- <%- for action in actions -%>
19
- def <%= action %>
20
- end
21
-
22
- <%- end -%>
23
- <% end -%>
24
- end
@@ -1,10 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <title><%= class_name %>#<%= action %></title>
5
- </head>
6
- <body>
7
- <h1><%= class_name %>#<%= action %></h1>
8
- <p>Find me in app/views/<%= file_name %>/<%= action %>.rhtml</p>
9
- </body>
10
- </html>
@@ -1,4 +0,0 @@
1
- <%= class_name %>#<%= action %>
2
-
3
- Find me in test/fixtures/<%= file_name %>/<%= action %>.
4
- I'm tested against the view in app/views/<%= file_name %>/<%= action %>.
@@ -1,112 +0,0 @@
1
- require 'fileutils'
2
- require 'active_record/support/inflector'
3
-
4
- module Generator
5
- class GeneratorError < StandardError; end
6
-
7
- class Base
8
- @@template_root = File.dirname(__FILE__) + '/../generators/templates'
9
- cattr_accessor :template_root
10
-
11
- attr_reader :rails_root, :class_name, :file_name, :table_name,
12
- :actions, :options
13
-
14
- def initialize(rails_root, object_name, actions = [], options = {})
15
- @rails_root = rails_root
16
- @class_name = Inflector.camelize(object_name)
17
- @file_name = Inflector.underscore(@class_name)
18
- @table_name = Inflector.pluralize(@file_name)
19
- @actions = actions
20
- @options = options
21
-
22
- # Use local templates if rails_root/generators directory exists.
23
- local_template_root = File.join(@rails_root, 'generators')
24
- if File.directory?(local_template_root)
25
- self.class.template_root = local_template_root
26
- end
27
- end
28
-
29
- protected
30
-
31
- # Generate a file in a fresh Rails app from an ERB template.
32
- # Takes a template path relative to +template_root+, a
33
- # destination path relative to +rails_root+, evaluates the template,
34
- # and writes the result to the destination.
35
- def generate_file(template_file_path, rails_file_path, eval_binding = nil)
36
- # Determine full paths for source and destination files.
37
- template_path = File.join(template_root, template_file_path)
38
- rails_path = File.join(rails_root, rails_file_path)
39
-
40
- # Create destination directories.
41
- FileUtils.mkdir_p(File.dirname(rails_path))
42
-
43
- # Render template and write result.
44
- eval_binding ||= binding
45
- contents = ERB.new(File.read(template_path), nil, '-').result(eval_binding)
46
- File.open(rails_path, 'w') { |file| file.write(contents) }
47
- end
48
- end
49
-
50
- # Generate controller, helper, functional test, and views.
51
- class Controller < Base
52
- def generate
53
- options[:scaffold] = file_name if options[:scaffold]
54
-
55
- # Controller class.
56
- generate_file "controller.erb", "app/controllers/#{file_name}_controller.rb"
57
-
58
- # Helper class.
59
- generate_file "helper.erb", "app/helpers/#{file_name}_helper.rb"
60
-
61
- # Function test.
62
- generate_file "controller_test.erb", "test/functional/#{file_name}_controller_test.rb"
63
-
64
- # View template for each action.
65
- @actions.each do |action|
66
- generate_file "controller_view.rhtml",
67
- "app/views/#{file_name}/#{action}.rhtml",
68
- binding
69
- end
70
- end
71
- end
72
-
73
- # Generate model, unit test, and fixtures.
74
- class Model < Base
75
- def generate
76
-
77
- # Model class.
78
- generate_file "model.erb", "app/models/#{file_name}.rb"
79
-
80
- # Model unit test.
81
- generate_file "model_test.erb", "test/unit/#{file_name}_test.rb"
82
-
83
- # Test fixtures directory.
84
- FileUtils.mkdir_p("test/fixtures/#{table_name}")
85
- end
86
- end
87
-
88
- # Generate mailer, helper, functional test, and views.
89
- class Mailer < Base
90
- def generate
91
-
92
- # Mailer class.
93
- generate_file "mailer.erb", "app/models/#{file_name}.rb"
94
-
95
- # Mailer unit test.
96
- generate_file "mailer_test.erb", "test/unit/#{file_name}_test.rb"
97
-
98
- # Test fixtures directory.
99
- FileUtils.mkdir_p("test/fixtures/#{table_name}")
100
-
101
- # View template and fixture for each action.
102
- @actions.each do |action|
103
- generate_file "mailer_action.rhtml",
104
- "app/views/#{file_name}/#{action}.rhtml",
105
- binding
106
- generate_file "mailer_fixture.rhtml",
107
- "test/fixtures/#{table_name}/#{action}",
108
- binding
109
- end
110
- end
111
- end
112
- end