1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.

This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.

This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.

This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.

rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.

From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:56:25 +00:00
..
bundler Merge 1-16-stable branch of bundler. 2017-12-12 06:15:44 +00:00
cgi Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
drb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
forwardable forwardable/impl.rb 2016-11-20 02:12:48 +00:00
irb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
matrix get rid of ambiguous parentheses warnings 2016-11-29 16:06:54 +00:00
net Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
optparse optparse/kwargs.rb 2016-10-14 13:26:13 +00:00
racc Fixed misspelling words. 2017-10-22 11:27:06 +00:00
rdoc Bump version to rdoc-6.0.0. 2017-12-05 11:08:00 +00:00
rexml Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
rinda Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
rss Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
rubygems Merge rubygems-2.7.3. 2017-11-28 22:30:28 +00:00
shell Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
unicode_normalize update Ruby to Unicode 10.0.0 2017-09-06 07:56:41 +00:00
uri Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
webrick Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
yaml * lib/yaml/store.rb (YAML::Store#dump): use table argument instead of @table directly. 2016-09-29 14:40:34 +00:00
.document Ignore gemspec under the lib directory for documentation. 2017-12-12 08:34:13 +00:00
abbrev.rb lib/abbrev.rb: Specify frozen_string_literal: true. 2017-02-09 16:12:00 +00:00
base64.rb Use unpack1 instead of unpack and first 2017-02-10 00:58:47 +00:00
benchmark.rb lib/benchmark.rb: Specify frozen_string_literal: true. 2017-01-03 02:00:01 +00:00
bundler.gemspec Merge 1-16-stable branch of bundler. 2017-12-12 06:15:44 +00:00
bundler.rb Update bundled bundler to 1.16.0. 2017-11-01 23:29:38 +00:00
cgi.rb {lib,test}/cgi: Specify frozen_string_literal: true. 2017-02-18 05:52:16 +00:00
cmath.gemspec Bump version to cmath-1.0.0 as default gems. 2017-12-11 03:27:47 +00:00
cmath.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
csv.gemspec Merge csv-0.1.0 from upstream. 2017-09-12 08:38:06 +00:00
csv.rb Merge csv-0.1.0 from upstream. 2017-09-12 08:38:06 +00:00
debug.rb lib/debug.rb: Specify frozen_string_literal: true. 2017-01-05 01:00:01 +00:00
delegate.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
drb.rb
e2mmap.rb lib/e2mmap.rb: Specify frozen_string_literal: true. 2017-03-01 11:37:30 +00:00
English.rb $IGNORECASE is no longer effective. [ci skip] 2017-08-25 15:47:04 +00:00
erb.rb erb.rb: specify frozen_string_literal: true 2017-10-21 15:02:46 +00:00
fileutils.gemspec Bump version to fileutils-1.0.1. 2017-12-12 10:57:58 +00:00
fileutils.rb Overwrite destination symlink file if remove_destination is set. 2017-10-20 07:03:11 +00:00
find.rb Find.find -> Use Dir.children instead of Dir.entries 2017-09-15 17:00:49 +00:00
forwardable.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
getoptlong.rb getoptlong.rb: multiline regexps 2017-09-02 02:05:34 +00:00
ipaddr.gemspec Import ipaddr 1.2.0 2017-10-21 13:34:19 +00:00
ipaddr.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
irb.rb irb.rb: preserve ARGV on binding.irb 2017-12-12 11:25:16 +00:00
logger.rb logger.rb: Fix handling progname 2017-07-20 16:47:26 +00:00
matrix.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
mkmf.rb bccwin is no longer supported 2017-12-11 02:30:42 +00:00
monitor.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
mutex_m.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
observer.rb lib/observer.rb: Specify frozen_string_literal: true. 2017-01-13 12:08:29 +00:00
open-uri.rb lib/open-uri.rb: accept :encoding option as well as encoding in mode string. 2017-10-21 06:22:53 +00:00
open3.rb lib/open3.rb: accept IO-like object for :stdin_data argument. 2017-10-21 07:00:58 +00:00
optionparser.rb
optparse.rb optparse.rb: case-sensitive candidate 2017-07-24 01:56:04 +00:00
ostruct.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
pp.rb lib/pp.rb: remove alias for suppressing a redefinition warning. 2017-12-11 04:46:57 +00:00
prettyprint.rb
prime.rb prime.rb: remove alias after timeout test 2017-05-20 10:21:44 +00:00
profile.rb lib/profile.rb: Specify frozen_string_literal: true. 2017-01-15 02:56:04 +00:00
profiler.rb lib/profiler.rb: Specify frozen_string_literal: true. 2017-01-18 12:35:10 +00:00
pstore.rb lib/pstore.rb: Specify frozen_string_literal: true. 2017-01-17 12:47:38 +00:00
rdoc.rb Bump version to rdoc-6.0.0. 2017-12-05 11:08:00 +00:00
resolv-replace.rb
resolv.rb Fixed unexpected behavior of Resolv::MDNS#each_address when given ".local" address. 2017-10-21 13:58:31 +00:00
rss.rb
rubygems.rb Merge rubygems-2.7.3. 2017-11-28 22:30:28 +00:00
scanf.gemspec Bump version to scanf-1.0.0 as default gems. 2017-12-11 08:18:01 +00:00
scanf.rb Fix bug about String#scanf("%a") 2017-10-21 12:34:13 +00:00
securerandom.rb securerandom.rb: fix an example of choose [ci skip] 2017-10-25 07:28:22 +00:00
set.rb lib/set.rb: [DOC] remove empty comments 2017-11-22 21:13:51 +00:00
shell.rb shell.rb: suppress warnings 2016-11-05 23:58:02 +00:00
shellwords.rb Fix the handling of the backslash in double quotes 2016-11-05 04:58:48 +00:00
singleton.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
sync.rb * lib/sync.rb: Fix NameError when error. 2016-09-18 10:24:48 +00:00
tempfile.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
thwait.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
time.rb Make Time.parse respect timezone offset seconds 2017-10-20 01:03:18 +00:00
timeout.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00
tmpdir.rb tmpdir.rb: merged make_tmpname to create 2017-11-15 08:02:09 +00:00
tracer.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
tsort.rb
un.rb un.rb: use OpenSSL::PKey.read instead of OpenSSL::PKey::RSA.new 2017-07-05 09:05:53 +00:00
uri.rb
weakref.rb lib/weakref: Remove incorrect example [DOC] [Bug #14031] 2017-10-24 18:08:00 +00:00
webrick.rb
yaml.rb Add uplevel keyword to Kernel#warn and use it 2017-12-12 11:56:25 +00:00