SafeFile

Strict file access library for Ruby

Installing

[!WARNING] When installing this Gem, capitalization matters, for some reason..

You can either use Gem

gem install SafeFile

or put it in your Gemfile

gem "SafeFile"

Usage

It's really easy to use this. You can use it the same way you'd use the File Class. It currently only supports these actions: SafeFile.read, SafeFile.open, SafeFile.write, SafeFile.foreach.

Adding safe directories

By default, the parent working directory is marked as safe. You may change this with the line below

SafeFile.safe.allowPWD = false

If you'd like to add other safe directories you may use the SafeFile.safe.append method

SafeFile.safe.append "/tmp/projectCache"

or remove a safe directory with

SafeFile.safe.remove "/tmp/projectCache"

If you need an example of everything, you may take a look at the test document located in the tests directory.