aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 22:08:41 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 11:58:40 -0300
commit481e49c64f790e46f4aff3ed539ed227d2eb46cb (patch)
tree2554f68cb6760765764799be4cf6fd58212a8686 /activesupport/lib
parent98ea19925d6db642731741c3b91bd085fac92241 (diff)
downloadrails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.tar.gz
rails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.tar.bz2
rails-481e49c64f790e46f4aff3ed539ed227d2eb46cb.zip
Remove deprecated methods at `Kernel`.
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/reporting.rb80
1 files changed, 0 insertions, 80 deletions
diff --git a/activesupport/lib/active_support/core_ext/kernel/reporting.rb b/activesupport/lib/active_support/core_ext/kernel/reporting.rb
index f5179552bb..eb44646848 100644
--- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb
@@ -29,34 +29,6 @@ module Kernel
$VERBOSE = old_verbose
end
- # For compatibility
- def silence_stderr #:nodoc:
- ActiveSupport::Deprecation.warn(
- "`#silence_stderr` is deprecated and will be removed in the next release."
- ) #not thread-safe
- silence_stream(STDERR) { yield }
- end
-
- # Deprecated : this method is not thread safe
- # Silences any stream for the duration of the block.
- #
- # silence_stream(STDOUT) do
- # puts 'This will never be seen'
- # end
- #
- # puts 'But this will'
- #
- # This method is not thread-safe.
- def silence_stream(stream)
- old_stream = stream.dup
- stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
- stream.sync = true
- yield
- ensure
- stream.reopen(old_stream)
- old_stream.close
- end
-
# Blocks and ignores any exception passed as argument if raised within the block.
#
# suppress(ZeroDivisionError) do
@@ -69,56 +41,4 @@ module Kernel
yield
rescue *exception_classes
end
-
- # Captures the given stream and returns it:
- #
- # stream = capture(:stdout) { puts 'notice' }
- # stream # => "notice\n"
- #
- # stream = capture(:stderr) { warn 'error' }
- # stream # => "error\n"
- #
- # even for subprocesses:
- #
- # stream = capture(:stdout) { system('echo notice') }
- # stream # => "notice\n"
- #
- # stream = capture(:stderr) { system('echo error 1>&2') }
- # stream # => "error\n"
- def capture(stream)
- ActiveSupport::Deprecation.warn(
- "`#capture(stream)` is deprecated and will be removed in the next release."
- ) #not thread-safe
- stream = stream.to_s
- captured_stream = Tempfile.new(stream)
- stream_io = eval("$#{stream}")
- origin_stream = stream_io.dup
- stream_io.reopen(captured_stream)
-
- yield
-
- stream_io.rewind
- return captured_stream.read
- ensure
- captured_stream.close
- captured_stream.unlink
- stream_io.reopen(origin_stream)
- end
- alias :silence :capture
-
- # Silences both STDOUT and STDERR, even for subprocesses.
- #
- # quietly { system 'bundle install' }
- #
- # This method is not thread-safe.
- def quietly
- ActiveSupport::Deprecation.warn(
- "`#quietly` is deprecated and will be removed in the next release."
- ) #not thread-safe
- silence_stream(STDOUT) do
- silence_stream(STDERR) do
- yield
- end
- end
- end
end