Index: ironruby/Hosting/RubyEngineOptions.cs =================================================================== --- ironruby/Hosting/RubyEngineOptions.cs (revision 76) +++ ironruby/Hosting/RubyEngineOptions.cs (working copy) @@ -30,7 +30,13 @@ private string[] _arguments; private bool _showWarnings; + private List _modules; + public List RequiredModules { + get { return _modules; } + set { _modules = value; } + } + public string[] Arguments { get { return _arguments; } set { _arguments = value; } Index: ironruby/Hosting/RubyOptionsParser.cs =================================================================== --- ironruby/Hosting/RubyOptionsParser.cs (revision 76) +++ ironruby/Hosting/RubyOptionsParser.cs (working copy) @@ -86,6 +86,18 @@ break; default: + if (arg.StartsWith("-r")) + { + if (_engineOptions.RequiredModules == null) + _engineOptions.RequiredModules = new List(); + + string module = arg.Substring(2).Trim(); + + if (!_engineOptions.RequiredModules.Contains(module)) + _engineOptions.RequiredModules.Add(module); + break; + } + base.ParseArgument(arg); if (ConsoleOptions.FileName != null) { PushArgBack(); @@ -101,6 +113,7 @@ string [,] rubyOptions = new string[,] { { "-opt", "dummy" }, + { "-rmodule", "require module" }, }; // Append the Ruby-specific options and the standard options Index: ironruby/Runtime/RubyContext.cs =================================================================== --- ironruby/Runtime/RubyContext.cs (revision 76) +++ ironruby/Runtime/RubyContext.cs (working copy) @@ -90,6 +90,14 @@ public override CodeBlock ParseSourceCode(CompilerContext/*!*/ context) { Contract.RequiresNotNull(context, "context"); + if (EngineOptions.RequiredModules != null) + { + foreach (string module in EngineOptions.RequiredModules) + // TODO: does self need to be passed to LoadModule? + ExecutionContext.Loader.LoadModule(CodeContext, null , module, LoadFlags.LoadOnce); + EngineOptions.RequiredModules = null; + } + SourceUnitTree ast = new Parser().Parse(context); return (ast != null) ? ast.Transform(new AstGenerator(context), context.SourceUnit.Kind) : null; }