rails 0.9.2 → 0.9.3
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.
- data/CHANGELOG +34 -0
- data/Rakefile +27 -14
- data/bin/generate +28 -2
- data/environments/development.rb +1 -3
- data/environments/production.rb +1 -2
- data/environments/test.rb +2 -2
- data/fresh_rakefile +6 -0
- data/generators/controller/controller_generator.rb +4 -0
- data/generators/controller/templates/controller.rb +1 -1
- data/generators/controller/templates/functional_test.rb +3 -3
- data/generators/mailer/templates/mailer.rb +0 -2
- data/generators/scaffold/scaffold_generator.rb +4 -0
- data/lib/dispatcher.rb +10 -4
- data/lib/rails_generator.rb +26 -0
- metadata +11 -8
data/CHANGELOG
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
*0.9.3* (January 4th, 2005)
|
2
|
+
|
3
|
+
* Added support for SQLite in the auto-dumping/importing of schemas for development -> test #416
|
4
|
+
|
5
|
+
* Added automated rewriting of the shebang lines on installs through the gem rails command #379 [Manfred Stienstra]
|
6
|
+
|
7
|
+
* Added ActionMailer::Base.deliver_method = :test to the test environment so that mail objects are available in ActionMailer::Base.deliveries
|
8
|
+
for functional testing.
|
9
|
+
|
10
|
+
* Added protection for creating a model through the generators with a name of an existing class, like Thread or Date.
|
11
|
+
It'll even offer you a synonym using wordnet.princeton.edu as a look-up. No, I'm not kidding :) [Florian Gross]
|
12
|
+
|
13
|
+
* Fixed dependency management to happen in a unified fashion for Active Record and Action Pack using the new Dependencies module. This means that
|
14
|
+
the environment options needs to change from:
|
15
|
+
|
16
|
+
Before in development.rb:
|
17
|
+
ActionController::Base.reload_dependencies = true
|
18
|
+
ActiveRecord::Base.reload_associations = true
|
19
|
+
|
20
|
+
Now in development.rb:
|
21
|
+
Dependencies.mechanism = :load
|
22
|
+
|
23
|
+
Before in production.rb and test.rb:
|
24
|
+
ActionController::Base.reload_dependencies = false
|
25
|
+
ActiveRecord::Base.reload_associations = false
|
26
|
+
|
27
|
+
Now in production.rb and test.rb:
|
28
|
+
Dependencies.mechanism = :require
|
29
|
+
|
30
|
+
* Fixed problems with dependency caching and controller hierarchies on Ruby 1.8.2 in development mode #351
|
31
|
+
|
32
|
+
* Fixed that generated action_mailers doesnt need to require the action_mailer since thats already done in the environment #382 [Lucas Carlson]
|
33
|
+
|
34
|
+
|
1
35
|
*0.9.2*
|
2
36
|
|
3
37
|
* Fixed CTRL-C exists from the Breakpointer to be a clean affair without error dumping [Kent Sibilev]
|
data/Rakefile
CHANGED
@@ -5,11 +5,11 @@ require 'rake/gempackagetask'
|
|
5
5
|
require 'rake/contrib/rubyforgepublisher'
|
6
6
|
|
7
7
|
require 'date'
|
8
|
-
|
8
|
+
require 'rbconfig'
|
9
9
|
|
10
10
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
11
11
|
PKG_NAME = 'rails'
|
12
|
-
PKG_VERSION = '0.9.
|
12
|
+
PKG_VERSION = '0.9.3' + PKG_BUILD
|
13
13
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
14
14
|
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
15
15
|
|
@@ -100,17 +100,14 @@ task :copy_ties_content => [
|
|
100
100
|
:copy_app_doc_readme ]
|
101
101
|
|
102
102
|
task :copy_dispatches do
|
103
|
-
|
103
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb")
|
104
104
|
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
|
105
105
|
|
106
|
-
|
106
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi")
|
107
107
|
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
|
108
108
|
|
109
|
-
|
109
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi")
|
110
110
|
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
|
111
|
-
|
112
|
-
cp "bin/console", "#{PKG_DESTINATION}/script/console"
|
113
|
-
chmod 0755, "#{PKG_DESTINATION}/script/console"
|
114
111
|
end
|
115
112
|
|
116
113
|
task :copy_html_files do
|
@@ -145,7 +142,7 @@ end
|
|
145
142
|
task :copy_binfiles do
|
146
143
|
BIN_FILES.each do |file|
|
147
144
|
dest_file = File.join(PKG_DESTINATION, 'script', file)
|
148
|
-
|
145
|
+
copy_with_rewritten_ruby_path(File.join('bin', file), dest_file)
|
149
146
|
chmod 0755, dest_file
|
150
147
|
end
|
151
148
|
end
|
@@ -174,6 +171,22 @@ task :link_apache_config do
|
|
174
171
|
}
|
175
172
|
end
|
176
173
|
|
174
|
+
def copy_with_rewritten_ruby_path(src_file, dest_file)
|
175
|
+
ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
176
|
+
|
177
|
+
File.open(dest_file, 'w') do |df|
|
178
|
+
File.open(src_file) do |sf|
|
179
|
+
line = sf.gets
|
180
|
+
if (line =~ /#!.+ruby\s*/) != nil
|
181
|
+
df.puts("#!#{ruby}")
|
182
|
+
else
|
183
|
+
df.puts(line)
|
184
|
+
end
|
185
|
+
df.write(sf.read)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
177
190
|
|
178
191
|
# Generate documentation ------------------------------------------------------------------
|
179
192
|
|
@@ -220,9 +233,9 @@ spec = Gem::Specification.new do |s|
|
|
220
233
|
on top of either MySQL, PostgreSQL, or SQLite with eRuby-based templates.
|
221
234
|
EOF
|
222
235
|
|
223
|
-
s.add_dependency('rake', '>= 0.4.
|
224
|
-
s.add_dependency('activerecord', '>= 1.
|
225
|
-
s.add_dependency('actionpack', '>= 1.
|
236
|
+
s.add_dependency('rake', '>= 0.4.15')
|
237
|
+
s.add_dependency('activerecord', '>= 1.4.0')
|
238
|
+
s.add_dependency('actionpack', '>= 1.2.0')
|
226
239
|
s.add_dependency('actionmailer', '>= 0.5.0')
|
227
240
|
|
228
241
|
s.has_rdoc = false
|
@@ -246,6 +259,6 @@ end
|
|
246
259
|
# Publish beta gem
|
247
260
|
desc "Publish the API documentation"
|
248
261
|
task :pgem => [:gem] do
|
249
|
-
Rake::SshFilePublisher.new("davidhh@
|
250
|
-
`ssh davidhh@
|
262
|
+
Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
263
|
+
`ssh davidhh@comox.textdrive.com './gemupdate.sh'`
|
251
264
|
end
|
data/bin/generate
CHANGED
@@ -4,10 +4,36 @@ require 'rails_generator'
|
|
4
4
|
|
5
5
|
ARGV.shift unless ARGV.empty? or not ['--help', '-h'].include?(ARGV[0])
|
6
6
|
|
7
|
+
def find_synonyms(word)
|
8
|
+
require 'open-uri'
|
9
|
+
uri = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2" +
|
10
|
+
"&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1"
|
11
|
+
|
12
|
+
open(uri % word) do |stream|
|
13
|
+
data = stream.read.gsub(" ", " ").gsub("<BR>", "")
|
14
|
+
data.scan(/^Sense \d+\n.+?\n\n/m)
|
15
|
+
end
|
16
|
+
rescue Exception
|
17
|
+
return nil
|
18
|
+
end
|
19
|
+
|
7
20
|
unless ARGV.empty?
|
8
21
|
begin
|
9
22
|
name = ARGV.shift
|
10
|
-
Rails::Generator.instance(name, ARGV)
|
23
|
+
generator = Rails::Generator.instance(name, ARGV)
|
24
|
+
|
25
|
+
if msg = generator.collision_with_builtin? then
|
26
|
+
$stderr.puts msg
|
27
|
+
|
28
|
+
if synonyms = find_synonyms(generator.class_name) then
|
29
|
+
$stderr.puts(
|
30
|
+
"", "Here are a few synonyms from WordNet. Maybe they will help you find an alternative name.",
|
31
|
+
"", synonyms
|
32
|
+
)
|
33
|
+
end
|
34
|
+
else
|
35
|
+
generator.generate
|
36
|
+
end
|
11
37
|
rescue Rails::Generator::UsageError => e
|
12
38
|
puts e.message
|
13
39
|
end
|
@@ -40,4 +66,4 @@ end_usage
|
|
40
66
|
#{$0} login
|
41
67
|
end_usage
|
42
68
|
exit 0
|
43
|
-
end
|
69
|
+
end
|
data/environments/development.rb
CHANGED
data/environments/production.rb
CHANGED
data/environments/test.rb
CHANGED
data/fresh_rakefile
CHANGED
@@ -81,6 +81,8 @@ task :clone_development_structure_to_test => [ :db_structure_dump, :purge_test_d
|
|
81
81
|
end
|
82
82
|
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
|
83
83
|
`psql -U #{ActiveRecord::Base.configurations["test"]["username"]} -f db/development_structure.sql #{ActiveRecord::Base.configurations["test"]["database"]}`
|
84
|
+
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
|
85
|
+
`sqlite #{ActiveRecord::Base.configurations["test"]["dbfile"]} < db/development_structure.sql`
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
@@ -91,6 +93,8 @@ task :db_structure_dump do
|
|
91
93
|
File.open("db/development_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
92
94
|
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "postgresql"
|
93
95
|
`pg_dump -U #{ActiveRecord::Base.configurations["development"]["username"]} -s -f db/development_structure.sql #{ActiveRecord::Base.configurations["development"]["database"]}`
|
96
|
+
elsif ActiveRecord::Base.configurations["development"]["adapter"] == "sqlite"
|
97
|
+
`sqlite #{ActiveRecord::Base.configurations["development"]["dbfile"]} .schema > db/development_structure.sql`
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
@@ -102,5 +106,7 @@ task :purge_test_database do
|
|
102
106
|
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "postgresql"
|
103
107
|
`dropdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
|
104
108
|
`createdb -U #{ActiveRecord::Base.configurations["test"]["username"]} #{ActiveRecord::Base.configurations["test"]["database"]}`
|
109
|
+
elsif ActiveRecord::Base.configurations["test"]["adapter"] == "sqlite"
|
110
|
+
File.delete(ActiveRecord::Base.configurations["test"]["dbfile"]) if File.exist?(ActiveRecord::Base.configurations["test"]["dbfile"])
|
105
111
|
end
|
106
112
|
end
|
@@ -2,11 +2,11 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
2
2
|
require '<%= file_name %>_controller'
|
3
3
|
|
4
4
|
# Re-raise errors caught by the controller.
|
5
|
-
class <%=
|
5
|
+
class <%= full_class_name %>; def rescue_action(e) raise e end; end
|
6
6
|
|
7
|
-
class <%=
|
7
|
+
class <%= full_class_name %>Test < Test::Unit::TestCase
|
8
8
|
def setup
|
9
|
-
@controller = <%=
|
9
|
+
@controller = <%= full_class_name %>.new
|
10
10
|
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
|
11
11
|
end
|
12
12
|
|
data/lib/dispatcher.rb
CHANGED
@@ -40,11 +40,10 @@ class Dispatcher
|
|
40
40
|
rescue Object => exception
|
41
41
|
ActionController::Base.process_with_exception(request, response, exception).out
|
42
42
|
ensure
|
43
|
-
if
|
44
|
-
Object.send(:remove_const, "ApplicationController") if Object.const_defined?(:ApplicationController)
|
45
|
-
Object.send(:remove_const, controller_class_name(controller_name)) if Object.const_defined?(controller_class_name(controller_name))
|
43
|
+
if Dependencies.mechanism == :load
|
46
44
|
ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses
|
47
|
-
|
45
|
+
Dependencies.reload rescue nil # Ignore out of order reloading errors for Controllers
|
46
|
+
remove_class_hierarchy(controller_class(controller_name), ActionController::Base)
|
48
47
|
end
|
49
48
|
|
50
49
|
Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
|
@@ -74,4 +73,11 @@ class Dispatcher
|
|
74
73
|
def self.module_name(parameters)
|
75
74
|
parameters["module"].gsub(/[^_a-zA-Z0-9]/, "").untaint if parameters["module"]
|
76
75
|
end
|
76
|
+
|
77
|
+
def self.remove_class_hierarchy(klass, until_superclass)
|
78
|
+
while klass
|
79
|
+
Object.send(:remove_const, "#{klass}".intern)
|
80
|
+
klass = (klass.superclass unless until_superclass == klass.superclass)
|
81
|
+
end
|
82
|
+
end
|
77
83
|
end
|
data/lib/rails_generator.rb
CHANGED
@@ -114,6 +114,32 @@ module Rails
|
|
114
114
|
@args = args
|
115
115
|
end
|
116
116
|
|
117
|
+
# Checks whether the class name that was assigned to this generator
|
118
|
+
# would cause a collision with a Class, Module or other constant
|
119
|
+
# that is already used up by Ruby or RubyOnRails.
|
120
|
+
def collision_with_builtin?
|
121
|
+
builtin = Object.const_get(full_class_name) rescue nil
|
122
|
+
type = case builtin
|
123
|
+
when Class: "Class"
|
124
|
+
when Module: "Module"
|
125
|
+
else "Constant"
|
126
|
+
end
|
127
|
+
|
128
|
+
if builtin then
|
129
|
+
"Sorry, you can't have a #{self.class.generator_name} named " +
|
130
|
+
"'#{full_class_name}' because Ruby or Rails already has a #{type} with that name.\n" +
|
131
|
+
"Please rerun the generator with a different name."
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Returns the complete name that the resulting Class would have.
|
136
|
+
# Used in collision_with_builtin(). The default guess is that it is
|
137
|
+
# the same as class_name. Override this in your generator in case
|
138
|
+
# it is wrong.
|
139
|
+
def full_class_name
|
140
|
+
class_name
|
141
|
+
end
|
142
|
+
|
117
143
|
protected
|
118
144
|
# Look up another generator with the same arguments.
|
119
145
|
def generator(name)
|
metadata
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.4
|
3
3
|
specification_version: 1
|
4
4
|
name: rails
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date:
|
6
|
+
version: 0.9.3
|
7
|
+
date: 2005-01-04
|
8
8
|
summary: "Web-application framework with template engine, control-flow layer, and ORM."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
author: David Heinemeier Hansson
|
12
11
|
email: david@loudthinking.com
|
13
12
|
homepage: http://www.rubyonrails.org
|
14
13
|
rubyforge_project: rails
|
15
|
-
description: "Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or
|
14
|
+
description: "Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or
|
15
|
+
WEBrick on top of either MySQL, PostgreSQL, or SQLite with eRuby-based
|
16
|
+
templates."
|
16
17
|
autorequire:
|
17
18
|
default_executable: rails
|
18
19
|
bindir: bin
|
@@ -25,6 +26,8 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
26
|
version: 0.0.0
|
26
27
|
version:
|
27
28
|
platform: ruby
|
29
|
+
authors:
|
30
|
+
- David Heinemeier Hansson
|
28
31
|
files:
|
29
32
|
- bin
|
30
33
|
- CHANGELOG
|
@@ -125,7 +128,7 @@ dependencies:
|
|
125
128
|
-
|
126
129
|
- ">="
|
127
130
|
- !ruby/object:Gem::Version
|
128
|
-
version: 0.4.
|
131
|
+
version: 0.4.15
|
129
132
|
version:
|
130
133
|
- !ruby/object:Gem::Dependency
|
131
134
|
name: activerecord
|
@@ -135,7 +138,7 @@ dependencies:
|
|
135
138
|
-
|
136
139
|
- ">="
|
137
140
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
141
|
+
version: 1.4.0
|
139
142
|
version:
|
140
143
|
- !ruby/object:Gem::Dependency
|
141
144
|
name: actionpack
|
@@ -145,7 +148,7 @@ dependencies:
|
|
145
148
|
-
|
146
149
|
- ">="
|
147
150
|
- !ruby/object:Gem::Version
|
148
|
-
version: 1.
|
151
|
+
version: 1.2.0
|
149
152
|
version:
|
150
153
|
- !ruby/object:Gem::Dependency
|
151
154
|
name: actionmailer
|