MagicLoader 0.10.0: painless code dependency management

Think Bundler for your require statements:


MagicLoader uses a special algorithm to calculate the order in which
files in your project must be required in order for your project to load
successfully. If you’ve been manually maintaining a dependencies list,
MagicLoader provides for your code the same automation that Bundler
for your gem dependencies.

You can let MagicLoader loose on a big directory of code and it will
out the require statement ordering and automatically write it out to a
of your choosing. Once it’s worked its magic, MagicLoader writes the
dependency list out to the given file in the form of a list of
ordered require statements. You can even use MagicLoader once then never
it again, because the output is little different from what you might’ve
thrown together manually.

MagicLoader represents the evolution of the require_all gem (, except rather than calculating the
dependency order at load time, MagicLoader lets you calculate it ahead
time in a sandboxed, thread-free environment, then write it out to a
file ensuring that your dependencies are precalculated and not subject
environmental challenges like threads or previously defined constants.


MagicLoader presently doesn’t load your code under pristine conditions.
runs as a Rake task and thus brings with it everything which is already
loaded in your Rake environment. You may very well be pulling in the
MagicLoad target in your Rake environment ahead of time, which can break
sorts of things.

To really be effective, MagicLoader needs a completely clean
The easiest way to implement this is to have a separate “magicload”
distributed with the gem that spawns a new, fresh Ruby interpreter and
all your code there.

In order for this to work effectively, MagicLoader needs some way of
all of the gem dependencies that need to get loaded before it attempts
load the given set of code. This requires at least one of two things (or
preferably, support for both):

  • A way to specify a list of gem dependencies to be loaded when is invoked.
  • An interface to Bundler to pull in your project’s bundled Gem
    which you can pass to

This remains the one unsolved problem preventing a MagicLoader 1.0.0
release. Pull requests for this sort of functionality are welcomed!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs