rails 0.12.1 → 0.13.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 (46) hide show
  1. data/CHANGELOG +59 -10
  2. data/Rakefile +23 -11
  3. data/bin/console +6 -5
  4. data/bin/console_sandbox +0 -6
  5. data/bin/listener +86 -0
  6. data/bin/profiler +27 -10
  7. data/bin/rails +3 -1
  8. data/bin/runner +24 -0
  9. data/bin/server +1 -0
  10. data/bin/tracker +69 -0
  11. data/configs/database.yml +3 -0
  12. data/dispatches/dispatch.fcgi +22 -25
  13. data/dispatches/gateway.cgi +97 -0
  14. data/environments/development.rb +2 -0
  15. data/environments/environment.rb +1 -0
  16. data/environments/test.rb +2 -0
  17. data/fresh_rakefile +9 -4
  18. data/helpers/test_helper.rb +16 -5
  19. data/html/404.html +2 -0
  20. data/html/500.html +2 -0
  21. data/html/index.html +3 -0
  22. data/html/javascripts/controls.js +261 -0
  23. data/html/javascripts/dragdrop.js +476 -0
  24. data/html/javascripts/effects.js +570 -0
  25. data/html/javascripts/prototype.js +633 -371
  26. data/lib/console_sandbox.rb +6 -0
  27. data/lib/dispatcher.rb +13 -11
  28. data/lib/fcgi_handler.rb +166 -0
  29. data/lib/rails_generator/generators/applications/app/app_generator.rb +16 -12
  30. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +2 -2
  31. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +3 -1
  32. data/lib/rails_generator/generators/components/migration/USAGE +14 -0
  33. data/lib/rails_generator/generators/components/migration/migration_generator.rb +9 -0
  34. data/lib/rails_generator/generators/components/migration/templates/migration.rb +7 -0
  35. data/lib/rails_generator/generators/components/model/model_generator.rb +1 -1
  36. data/lib/rails_generator/generators/components/scaffold/USAGE +1 -1
  37. data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +11 -11
  38. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +38 -20
  39. data/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +2 -0
  40. data/lib/rails_generator/generators/components/scaffold/templates/style.css +22 -1
  41. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +2 -2
  42. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +5 -5
  43. data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +1 -1
  44. data/lib/rubyprof_ext.rb +35 -0
  45. data/lib/webrick_server.rb +84 -43
  46. metadata +22 -8
@@ -5,6 +5,8 @@
5
5
  </head>
6
6
  <body>
7
7
 
8
+ <p style="color: green"><%%= flash[:notice] %></p>
9
+
8
10
  <%%= @content_for_layout %>
9
11
 
10
12
  </body>
@@ -24,7 +24,7 @@ a:hover { color: #fff; background-color:#000; }
24
24
 
25
25
  #ErrorExplanation {
26
26
  width: 400px;
27
- border: 2px solid #red;
27
+ border: 2px solid 'red';
28
28
  padding: 7px;
29
29
  padding-bottom: 12px;
30
30
  margin-bottom: 20px;
@@ -51,3 +51,24 @@ a:hover { color: #fff; background-color:#000; }
51
51
  font-size: 12px;
52
52
  list-style: square;
53
53
  }
54
+
55
+ div.uploadStatus {
56
+ margin: 5px;
57
+ }
58
+
59
+ div.progressBar {
60
+ margin: 5px;
61
+ }
62
+
63
+ div.progressBar div.border {
64
+ background-color: #fff;
65
+ border: 1px solid grey;
66
+ width: 100%;
67
+ }
68
+
69
+ div.progressBar div.background {
70
+ background-color: #333;
71
+ height: 18px;
72
+ width: 0%;
73
+ }
74
+
@@ -1,8 +1,8 @@
1
1
  <h1>Editing <%= singular_name %></h1>
2
2
 
3
3
  <%%= start_form_tag :action => 'update<%= @suffix %>', :id => @<%= singular_name %> %>
4
- <%%= render_partial "form" %>
5
- <%%= submit_tag "Edit" %>
4
+ <%%= render_partial 'form' %>
5
+ <%%= submit_tag 'Edit' %>
6
6
  <%%= end_form_tag %>
7
7
 
8
8
  <%%= link_to 'Show', :action => 'show<%= suffix %>', :id => @<%= singular_name %> %> |
@@ -2,9 +2,9 @@
2
2
 
3
3
  <table>
4
4
  <tr>
5
- <%% for column in <%= model_name %>.content_columns %>
5
+ <%% for column in <%= model_name %>.content_columns %>
6
6
  <th><%%= column.human_name %></th>
7
- <%% end %>
7
+ <%% end %>
8
8
  </tr>
9
9
 
10
10
  <%% for <%= singular_name %> in @<%= plural_name %> %>
@@ -14,13 +14,13 @@
14
14
  <%% end %>
15
15
  <td><%%= link_to 'Show', :action => 'show<%= suffix %>', :id => <%= singular_name %> %></td>
16
16
  <td><%%= link_to 'Edit', :action => 'edit<%= suffix %>', :id => <%= singular_name %> %></td>
17
- <td><%%= link_to 'Destroy', {:action => 'destroy<%= suffix %>', :id => <%= singular_name %>}, :confirm => "Are you sure?" %></td>
17
+ <td><%%= link_to 'Destroy', {:action => 'destroy<%= suffix %>', :id => <%= singular_name %>}, :confirm => 'Are you sure?' %></td>
18
18
  </tr>
19
19
  <%% end %>
20
20
  </table>
21
21
 
22
- <%%= link_to "Previous page", { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %>
23
- <%%= link_to "Next page", { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %>
22
+ <%%= link_to 'Previous page', { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %>
23
+ <%%= link_to 'Next page', { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %>
24
24
 
25
25
  <br />
26
26
 
@@ -1,7 +1,7 @@
1
1
  <h1>New <%= singular_name %></h1>
2
2
 
3
3
  <%%= start_form_tag :action => 'create<%= @suffix %>' %>
4
- <%%= render_partial "form" %>
4
+ <%%= render_partial 'form' %>
5
5
  <%%= submit_tag "Create" %>
6
6
  <%%= end_form_tag %>
7
7
 
@@ -0,0 +1,35 @@
1
+ require 'prof'
2
+
3
+ module Prof
4
+ # Adapted from Shugo Maeda's unprof.rb
5
+ def self.print_profile(results, io = $stderr)
6
+ total = results.detect { |i|
7
+ i.method_class.nil? && i.method_id == :"#toplevel"
8
+ }.total_time
9
+ total = 0.001 if total < 0.001
10
+
11
+ io.puts " %% cumulative self self total"
12
+ io.puts " time seconds seconds calls ms/call ms/call name"
13
+
14
+ sum = 0.0
15
+ for r in results
16
+ sum += r.self_time
17
+
18
+ name = if r.method_class.nil?
19
+ r.method_id.to_s
20
+ elsif r.method_class.is_a?(Class)
21
+ "#{r.method_class}##{r.method_id}"
22
+ else
23
+ "#{r.method_class}.#{r.method_id}"
24
+ end
25
+ io.printf "%6.2f %8.3f %8.3f %8d %8.2f %8.2f %s\n",
26
+ r.self_time / total * 100,
27
+ sum,
28
+ r.self_time,
29
+ r.count,
30
+ r.self_time * 1000 / r.count,
31
+ r.total_time * 1000 / r.count,
32
+ name
33
+ end
34
+ end
35
+ end
@@ -8,6 +8,36 @@ include WEBrick
8
8
 
9
9
  ABSOLUTE_RAILS_ROOT = File.expand_path(RAILS_ROOT)
10
10
 
11
+ class CGI
12
+ def stdinput
13
+ @stdin || $stdin
14
+ end
15
+
16
+ def env_table
17
+ @env_table || ENV
18
+ end
19
+
20
+ def initialize(type = "query", table = nil, stdin = nil)
21
+ @env_table, @stdin = table, stdin
22
+
23
+ if defined?(MOD_RUBY) && !ENV.key?("GATEWAY_INTERFACE")
24
+ Apache.request.setup_cgi_env
25
+ end
26
+
27
+ extend QueryExtension
28
+ @multipart = false
29
+ if defined?(CGI_PARAMS)
30
+ warn "do not use CGI_PARAMS and CGI_COOKIES"
31
+ @params = CGI_PARAMS.dup
32
+ @cookies = CGI_COOKIES.dup
33
+ else
34
+ initialize_query() # set @params, @cookies
35
+ end
36
+ @output_cookies = nil
37
+ @output_hidden = nil
38
+ end
39
+ end
40
+
11
41
  class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
12
42
  REQUEST_MUTEX = Mutex.new
13
43
 
@@ -18,6 +48,10 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
18
48
  server.mount('/', DispatchServlet, options)
19
49
 
20
50
  trap("INT") { server.shutdown }
51
+
52
+ require File.join(@server_options[:server_root], "..", "config", "environment") unless defined?(RAILS_ROOT)
53
+ require "dispatcher"
54
+
21
55
  server.start
22
56
  end
23
57
 
@@ -31,69 +65,50 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
31
65
  def service(req, res)
32
66
  begin
33
67
  unless handle_file(req, res)
34
- REQUEST_MUTEX.lock
68
+ REQUEST_MUTEX.lock unless ActionController::Base.allow_concurrency
35
69
  unless handle_dispatch(req, res)
36
70
  raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
37
71
  end
38
72
  end
39
73
  ensure
40
- REQUEST_MUTEX.unlock if REQUEST_MUTEX.locked?
74
+ unless ActionController::Base.allow_concurrency
75
+ REQUEST_MUTEX.unlock if REQUEST_MUTEX.locked?
76
+ end
41
77
  end
42
78
  end
43
79
 
44
80
  def handle_file(req, res)
45
81
  begin
46
- add_dot_html(req)
82
+ req = req.dup
83
+ path = req.path.dup
84
+
85
+ # Add .html if the last path piece has no . in it
86
+ path << '.html' if path != '/' && (%r{(^|/)[^./]+$} =~ path)
87
+ path.gsub!('+', ' ') # Unescape + since FileHandler doesn't do so.
88
+
89
+ req.instance_variable_set(:@path_info, path) # Set the modified path...
90
+
47
91
  @file_handler.send(:service, req, res)
48
- remove_dot_html(req)
49
92
  return true
50
93
  rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err
51
94
  res.set_error(err)
52
95
  return true
53
96
  rescue => err
54
97
  return false
55
- ensure
56
- remove_dot_html(req)
57
98
  end
58
99
  end
59
100
 
60
- def add_dot_html(req)
61
- if /^([^.]+)$/ =~ req.path && req.path != "/" then req.instance_variable_set(:@path_info, "#{$1}.html") end
62
- end
63
-
64
- def remove_dot_html(req)
65
- if /^([^.]+).html$/ =~ req.path && req.path != "/" then req.instance_variable_set(:@path_info, $1) end
66
- end
67
-
68
- def handle_dispatch(req, res, origin = nil)
69
- env = req.meta_vars.clone
70
- env.delete "SCRIPT_NAME"
71
- env["QUERY_STRING"] = req.request_uri.query
72
- env["REQUEST_URI"] = origin if origin
73
-
74
- data = nil
75
- $old_stdin, $old_stdout = $stdin, $stdout
76
- $stdin, $stdout = StringIO.new(req.body || ""), StringIO.new
77
-
78
- begin
79
- require 'cgi'
80
- CGI.send(:define_method, :env_table) { env }
81
-
82
- load File.join(@server_options[:server_root], "dispatch.rb")
83
-
84
- $stdout.rewind
85
- data = $stdout.read
86
- ensure
87
- $stdin, $stdout = $old_stdin, $old_stdout
88
- end
89
-
90
- raw_header, body = *data.split(/^[\xd\xa]+/on, 2)
91
- header = WEBrick::HTTPUtils::parse_header(raw_header)
92
- if /^(\d+)/ =~ header['status'][0]
93
- res.status = $1.to_i
94
- header.delete('status')
95
- end
96
- res.cookies.concat header.delete('set-cookie')
101
+ def handle_dispatch(req, res, origin = nil)
102
+ data = StringIO.new
103
+ Dispatcher.dispatch(
104
+ CGI.new("query", create_env_table(req, origin), StringIO.new(req.body || "")),
105
+ ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
106
+ data
107
+ )
108
+
109
+ header, body = extract_header_and_body(data)
110
+ assign_status(res, header)
111
+ res.cookies.concat(header.delete('set-cookie'))
97
112
  header.each { |key, val| res[key] = val.join(", ") }
98
113
 
99
114
  res.body = body
@@ -102,4 +117,30 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
102
117
  p err, err.backtrace
103
118
  return false
104
119
  end
120
+
121
+ private
122
+ def create_env_table(req, origin)
123
+ env = req.meta_vars.clone
124
+ env.delete "SCRIPT_NAME"
125
+ env["QUERY_STRING"] = req.request_uri.query
126
+ env["REQUEST_URI"] = origin if origin
127
+ return env
128
+ end
129
+
130
+ def extract_header_and_body(data)
131
+ data.rewind
132
+ data = data.read
133
+
134
+ raw_header, body = *data.split(/^[\xd\xa]+/on, 2)
135
+ header = WEBrick::HTTPUtils::parse_header(raw_header)
136
+
137
+ return header, body
138
+ end
139
+
140
+ def assign_status(res, header)
141
+ if /^(\d+)/ =~ header['status'][0]
142
+ res.status = $1.to_i
143
+ header.delete('status')
144
+ end
145
+ end
105
146
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.8
2
+ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: rails
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.12.1
7
- date: 2005-04-20
6
+ version: 0.13.0
7
+ date: 2005-07-06
8
8
  summary: "Web-application framework with template engine, control-flow layer, and ORM."
9
9
  require_paths:
10
10
  - lib
@@ -50,10 +50,12 @@ files:
50
50
  - bin/console_sandbox
51
51
  - bin/destroy
52
52
  - bin/generate
53
+ - bin/listener
53
54
  - bin/profiler
54
55
  - bin/rails
55
56
  - bin/runner
56
57
  - bin/server
58
+ - bin/tracker
57
59
  - bin/update
58
60
  - configs/apache.conf
59
61
  - configs/database.yml
@@ -62,6 +64,7 @@ files:
62
64
  - doc/README_FOR_APP
63
65
  - dispatches/dispatch.fcgi
64
66
  - dispatches/dispatch.rb
67
+ - dispatches/gateway.cgi
65
68
  - environments/development.rb
66
69
  - environments/environment.rb
67
70
  - environments/production.rb
@@ -74,14 +77,20 @@ files:
74
77
  - html/favicon.ico
75
78
  - html/index.html
76
79
  - html/javascripts
80
+ - html/javascripts/controls.js
81
+ - html/javascripts/dragdrop.js
82
+ - html/javascripts/effects.js
77
83
  - html/javascripts/prototype.js
78
84
  - lib/binding_of_caller.rb
79
85
  - lib/breakpoint.rb
80
86
  - lib/breakpoint_client.rb
81
87
  - lib/code_statistics.rb
88
+ - lib/console_sandbox.rb
82
89
  - lib/dispatcher.rb
90
+ - lib/fcgi_handler.rb
83
91
  - lib/rails_generator
84
92
  - lib/rails_generator.rb
93
+ - lib/rubyprof_ext.rb
85
94
  - lib/webrick_server.rb
86
95
  - lib/rails_generator/base.rb
87
96
  - lib/rails_generator/commands.rb
@@ -100,6 +109,7 @@ files:
100
109
  - lib/rails_generator/generators/applications/app/USAGE
101
110
  - lib/rails_generator/generators/components/controller
102
111
  - lib/rails_generator/generators/components/mailer
112
+ - lib/rails_generator/generators/components/migration
103
113
  - lib/rails_generator/generators/components/model
104
114
  - lib/rails_generator/generators/components/scaffold
105
115
  - lib/rails_generator/generators/components/web_service
@@ -117,6 +127,10 @@ files:
117
127
  - lib/rails_generator/generators/components/mailer/templates/mailer.rb
118
128
  - lib/rails_generator/generators/components/mailer/templates/unit_test.rb
119
129
  - lib/rails_generator/generators/components/mailer/templates/view.rhtml
130
+ - lib/rails_generator/generators/components/migration/migration_generator.rb
131
+ - lib/rails_generator/generators/components/migration/templates
132
+ - lib/rails_generator/generators/components/migration/USAGE
133
+ - lib/rails_generator/generators/components/migration/templates/migration.rb
120
134
  - lib/rails_generator/generators/components/model/model_generator.rb
121
135
  - lib/rails_generator/generators/components/model/templates
122
136
  - lib/rails_generator/generators/components/model/USAGE
@@ -174,7 +188,7 @@ dependencies:
174
188
  -
175
189
  - "="
176
190
  - !ruby/object:Gem::Version
177
- version: 1.0.4
191
+ version: 1.1.0
178
192
  version:
179
193
  - !ruby/object:Gem::Dependency
180
194
  name: activerecord
@@ -184,7 +198,7 @@ dependencies:
184
198
  -
185
199
  - "="
186
200
  - !ruby/object:Gem::Version
187
- version: 1.10.1
201
+ version: 1.11.0
188
202
  version:
189
203
  - !ruby/object:Gem::Dependency
190
204
  name: actionpack
@@ -194,7 +208,7 @@ dependencies:
194
208
  -
195
209
  - "="
196
210
  - !ruby/object:Gem::Version
197
- version: 1.8.1
211
+ version: 1.9.0
198
212
  version:
199
213
  - !ruby/object:Gem::Dependency
200
214
  name: actionmailer
@@ -204,7 +218,7 @@ dependencies:
204
218
  -
205
219
  - "="
206
220
  - !ruby/object:Gem::Version
207
- version: 0.9.1
221
+ version: 1.0.0
208
222
  version:
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: actionwebservice
@@ -214,5 +228,5 @@ dependencies:
214
228
  -
215
229
  - "="
216
230
  - !ruby/object:Gem::Version
217
- version: 0.7.1
231
+ version: 0.8.0
218
232
  version: