Fast

DSL for file handling focused in intuitivity and semantics.

Library is pure Ruby 1.8.7, no FileUtils nor other dependencies (except Metafun for DSL delegation)

Installation

gem install fast

Cucumber features still to do, but specs are stable (2011-12-11)

Philosophy

Fast embraces the more straightforward view of files as strings of data and directories as arrays of files/directories. Some reasons:

  • It is more realistic in everyday usage

  • It makes them more object-like (and thus, more friendly to OOP)

  • Is more semantic

  • Files as IOs are still accessible through the harder-to-use native Ruby API

Fast::Dir is a subclass of Array, usable as a hash, and Fast::File if a subclass of String.

Quick notes

  • Read bytes as binary ASCII-8BIT always and then try to perform an heuristic conversion, if there is any reasonable way to do it. Otherwise, leave it to the user. Google: “ruby string encode utf-8 ascii” for some good readings.

  • Apply the SubSetter pattern for filtering instead of FileFilter and DirFilter ad described in xaviervia.com.ar/patterns/sub-setter

  • File lists as returned by Fast::Dir#list and Fast::Dir#dirs will be filtered after the list is retrieved by a set of filtering methods of the returned list, which should be an instance of Fast::Dir.

  • An instance of Fast::Dir should be possible to be created from a Array.

  • The path can be setted indirectly by any method of Fast::File instances, and the same works for Dir. This is fine because allows for very quick calls, but once an instance gets a path setted it should be fixed and raise an exception in case some other method call is trying to change it.

Remote future

  • Make Fast a REST client (well, use rest-client) in order to transparently use files and directories from a compliant REST server.

  • Include REST methods: Dir#post, File#get, File#head, etc

  • Allow Files to behave as Dirs with the right method calls

License

GPL License. Why else?

@ Xavier Via