From 59f3218463228ca2301857cd7bf4f82f308924a6 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 21 Jan 2011 17:53:28 -0800 Subject: load and prefer psych as the YAML parser when it is available --- railties/lib/rails/commands/dbconsole.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 14d245ab2e..300fd6da05 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -1,4 +1,10 @@ require 'erb' + +begin + require 'psych' +rescue LoadError +end + require 'yaml' require 'optparse' require 'rbconfig' -- cgit v1.2.3 From dcc72b207922faba896eb9560a7186a90223cb8b Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 29 Jan 2011 10:59:29 +0800 Subject: Use Thor's self.exit_on_failure? to exit whenever accessing the generators from the CLI and a Thor::Error is raised. --- railties/lib/rails/commands/application.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index 47c6752ca3..3b57b925ba 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -15,4 +15,16 @@ require 'rubygems' if ARGV.include?("--dev") require 'rails/generators' require 'rails/generators/rails/app/app_generator' +module Rails + module Generators + class AppGenerator + # We want to exit on failure to be kind to other libraries + # This is only when accessing via CLI + def self.exit_on_failure? + true + end + end + end +end + Rails::Generators::AppGenerator.start -- cgit v1.2.3 From 2e11213d62f25d41ccf77b3d0f5b69aad0bf165b Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 16 Jan 2011 07:47:41 +0900 Subject: "rails dbconsole t" must not load "production" but "test" [#6293 state:committed] Signed-off-by: Santiago Pastorino --- railties/lib/rails/commands/dbconsole.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 300fd6da05..9dbc1699ee 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -119,5 +119,5 @@ end # Has to set the RAILS_ENV before config/application is required if ARGV.first && !ARGV.first.index("-") && env = ARGV.first - ENV['RAILS_ENV'] = %w(production development test).find { |e| e.index(env) } || env + ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env end -- cgit v1.2.3 From 8a85f64abffde29ddfd521d63d566f98796ae400 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 16 Dec 2010 22:03:01 +0900 Subject: Accept 'postgres' as a PostgreSQL driver name in dbconsole for non-AR ORMs like DataMapper and Sequel [#6180 state:committed] Signed-off-by: Santiago Pastorino --- railties/lib/rails/commands/dbconsole.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 9dbc1699ee..f0d6ea1687 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -80,7 +80,7 @@ module Rails exec(find_cmd('mysql', 'mysql5'), *args) - when "postgresql" + when "postgresql", "postgres" ENV['PGUSER'] = config["username"] if config["username"] ENV['PGHOST'] = config["host"] if config["host"] ENV['PGPORT'] = config["port"].to_s if config["port"] -- cgit v1.2.3 From e89ba63b885b4b8e65d0516b568c0057a3847b7c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 2 Feb 2011 20:39:49 -0500 Subject: Drop remaining script/plugin sources references [#3742 state:committed] Signed-off-by: Santiago Pastorino --- railties/lib/rails/commands/plugin.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'railties/lib/rails/commands') diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb index 8b2cd1bdba..048af7cbef 100644 --- a/railties/lib/rails/commands/plugin.rb +++ b/railties/lib/rails/commands/plugin.rb @@ -276,12 +276,11 @@ end require 'optparse' module Commands class Plugin - attr_reader :environment, :script_name, :sources + attr_reader :environment, :script_name def initialize @environment = RailsEnvironment.default @rails_root = RailsEnvironment.default.root @script_name = File.basename($0) - @sources = [] end def environment=(value) @@ -301,8 +300,6 @@ module Commands o.on("-r", "--root=DIR", String, "Set an explicit rails app directory.", "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| @sources = sources} o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose } o.on("-h", "--help", "Show this help message.") { puts o; exit } @@ -315,8 +312,6 @@ module Commands o.separator "" o.separator "EXAMPLES" - o.separator " Install a plugin:" - o.separator " #{@script_name} plugin install continuous_builder\n" o.separator " Install a plugin from a subversion URL:" o.separator " #{@script_name} plugin install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder\n" o.separator " Install a plugin from a git URL:" -- cgit v1.2.3