Rails 2.1.1

Among other things, a security fix.
This commit is contained in:
Jacques Distler 2008-09-07 00:54:05 -05:00
parent d2c4c8737c
commit d4f97345db
354 changed files with 21027 additions and 3072 deletions

View file

@ -57,6 +57,17 @@ module Rails
end
protected
def current_migration_number
Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path|
n = File.basename(file_path).split('_', 2).first.to_i
if n > max then n else max end
end
end
def next_migration_number
current_migration_number + 1
end
def migration_directory(relative_path)
directory(@migration_directory = relative_path)
end
@ -70,7 +81,11 @@ module Rails
end
def next_migration_string(padding = 3)
Time.now.utc.strftime("%Y%m%d%H%M%S")
if ActiveRecord::Base.timestamped_migrations
Time.now.utc.strftime("%Y%m%d%H%M%S")
else
"%.#{padding}d" % next_migration_number
end
end
def gsub_file(relative_destination, regexp, *args, &block)
@ -88,7 +103,7 @@ module Rails
Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
temp.write render_file(src, file_options, &block)
temp.rewind
$stdout.puts `#{diff_cmd} #{dst} #{temp.path}`
$stdout.puts `#{diff_cmd} "#{dst}" "#{temp.path}"`
end
puts "retrying"
raise 'retry diff'

View file

@ -1,6 +1,6 @@
require 'test_helper'
class <%= class_name %>ObserverTest < Test::Unit::TestCase
class <%= class_name %>ObserverTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true

View file

@ -108,7 +108,7 @@ module Rails
sources << PathSource.new(:vendor, "#{::RAILS_ROOT}/vendor/generators")
Rails.configuration.plugin_paths.each do |path|
relative_path = Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT))
sources << PathSource.new(:"plugins (#{relative_path})", "#{path}/**/{,rails_}generators")
sources << PathSource.new(:"plugins (#{relative_path})", "#{path}/*/**/{,rails_}generators")
end
end
sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators")