From 92e2e5990cc2aa4f699c286ac5d1f73e27ede548 Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 6 May 2008 01:20:59 -0700 Subject: include bugfix to [e792d4ab70448f79142fdf492390682ff5ea6398] for rubygems 1.0.1. Gem::DependencyList#dependency_order was bombing with nil specs passed in from a frozen gem. [#122] --- railties/lib/rails/plugin/locator.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/plugin/locator.rb b/railties/lib/rails/plugin/locator.rb index fd7de4ee28..f06a51a572 100644 --- a/railties/lib/rails/plugin/locator.rb +++ b/railties/lib/rails/plugin/locator.rb @@ -78,11 +78,12 @@ module Rails # a rails/init.rb file. class GemLocator < Locator def plugins - specs = initializer.configuration.gems.map(&:specification) - specs + Gem.loaded_specs.values.select do |spec| + specs = initializer.configuration.gems.map(&:specification) + specs += Gem.loaded_specs.values.select do |spec| spec.loaded_from && # prune stubs File.exist?(File.join(spec.full_gem_path, "rails", "init.rb")) end + specs.compact! require "rubygems/dependency_list" -- cgit v1.2.3 From 80e18e759e5244bbffd637e306f4f18b92af5caf Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 11 May 2008 23:51:30 +0100 Subject: Ensure dbconsole respects erb in database.yml. [#157 state:resolved] [Andrew Bennett] Signed-off-by: Pratik Naik --- railties/lib/commands/dbconsole.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/commands/dbconsole.rb b/railties/lib/commands/dbconsole.rb index 28c3a3e41f..3e5010c688 100644 --- a/railties/lib/commands/dbconsole.rb +++ b/railties/lib/commands/dbconsole.rb @@ -1,3 +1,4 @@ +require 'erb' require 'yaml' require 'optparse' @@ -8,7 +9,7 @@ OptionParser.new do |opt| end env = ARGV.first || ENV['RAILS_ENV'] || 'development' -unless config = YAML.load_file(RAILS_ROOT + "/config/database.yml")[env] +unless config = YAML::load(ERB.new(IO.read(RAILS_ROOT + "/config/database.yml")).result)[env] abort "No database is configured for the environment '#{env}'" end -- cgit v1.2.3 From b60c8a573e63998b4aa3f93a1728bb9b6c6fb8f9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 May 2008 18:29:44 -0500 Subject: Making ready for RC1 release --- railties/lib/rails/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb index da90645738..fea63beea9 100644 --- a/railties/lib/rails/version.rb +++ b/railties/lib/rails/version.rb @@ -2,7 +2,7 @@ module Rails module VERSION #:nodoc: MAJOR = 2 MINOR = 0 - TINY = 2 + TINY = 991 STRING = [MAJOR, MINOR, TINY].join('.') end -- cgit v1.2.3 From 00640de861797b258d2dd955b861bcb021d4a3e1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 May 2008 18:34:05 -0500 Subject: Updated copyright years --- railties/lib/dispatcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 9db424f14b..0bad45d9d8 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2004-2007 David Heinemeier Hansson +# Copyright (c) 2004-2008 David Heinemeier Hansson # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the -- cgit v1.2.3 From 9fb01ce4b194567e84fa2f8582410fc76720a31f Mon Sep 17 00:00:00 2001 From: Matthew Brindley Date: Mon, 12 May 2008 13:20:54 +1200 Subject: ScaffoldGenerator to create public/stylesheets if missing. [#165 state:resolved] Signed-off-by: Pratik Naik --- .../generators/components/scaffold/scaffold_generator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb index 864a0bc528..e2902bf4b9 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -34,7 +34,7 @@ class ScaffoldGenerator < Rails::Generator::NamedBase m.class_collisions(controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}Helper") m.class_collisions(class_path, "#{class_name}") - # Controller, helper, views, and test directories. + # Controller, helper, views, test and stylesheets directories. m.directory(File.join('app/models', class_path)) m.directory(File.join('app/controllers', controller_class_path)) m.directory(File.join('app/helpers', controller_class_path)) @@ -42,6 +42,7 @@ class ScaffoldGenerator < Rails::Generator::NamedBase m.directory(File.join('app/views/layouts', controller_class_path)) m.directory(File.join('test/functional', controller_class_path)) m.directory(File.join('test/unit', class_path)) + m.directory(File.join('public/stylesheets', class_path)) for action in scaffold_views m.template( -- cgit v1.2.3 From 4dedc7ddcaffa8c606af11ae2d32707131b99a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarmo=20T=C3=A4nav?= Date: Tue, 13 May 2008 17:26:05 +0300 Subject: Use 'postgres' database instead of 'template1' The 'postgres' database is meant for use by utilities and third party applications. CONNECT permission to the 'template1' database is usually only available to superusers which is why 'postgres' should be preferred as users whith "CREATE DATABASE" permissions are not neccessarily superusers. --- railties/lib/tasks/databases.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 63f71448f8..fe099e30b9 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -45,7 +45,7 @@ namespace :db do when 'postgresql' @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8' begin - ActiveRecord::Base.establish_connection(config.merge('database' => 'template1')) + ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres')) ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding)) ActiveRecord::Base.establish_connection(config) rescue @@ -368,7 +368,7 @@ def drop_database(config) when /^sqlite/ FileUtils.rm(File.join(RAILS_ROOT, config['database'])) when 'postgresql' - ActiveRecord::Base.establish_connection(config.merge('database' => 'template1')) + ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres')) ActiveRecord::Base.connection.drop_database config['database'] end end -- cgit v1.2.3 From 3fee2378edd45188e41a7d14d4ca0a88280b541e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarmo=20T=C3=A4nav?= Date: Tue, 13 May 2008 20:20:52 +0300 Subject: Use 'public' schema path when connecting to 'postgres' database. [#170 state:resolved] Signed-off-by: Pratik Naik --- railties/lib/tasks/databases.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index fe099e30b9..f40f8463f7 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -45,7 +45,7 @@ namespace :db do when 'postgresql' @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8' begin - ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres')) + ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public')) ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding)) ActiveRecord::Base.establish_connection(config) rescue @@ -368,7 +368,7 @@ def drop_database(config) when /^sqlite/ FileUtils.rm(File.join(RAILS_ROOT, config['database'])) when 'postgresql' - ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres')) + ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public')) ActiveRecord::Base.connection.drop_database config['database'] end end -- cgit v1.2.3 From 2d372d704987e05712ccd937e78d8dbd41242efe Mon Sep 17 00:00:00 2001 From: Amol Hatwar Date: Tue, 13 May 2008 16:02:56 -0500 Subject: Fixed generator collisions for nested controller modules. Signed-off-by: Joshua Peek --- railties/lib/rails_generator/commands.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index 440bab276c..03b7d354a6 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -154,28 +154,35 @@ HELP # Ruby or Rails. In the future, expand to check other namespaces # such as the rest of the user's app. def class_collisions(*class_names) + + # Initialize some check varibles + last_class = Object + current_class = nil + name = nil + class_names.flatten.each do |class_name| # Convert to string to allow symbol arguments. class_name = class_name.to_s # Skip empty strings. - next if class_name.strip.empty? + class_name.strip.empty? ? next : current_class = class_name # Split the class from its module nesting. nesting = class_name.split('::') name = nesting.pop # Extract the last Module in the nesting. - last = nesting.inject(Object) { |last, nest| - break unless last.const_defined?(nest) - last.const_get(nest) + last = nesting.inject(last_class) { |last, nest| + break unless last_class.const_defined?(nest) + last_class = last_class.const_get(nest) } - # If the last Module exists, check whether the given - # class exists and raise a collision if so. - if last and last.const_defined?(name.camelize) - raise_class_collision(class_name) - end + end + # If the last Module exists, check whether the given + # class exists and raise a collision if so. + + if last_class and last_class.const_defined?(name.camelize) + raise_class_collision(current_class) end end -- cgit v1.2.3