From 9789d221373123d5d9c26173985080881fcb536a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 26 Jul 2010 11:41:52 +0200 Subject: Update to latest thor. --- railties/railties.gemspec | 2 +- railties/test/generators/app_generator_test.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'railties') diff --git a/railties/railties.gemspec b/railties/railties.gemspec index 38dcb17ff1..d76b74190b 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.has_rdoc = false s.add_dependency('rake', '>= 0.8.3') - s.add_dependency('thor', '~> 0.13.7') + s.add_dependency('thor', '~> 0.14.0') s.add_dependency('activesupport', version) s.add_dependency('actionpack', version) end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index aca30e92b6..67a878e926 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -172,7 +172,7 @@ class AppGeneratorTest < Rails::Generators::TestCase template.instance_eval "def read; self; end" # Make the string respond to read generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) - assert_match /It works!/, silence(:stdout){ generator.invoke } + assert_match /It works!/, silence(:stdout){ generator.invoke_all } end def test_usage_read_from_file @@ -196,14 +196,14 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_dev_option generator([destination_root], :dev => true).expects(:run).with("#{@bundle_command} install") - silence(:stdout){ generator.invoke } + silence(:stdout){ generator.invoke_all } rails_path = File.expand_path('../../..', Rails.root) assert_file 'Gemfile', /^gem\s+["']rails["'],\s+:path\s+=>\s+["']#{Regexp.escape(rails_path)}["']$/ end def test_edge_option generator([destination_root], :edge => true).expects(:run).with("#{@bundle_command} install") - silence(:stdout){ generator.invoke } + silence(:stdout){ generator.invoke_all } assert_file 'Gemfile', /^gem\s+["']rails["'],\s+:git\s+=>\s+["']#{Regexp.escape("git://github.com/rails/rails.git")}["']$/ end @@ -267,7 +267,7 @@ class CustomAppGeneratorTest < Rails::Generators::TestCase template.instance_eval "def read; self; end" # Make the string respond to read generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) - capture(:stdout) { generator.invoke } + capture(:stdout) { generator.invoke_all } DEFAULT_APP_FILES.each{ |path| assert_no_file path } end -- cgit v1.2.3 From 514624e53c7b3008e3c492ef01f4d85188cdbbd7 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 26 Jul 2010 12:16:36 -0300 Subject: Fixes usage message when running rails without --dev on a cloned rails repo --- railties/lib/rails/generators/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 67a9a6030d..fdfceb14ce 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -3,7 +3,7 @@ begin rescue LoadError puts "Thor is not available.\nIf you ran this command from a git checkout " \ "of Rails, please make sure thor is installed,\nand run this command " \ - "as `ruby /path/to/rails new myapp --dev`" + "as `ruby #{$0} #{ARGV.join(" ")} --dev`" exit end -- cgit v1.2.3 From fd589db8633ef3eda398365f2a6d551edfed547e Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 25 Jul 2010 20:59:18 -0300 Subject: Changed returning with tap on guides --- railties/guides/source/plugins.textile | 2 +- railties/guides/source/security.textile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index e853ba79e9..82f2276153 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -1274,7 +1274,7 @@ class YaffleMigrationGenerator < Rails::Generator::NamedBase end def yaffle_local_assigns - returning(assigns = {}) do + {}.tap do |assigns| assigns[:migration_action] = "add" assigns[:class_name] = "add_yaffle_fields_to_#{custom_file_name}" assigns[:table_name] = custom_file_name diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile index 60108d5ab3..8ce0001080 100644 --- a/railties/guides/source/security.textile +++ b/railties/guides/source/security.textile @@ -286,7 +286,7 @@ When filtering user input file names, _(highlight)don't try to remove malicious def sanitize_filename(filename) - returning filename.strip do |name| + filename.strip.tap do |name| # NOTE: File.basename doesn't work right with Windows paths on Unix # get only the filename, not the whole path name.sub! /\A.*(\\|\/)/, '' -- cgit v1.2.3