Bootstrap

rifraf edited this page Sep 14, 2010 · 2 revisions

The bootstrap script is created and run by EmbeddedRuby.cs to create the hooks to support embedded resource in Ruby. It uses an instance of Serfs (see other rifraf repo) to provide the file access.

The first file that runs is EmbeddedRuby/RequireSupport.rb which extends the class SERFS::Serfs and extends require so that if a file is not found on disk, it can be loaded from an embedded resource.

Once that has run, we can require the remaining elements:

  • EmbeddedRuby/LoadSupport : Adds support for load in a similar way to require
  • EmbeddedRuby/AutoloadSupport : Supports autoload of files (used heavily by Sinatra)
  • EmbeddedRuby/IOSupport : Extends (partially) the IO class so that it can read from embedded resources when a file is not found on disk.
  • EmbeddedRuby/FileSupport : Extends (partially) the File class so that it can read from embedded resources when a file is not found on disk.
  • EmbeddedRuby/AppBoot : An application can supply an app-specific boot EmbeddedRuby/AppBoot.rb to perform any startup code needed before the main application starts. Used, for example, by the Sinatra sample to mimic a patch to the Stream class.
  • EmbeddedRuby/Misc : Odd patches…

TODO There will later be the choice to not look on disk first and restrict file lookup to within the assemblies.

NOTE The support for the basic IO and File operations has been patched in quickly to sync up with the IronRuby 1.0 release, so will need some cleanup and extending over time.

This is work in progress, so requests for functionality will be sympathetically received.