Temppath

Temppath is a Ruby library for generating temporary file path. The differences from standard tempfile.rb are that this library generates Pathname objects with no files and filenames are based on UUID. Files in paths generated by this are deleted when Ruby exits.

Gem Version Build Status Coverage Status Code Climate

Installation

$ gem install temppath

Usage

Create a path

path = Temppath.create
#=> #<Pathname:/tmp/ruby-temppath-20130407-5775-w5k77l/f41bd6c5-fc99-4b7a-8f68-95b7ae4a6b22>
path.exist? #=> false
path.open("w")
"%o" % path.stat.mode #=> "100600" (default permission 0600)

Create a directory

path = Temppath.mkdir
path.directory? #=> true
"%o" % path.stat.mode #=> "40700"

Create an empty file

path = Temppath.touch
path.file? #=> true
"%o" % path.stat.mode #=> "100600"

Documentation

License

Temppath is free software distributed under MIT license.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request