summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
AgeCommit message (Collapse)Author
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
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-10-17tempfile.rb: [DOC] all arguments [ci skip]nobu
* 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-16Layout fixes in rdoc of lib/tempfile.rb [ci skip]nobu
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-05-19tempfile.rb: do not call File.identical? on closed streamnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19tempfile.rb: remove in Tempfile.createnobu
* 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-03-14Fix bug of Tempfile#size if nothing is written [Bug #13198]glass
* 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-01-21lib/tempfile.rb: Specify frozen_string_literal: true.kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21lib/*: remove closed checksnormal
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-09-26* lib/tempfile.rb: provide default basename parametersonots
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-01-27Fix doc with default value with GH-523nobu
* 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
2015-12-16Add frozen_string_literal: false for all filesnaruse
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-06-13* lib/tempfile.rb: Fix typo. [fix GH-933] Patch by @Zorbashhsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30* lib/tempfile.rb (Remover#call): fixed wrong condition introduced atusa
r50682. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30* lib/tempfile.rb (Tempfile#initialize): initialize @unlinked to fixusa
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* lib/tempfile.rb: refactoring.glass
* 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-01-04* lib/tempfile.rb: provide default basename parameter.hsbt
[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
2014-09-21tempfile.rb: fix r47655nobu
* 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-20* lib/tempfile.rb: define parameters appropriately and someglass
refactoring. * lib/tmpdir.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-27* lib/tempfile.rb: remove "require 'thread'". its features are noglass
longer used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-11lib/tempfile.rb: include doc of Tempfile.opennobu
* 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-07-23* lib/tempfile.rb: split executable code into sample directory.hsbt
* sample/tempfile.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27* lib/tempfile.rb (Tempfile#inspect): Show "(closed)" if the tempfileakr
is closed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21tempfile.rb: get rid of warningsnobu
* 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-10-01tempfile.rb: undefine finalizer on unlinknobu
* 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-05-19* lib/tempfile.rb: nodoc Tempfile#inspectzzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20* lib/tempfile.rb (Tempfile.create): Close when the block exits.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20* lib/tempfile.rb (Tempfile.create): New method.akr
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
2012-11-06* lib/tempfile.rb: fix confusing inspect.glass
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-02-01* lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): Justknu
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-01-09* lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] evennagachika
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
2011-12-23* lib/tempfile.rb (Tempfile#initialize): warn if a block is given.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04* lib/tempfile.rb: don't use lock directory. [ruby-dev:39197]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04fix a typo.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04* lib/tempfile.rb (Tempfile::MAX_TRY): remove unused constant.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-26* ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patchdrbrain
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-05-24* lib/tempfile.rb (Tempfile.{mkdir,rmdir}): revert for backwardnobu
compatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-24* lib/tempfile.rb (Tempfile.{lock,unlock}_tempfile): refactor.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-24* lib/tempfile.rb (Tempfile.{mkdir,rmdir}): internal methods to be ↵nobu
overridden in subclasses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19* lib: revert r31635-r31638 and untabify with expand(1).nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 * lib: Convert tabs to spaces for ruby files perdrbrain
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 * lib/tempfile.rb: Document Dir.mkdir and Dir.rmdir. Patch by Clintondrbrain
Nixon. [Ruby 1.9 - Bug #4728] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07cancel subversion backfire. sorrymatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* gc.c (rb_gc_set_params): allow GC parameter configuration bymatz
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-02-28* lib/tempfile.rb: Fix example file paths in docs for tempfile.shyouhei
https://github.com/ruby/ruby/pull/5 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29* lib/tempfile.rb: not executable.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-30* lib/tempfile.rb (Tempfile#unlink): leave @data. Assigning nil tomame
@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-01* lib/tempfile.rb (Tempfile#size): stat by path name when it isnobu
closed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29* lib/tempfile.rb (Tempfile#open): re-open with same mode andnobu
options as initialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-13* lib/tempfile.rb (Tempfile::Remover): new class to replaceakr
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
2009-11-11* lib/tempfile.rb (Tempfile#initialize): option hash may not benobu
given. [ruby-core:26681] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e