Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Disable THOR_DEBUG while running generators

Bundler 1.5 enables THOR_DEBUG so that it doesn't fail silently but this
breaks the railties tests as we can't capture the error output. It will
be fixed in Bundler 1.5.2 but until then disable THOR_DEBUG whilst we are
running generators in the railties tests.
  • Loading branch information...
commit b2e3a90ed8ea732c0f3df406967c7c2e5cd60ee5 1 parent 0c73408
@pixeltrix pixeltrix authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 railties/lib/rails/generators/testing/behaviour.rb
View
16 railties/lib/rails/generators/testing/behaviour.rb
@@ -61,9 +61,11 @@ def destination(path)
# You can provide a configuration hash as second argument. This method returns the output
# printed by the generator.
def run_generator(args=self.default_arguments, config={})
- capture(:stdout) do
- args += ['--skip-bundle'] unless args.include? '--dev'
- self.generator_class.start(args, config.reverse_merge(destination_root: destination_root))
+ without_thor_debug do
+ capture(:stdout) do
+ args += ['--skip-bundle'] unless args.include? '--dev'
+ self.generator_class.start(args, config.reverse_merge(destination_root: destination_root))
+ end
end
end
@@ -100,6 +102,14 @@ def migration_file_name(relative) # :nodoc:
dirname, file_name = File.dirname(absolute), File.basename(absolute).sub(/\.rb$/, '')
Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{file_name}.rb$/).first
end
+
+ # TODO: remove this once Bundler 1.5.2 is released
+ def without_thor_debug # :nodoc:
+ thor_debug, ENV['THOR_DEBUG'] = ENV['THOR_DEBUG'], nil
+ yield
+ ensure
+ ENV['THOR_DEBUG'] = thor_debug
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.