aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJames Miller <james@jkmillertech.com>2008-09-10 11:27:38 -0700
committerJames Miller <james@jkmillertech.com>2008-09-10 11:27:38 -0700
commit383467fb5da3d0d17bb3e41b6b4c0ab69b2ef082 (patch)
tree2e81d95ccbb48189f8d456f69c32389bbb122c71 /railties
parent6704e90c900555196080165c242d6999d1fcfaba (diff)
parent6d1be5f1eb83fb693ffd00e1967c1b3ca1c9ece3 (diff)
downloadrails-383467fb5da3d0d17bb3e41b6b4c0ab69b2ef082.tar.gz
rails-383467fb5da3d0d17bb3e41b6b4c0ab69b2ef082.tar.bz2
rails-383467fb5da3d0d17bb3e41b6b4c0ab69b2ef082.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/commands/plugin.rb18
-rw-r--r--railties/lib/commands/process/spawner.rb4
-rw-r--r--railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb1
-rw-r--r--railties/lib/tasks/databases.rake24
5 files changed, 31 insertions, 18 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 3a276d5aad..51d66e4c01 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Fixed that sqlite would report "db/development.sqlite3 already exists" whether true or not on db:create #614 [Antonio Cangiano]
+
* Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader [Josh Peek]
* Turn cache_classes on by default [Josh Peek]
diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb
index 980244a71b..9ff4739562 100644
--- a/railties/lib/commands/plugin.rb
+++ b/railties/lib/commands/plugin.rb
@@ -461,11 +461,11 @@ module Commands
o.on("-r", "--root=DIR", String,
"Set an explicit rails app directory.",
- "Default: #{@rails_root}") { |@rails_root| self.environment = RailsEnvironment.new(@rails_root) }
+ "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
o.on("-s", "--source=URL1,URL2", Array,
- "Use the specified plugin repositories instead of the defaults.") { |@sources|}
+ "Use the specified plugin repositories instead of the defaults.") { |sources| @sources = sources}
- o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| }
+ o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
o.on("-h", "--help", "Show this help message.") { puts o; exit }
o.separator ""
@@ -552,12 +552,12 @@ module Commands
o.separator "Options:"
o.separator ""
o.on( "-s", "--source=URL1,URL2", Array,
- "Use the specified plugin repositories.") {|@sources|}
+ "Use the specified plugin repositories.") {|sources| @sources = sources}
o.on( "--local",
- "List locally installed plugins.") {|@local| @remote = false}
+ "List locally installed plugins.") {|local| @local, @remote = local, false}
o.on( "--remote",
"List remotely available plugins. This is the default behavior",
- "unless --local is provided.") {|@remote|}
+ "unless --local is provided.") {|remote| @remote = remote}
end
end
@@ -598,7 +598,7 @@ module Commands
o.separator "Options:"
o.separator ""
o.on( "-c", "--check",
- "Report status of repository.") { |@sources|}
+ "Report status of repository.") { |sources| @sources = sources}
end
end
@@ -689,7 +689,7 @@ module Commands
o.separator "Options:"
o.separator ""
o.on( "-l", "--list",
- "List but don't prompt or add discovered repositories.") { |@list| @prompt = !@list }
+ "List but don't prompt or add discovered repositories.") { |list| @list, @prompt = list, !@list }
o.on( "-n", "--no-prompt",
"Add all new repositories without prompting.") { |v| @prompt = !v }
end
@@ -901,7 +901,7 @@ class RecursiveHTTPFetcher
def initialize(urls_to_fetch, level = 1, cwd = ".")
@level = level
@cwd = cwd
- @urls_to_fetch = urls_to_fetch.to_a
+ @urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a
@quiet = false
end
diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb
index dc0008698a..8bf47abb75 100644
--- a/railties/lib/commands/process/spawner.rb
+++ b/railties/lib/commands/process/spawner.rb
@@ -181,10 +181,10 @@ ARGV.options do |opts|
opts.on(" Options:")
- opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| }
+ opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
if spawner_class.can_bind_to_custom_address?
- opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |OPTIONS[:address]| }
+ opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |v| OPTIONS[:address] = v }
end
opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb b/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
index 1b7bcfef08..4de94076e9 100644
--- a/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
+++ b/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
@@ -1,7 +1,6 @@
require 'test_helper'
class <%= class_name %>Test < ActionMailer::TestCase
- tests <%= class_name %>
<% for action in actions -%>
test "<%= action %>" do
@expected.subject = '<%= class_name %>#<%= action %>'
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake
index 21c81b3fb5..cc079b1d93 100644
--- a/railties/lib/tasks/databases.rake
+++ b/railties/lib/tasks/databases.rake
@@ -28,8 +28,24 @@ namespace :db do
def create_database(config)
begin
- ActiveRecord::Base.establish_connection(config)
- ActiveRecord::Base.connection
+ if config['adapter'] =~ /sqlite/
+ if File.exist?(config['database'])
+ $stderr.puts "#{config['database']} already exists"
+ else
+ begin
+ # Create the SQLite database
+ ActiveRecord::Base.establish_connection(config)
+ ActiveRecord::Base.connection
+ rescue
+ $stderr.puts $!, *($!.backtrace)
+ $stderr.puts "Couldn't create database for #{config.inspect}"
+ end
+ end
+ return # Skip the else clause of begin/rescue
+ else
+ ActiveRecord::Base.establish_connection(config)
+ ActiveRecord::Base.connection
+ end
rescue
case config['adapter']
when 'mysql'
@@ -52,10 +68,6 @@ namespace :db do
$stderr.puts $!, *($!.backtrace)
$stderr.puts "Couldn't create database for #{config.inspect}"
end
- when 'sqlite'
- `sqlite "#{config['database']}"`
- when 'sqlite3'
- `sqlite3 "#{config['database']}"`
end
else
$stderr.puts "#{config['database']} already exists"