[#44036] [ruby-trunk - Feature #6242][Open] Ruby should support lists — "shugo (Shugo Maeda)" <redmine@...>

20 messages 2012/04/01

[#44084] [ruby-trunk - Bug #6246][Open] 1.9.3-p125 intermittent segfault — "jshow (Jodi Showers)" <jodi@...>

22 messages 2012/04/02

[#44156] [ruby-trunk - Feature #6265][Open] Remove 'useless' 'concatenation' syntax — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

45 messages 2012/04/06

[#44163] [ruby-trunk - Bug #6266][Open] encoding related exception with recent integrated psych — "jonforums (Jon Forums)" <redmine@...>

10 messages 2012/04/06

[#44303] [ruby-trunk - Feature #6284][Open] Add composition for procs — "pabloh (Pablo Herrero)" <pablodherrero@...>

57 messages 2012/04/12

[#44349] [ruby-trunk - Feature #6293][Open] new queue / blocking queues — "tenderlovemaking (Aaron Patterson)" <aaron@...>

10 messages 2012/04/13

[#44402] [ruby-trunk - Feature #6308][Open] Eliminate delegation from WeakRef — "headius (Charles Nutter)" <headius@...>

20 messages 2012/04/17

[#44403] [ruby-trunk - Feature #6309][Open] Add a reference queue for weak references — "headius (Charles Nutter)" <headius@...>

15 messages 2012/04/17

[#44533] [ruby-trunk - Bug #6341][Open] SIGSEGV: Thread.new { fork { GC.start } }.join — "rudolf (r stu3)" <redmine@...>

24 messages 2012/04/22

[#44630] [ruby-trunk - Feature #6361][Open] Bitwise string operations — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>

31 messages 2012/04/26

[#44648] [ruby-trunk - Feature #6367][Open] #same? for Enumerable — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

16 messages 2012/04/26

[#44704] [ruby-trunk - Feature #6373][Open] public #self — "trans (Thomas Sawyer)" <transfire@...>

61 messages 2012/04/27

[#44748] [ruby-trunk - Feature #6376][Open] Feature lookup and checking if feature is loaded — "trans (Thomas Sawyer)" <transfire@...>

13 messages 2012/04/28

[ruby-core:44177] Re: [Backport #1975] Backport Dir.mktmpdir

From: Joe Swatosh <joe.swatosh@...>
Date: 2012-04-07 05:14:38 UTC
List: ruby-core #44177
On Friday, August 21, 2009 7:17:28 PM UTC-7, Tanaka Akira wrote:
>
> In article <4a8e914c6160_2100affe60043c6@redmine.ruby-lang.org>,
>   Kirk Haines <redmine@ruby-lang.org> writes:
>
> > Dir.mktmpdir exists in 1.8 HEAD and 1.8.7, and is used in the test suite 
> for Backport #1168, so it needs to be backported to 1.8.6 to facilitate use 
> of the existing test suite.
>
> It is possible to copy Dir.mktmpdir to the test suite.
>
> When I needed Dir.mktmpdir for bootstraptest/runner.rb in
> 1.9 which may be run by 1.8.6, I copied it.
> -- 
> Tanaka Akira
>
Sorry for reviving such a long dead thread, but it is the only thing that 
I've been able to find that seems remotely related. I'm working on a 
project that is using Dir.mktmpdir. I'd like to maintain some backward 
compatibility with 1.8.6 and to that end was thinking of adding something 
simple like:

unless Dir.respond_to?(:mktmpdir)
  def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil)
    case prefix_suffix
    when nil
      prefix = "d"
      suffix = ""
    when String
      prefix = prefix_suffix
      suffix = ""
    when Array
      prefix = prefix_suffix[0]
      suffix = prefix_suffix[1]
    else
      raise ArgumentError, "unexpected prefix_suffix: 
#{prefix_suffix.inspect}"
    end
    tmpdir ||= Dir.tmpdir
    t = Time.now.strftime("%Y%m%d")
    n = nil
    begin
      path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
      path << "-#{n}" if n
      path << suffix
      Dir.mkdir(path, 0700)
    rescue Errno::EEXIST
      n ||= 0
      n += 1
      retry
    end

    if block_given?
      begin
        yield path
      ensure
        FileUtils.remove_entry_secure path
      end
    else
      path
    end
  end
end

Just a copy-paste from tmpdir.rb from the lib of a 1.8.7 installation 
wrapped in a respond_to? into one of my project's files. What I want to 
know is how to properly attribute the code in our project from the 1.8.7 
lib? There is no statement in the file, and I can find nothing in the 
installation or several searches with google.

Can't reuse this code unless I can acknowledge where it comes from, please 
let me know how to to this correctly.

Thanks,
--
Joe

In This Thread

Prev Next