Граф коммитов

94 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 593d978646 tempfile.rb: [DOC] all arguments [ci skip]
* lib/tempfile.rb (Tempfile.create): mention the other arguments
  too.  [ruby-core:83321] [Misc #14019]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-17 12:40:00 +00:00
nobu 6b4cd8a996 Layout fixes in rdoc of lib/tempfile.rb [ci skip]
RDoc doesn't understand an asterisk inside the plus markers. Moving them
out of the markers looks better.
[Fix GH-1716]

From:    Herwin Weststrate <herwinw@herwinw.nl>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-16 23:11:40 +00:00
nobu a6df192ded tempfile.rb: do not call File.identical? on closed stream
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:36:34 +00:00
nobu 3c5344bf30 tempfile.rb: remove in Tempfile.create
* lib/tempfile.rb (Tempfile.create): should not fail even if the
  temporary file has been removed in the block, just ignore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:20:14 +00:00
glass 279d31f11d Fix bug of Tempfile#size if nothing is written [Bug #13198]
* lib/tempfile.rb (Tempfile#size): Fix its behavior when nothing
  is written. Tempfile#size should return 0 in this case.
  The patch is from nobu <nobu@ruby-lang.org>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 12:53:32 +00:00
kazu 562bbdf995 lib/tempfile.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-21 12:21:05 +00:00
normal f845a9ef76 lib/*: remove closed checks
Follow r56795.  Since Ruby 2.2, calling #close on a closed
socket no longer raises exceptions.

* lib/cgi/session.rb (update): remove closed? check
* lib/net/http.rb (finish, transport_request): ditto
* lib/net/imap.rb (disconnect): ditto
* lib/net/pop.rb (do_start, do_finish): ditto
* lib/net/smtp.rb (do_start, do_finish): ditto
* lib/open3.rb (popen_run, pipeline_run): ditto
* lib/pstore.rb (transaction): ditto
* lib/shell/process-controller.rb (sfork):
* lib/tempfile (_close, call, Tempfile.create): ditto
* lib/webrick/httpauth/htdigest.rb (flush): ditto
* lib/webrick/httpauth/htpasswd.rb (flush): ditto
* lib/webrick/server.rb (start_thread, cleanup_shutdown_pipe): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21 23:05:41 +00:00
sonots 64f53f0dbf * lib/tempfile.rb: provide default basename parameter
for Tempfile.create. [Feature #11965] Patch by Yuki Kurihara
* test/test_tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 05:45:29 +00:00
nobu 75687e0aff Fix doc with default value with GH-523
* lib/tempfile.rb (Tempfile#initialize): [DOC] the first parameter
  `basename` is optional and defaulted to an empty string since
  [GH-523].  [Fix GH-1225]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-27 07:35:34 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt 654b90d31a * lib/tempfile.rb: Fix typo. [fix GH-933] Patch by @Zorbash
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13 02:40:38 +00:00
usa cc09968d71 * lib/tempfile.rb (Remover#call): fixed wrong condition introduced at
r50682.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30 09:05:50 +00:00
usa c1f355d91f * lib/tempfile.rb (Tempfile#initialize): initialize @unlinked to fix
test failures introduced at r50682.  I hope that check the results of
  tests before committing, at least the tests about the changed feature.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30 07:01:29 +00:00
glass 354c9747e4 * lib/tempfile.rb: refactoring.
* use warn instead of STDERR.print
  * remove @tmpname and use @tmpfile.path
  * introduce @unlinked flag
  * Remover takes only @tmpfile
  * mode will be modified just before file reopen

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30 01:29:48 +00:00
hsbt 05c108cdba * lib/tempfile.rb: provide default basename parameter.
[fix GH-523] Patch by @dissolved
* test/test_tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-04 00:18:38 +00:00
nobu a718be06fa tempfile.rb: fix r47655
* lib/tempfile.rb (Tempfile#initialize, Tempfile.create): get rid of
  shadowing local variables.

* lib/tmpdir.rb (Dir::Tmpname#make_tmpname): simlify argument
  splitting.

* test/test_tempfile.rb: need thread library for ConditionVariable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 01:40:21 +00:00
glass 09e91be9ab * lib/tempfile.rb: define parameters appropriately and some
refactoring.

* lib/tmpdir.rb:   ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-20 17:35:06 +00:00
glass c4ad649e07 * lib/tempfile.rb: remove "require 'thread'". its features are no
longer used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-27 14:36:25 +00:00
nobu 84ae5332e5 lib/tempfile.rb: include doc of Tempfile.open
* lib/tempfile.rb: start rdoc parsing inside singleton class
  definition to include the document there.
  [ruby-core:64157] [Bug #10105]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-11 02:26:36 +00:00
hsbt a7f672a17e * lib/tempfile.rb: split executable code into sample directory.
* sample/tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-23 19:44:23 +00:00
akr 592c6ba3b3 * lib/tempfile.rb (Tempfile#inspect): Show "(closed)" if the tempfile
is closed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 16:03:35 +00:00
nobu 2958ecae67 tempfile.rb: get rid of warnings
* lib/tempfile.rb (Tempfile#initialize): use class method to get rid
  of warnings when $VERBOSE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 09:28:43 +00:00
nobu ec2db8decf tempfile.rb: undefine finalizer on unlink
* lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
  after unlinking.  patched by by normalperson (Eric Wong) at
  [ruby-core:56521] [Bug #8768]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-01 13:03:58 +00:00
zzak caca17a898 * lib/tempfile.rb: nodoc Tempfile#inspect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 23:03:25 +00:00
akr 65261bda4d * lib/tempfile.rb (Tempfile.create): Close when the block exits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20 15:16:24 +00:00
akr 5388fb64d9 * lib/tempfile.rb (Tempfile.create): New method.
The method name is proposed by Shugo Maeda.  [ruby-dev:47220]
  [ruby-core:41478] [Feature #5707]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20 13:50:47 +00:00
glass 31f72cf518 * lib/tempfile.rb: fix confusing inspect.
previous Tempfile#inspect says it is a File, but actually
  it is not a File.

    t = Tempfile.new("foo") #=> #<File:/tmp/foo20121106-31970-1ffbum0>
    t.is_a? File #=> false

  now Tempfile#inspect returns like:

    t = Tempfile.new("foo")
    #=> #<Tempfile:/tmp/foo20121106-31970-1ffbum0>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 08:06:21 +00:00
knu 1f1196fae3 * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): Just
call File.unlink and ignore ENOENT because existence check
  before unlinking does not help in terms of race condition.

* lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): My
  comment about thread safeness is obsolete.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-01 16:12:44 +00:00
nagachika c572ed2d25 * lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
when an exception is raised at @tempfile.close. [ruby-dev:45113]

* lib/tempfile.rb (Tempfile#unlink): fix a typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-09 15:46:25 +00:00
akr c5485f41ea * lib/tempfile.rb (Tempfile#initialize): warn if a block is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-23 15:56:33 +00:00
akr b8f3ef6136 * lib/tempfile.rb: don't use lock directory. [ruby-dev:39197]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04 13:53:59 +00:00
akr 250d10b21f fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04 13:50:58 +00:00
akr 7b18746587 * lib/tempfile.rb (Tempfile::MAX_TRY): remove unused constant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04 13:35:50 +00:00
drbrain ca96541149 * ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patch
by Luke Gruber.  [#5203]
* ext/pty/lib/expect.rb:  ditto
* lib/mathn.rb:  ditto
* lib/net/http.rb:  ditto
* lib/open-uri.rb:  ditto
* lib/ostruct.rb:  ditto
* lib/tempfile.rb:  ditto
* lib/thread.rb:  ditto
* lib/weakref.rb:  ditto
* sample/webrick/httpproxy.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-26 22:22:37 +00:00
nobu c5c245554d * lib/tempfile.rb (Tempfile.{mkdir,rmdir}): revert for backward
compatibility.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-24 22:58:18 +00:00
nobu 9a7e295255 * lib/tempfile.rb (Tempfile.{lock,unlock}_tempfile): refactor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-24 22:12:20 +00:00
nobu 54bbfe811e * lib/tempfile.rb (Tempfile.{mkdir,rmdir}): internal methods to be overridden in subclasses.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-24 21:22:00 +00:00
nobu d371e3583e * lib: revert r31635-r31638 and untabify with expand(1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 00:07:25 +00:00
drbrain 7bbf2f3085 * lib: Convert tabs to spaces for ruby files per
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
	  Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
	  Patch by Jason Dew [Ruby 1.9 - Feature #4718]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 21:19:18 +00:00
drbrain ebce1b4bd6 * lib/tempfile.rb: Document Dir.mkdir and Dir.rmdir. Patch by Clinton
Nixon.  [Ruby 1.9 - Bug #4728]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 21:02:36 +00:00
matz 1df42597d1 cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:44:45 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
shyouhei b38b837066 * lib/tempfile.rb: Fix example file paths in docs for tempfile.
https://github.com/ruby/ruby/pull/5


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-28 04:16:16 +00:00
nobu 7e53b3b6ba * lib/tempfile.rb: not executable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29 03:48:21 +00:00
mame d980b8f61a * lib/tempfile.rb (Tempfile#unlink): leave @data. Assigning nil to
@data caused double closing error of the same IO in finalizer.  a
  patch from Simon Nicholls.  [ruby-core:29395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30 12:51:32 +00:00
nobu 5e02a28a8b * lib/tempfile.rb (Tempfile#size): stat by path name when it is
closed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-01 13:54:01 +00:00
nobu d0cb5c71ce * lib/tempfile.rb (Tempfile#open): re-open with same mode and
options as initialize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29 06:11:48 +00:00
akr d6fb854ecb * lib/tempfile.rb (Tempfile::Remover): new class to replace
Tempfile.callback.  port r24902 from Ruby 1.8.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-13 03:20:52 +00:00
nobu 55179696b2 * lib/tempfile.rb (Tempfile#initialize): option hash may not be
given.  [ruby-core:26681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-11 21:42:40 +00:00