public MainPage() { this.InitializeComponent(); var setup = new ScriptRuntimeSetup(); setup.HostType = typeof(DlrHost); setup.AddRubySetup(); var runtime = Ruby.CreateRuntime(setup); this.engine = Ruby.GetEngine(runtime); this.scope = engine.CreateScope(); this.scope.SetVariable("Main", this); runtime.LoadAssembly(typeof(object).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextSetOptions).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextAlignment).GetTypeInfo().Assembly); string outputText = @" box = main.find_name('OutputBox') p box.text_alignment box.text_alignment = Windows::UI::Xaml::TextAlignment.Right p box.text_alignment "; InputBox.IsSpellCheckEnabled = false; OutputBox.IsSpellCheckEnabled = false; InputBox.Document.SetText(TextSetOptions.None, outputText); }
public TestRuntime(Driver /*!*/ driver, TestCase /*!*/ testCase) { _driver = driver; _testName = testCase.Name; if (_driver.IsDebug) { Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName); } var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); LanguageSetup langaugeSetup = null; foreach (var language in runtimeSetup.LanguageSetups) { if (language.TypeName == typeof(RubyContext).AssemblyQualifiedName) { langaugeSetup = language; break; } } // TODO: dynamic modules with symbols are not available in partial trust runtimeSetup.DebugMode = !driver.PartialTrust; langaugeSetup.Options["InterpretedMode"] = _driver.Interpret; langaugeSetup.Options["Verbosity"] = 2; langaugeSetup.Options["Compatibility"] = testCase.Compatibility; _env = Ruby.CreateRuntime(runtimeSetup); _engine = Ruby.GetEngine(_env); _context = Ruby.GetExecutionContext(_engine); }
public ScriptHandler() { _runtime = Ruby.CreateRuntime(); _runtime.LoadAssembly(GetType().Assembly); _engine = Ruby.GetEngine(_runtime); _scope = _engine.CreateScope(); }
public TestRuntime(Driver /*!*/ driver, TestCase /*!*/ testCase) { _driver = driver; _testName = testCase.Name; if (testCase.Options.NoRuntime) { return; } if (_driver.SaveToAssemblies) { Environment.SetEnvironmentVariable("DLR_AssembliesFileName", _testName); } var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = runtimeSetup.AddRubySetup(); runtimeSetup.DebugMode = _driver.IsDebug; runtimeSetup.PrivateBinding = testCase.Options.PrivateBinding; runtimeSetup.HostType = typeof(TestHost); runtimeSetup.HostArguments = new object[] { testCase.Options }; languageSetup.Options["NoAdaptiveCompilation"] = _driver.NoAdaptiveCompilation; languageSetup.Options["CompilationThreshold"] = _driver.CompilationThreshold; languageSetup.Options["Verbosity"] = 2; _runtime = Ruby.CreateRuntime(runtimeSetup); _engine = Ruby.GetEngine(_runtime); _context = (RubyContext)HostingHelpers.GetLanguageContext(_engine); }
private void Initialize() { Engine = Ruby.GetEngine(Runtime); Context = Ruby.GetExecutionContext(Engine); CurrentScope = Engine.CreateScope(); Operations = Engine.CreateOperations(); LoadAssemblies(typeof(object), typeof(Uri), typeof(Func <object>), typeof(StandardKernel), typeof(IRubyEngine)); RequireRubyFile("Ninject.Dynamic.initializer.rb", ReaderType.Assembly); }
public RubyEngine() { var setup = CreateRuntimeSetup(); setup.Options["InterpretedMode"] = true; var runtime = new ScriptRuntime(setup); _engine = Ruby.GetEngine(runtime); }
private void Initialize() { Engine = Ruby.GetEngine(Runtime); Context = Ruby.GetExecutionContext(Engine); CurrentScope = Engine.CreateScope(); Operations = Engine.CreateOperations(); LoadAssemblies(typeof(object), typeof(Uri), typeof(HttpResponseBase), typeof(MembershipCreateStatus), typeof(RouteTable), typeof(Controller), typeof(RubyController)); AddLoadPaths(); DefineReadOnlyGlobalVariable(Constants.ScriptRuntimeVariable, Engine); RequireControllerFile(); }
public static void Initialize() { self_path = System.IO.Directory.GetCurrentDirectory(); ScriptRuntime _runTime = Ruby.CreateRuntime(); _engine = Ruby.GetEngine(_runTime); _scope = _engine.CreateScope(); _engine.Execute(@"load_assembly 'IronRuby.Libraries'; load_assembly 'DataStructure'", _scope); _engine.ExecuteFile(@"rb\mapx.rb"); _scope.SetVariable("a", ""); _engine.Execute(@"$path = a", _scope); }
public ScriptEngine CreateRubyEngine() { var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = runtimeSetup.AddRubySetup(); runtimeSetup.PrivateBinding = true; runtimeSetup.HostType = typeof(TmpHost); runtimeSetup.HostArguments = new object[] { new OptionsAttribute() }; languageSetup.Options["Verbosity"] = 2; var runtime = Ruby.CreateRuntime(runtimeSetup); return Ruby.GetEngine(runtime); }
public Action Cleanup; // A function delegate that will be called when the script is completed to allow any cleanup actions to take place. public DialPlanExecutingScript(SIPMonitorLogDelegate logDelegate) { ScriptNumber = ++ScriptCounter % Int32.MaxValue; Id = Guid.NewGuid(); var setup = ScriptRuntimeSetup.ReadConfiguration(); var scriptRuntime = Ruby.CreateRuntime(setup); DialPlanScriptEngine = Ruby.GetEngine(scriptRuntime); //DialPlanScriptEngine = Ruby.CreateEngine(); DialPlanScriptScope = DialPlanScriptEngine.CreateScope(); LogDelegate = logDelegate; }
public MainPage() { this.InitializeComponent(); var setup = new ScriptRuntimeSetup(); setup.HostType = typeof(DlrHost); setup.AddRubySetup(); var runtime = Ruby.CreateRuntime(setup); this.engine = Ruby.GetEngine(runtime); this.scope = engine.CreateScope(); this.scope.SetVariable("Main", this); runtime.LoadAssembly(typeof(object).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextSetOptions).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextAlignment).GetTypeInfo().Assembly); string outputText = @" box = main.find_name('OutputBox') p box.text_alignment box.text_alignment = Windows::UI::Xaml::TextAlignment.Right p box.text_alignment "; InputBox.IsSpellCheckEnabled = false; OutputBox.IsSpellCheckEnabled = false; InputBox.Document.SetText(TextSetOptions.None, outputText); // http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx IInspectable insp = (IInspectable)InputBox.Document; string winTypeName; insp.GetRuntimeClassName(out winTypeName); Guid[] iids; int iidCount; insp.GetIids(out iidCount, out iids); // winTypeName = "Windows.Foundation.Collections.IIterator`1<Windows.Foundation.Collections.IMapView`2<Windows.Foundation.Collections.IVector`1<String>, String>>"; var parts = ParseWindowsTypeName(winTypeName); Type type = MakeWindowsType(parts); var guid = type.GetTypeInfo().GUID; }
public ScriptEngine CreateRubyEngine(bool privateBinding = false, OptionsAttribute options = null) { var runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = runtimeSetup.AddRubySetup(); runtimeSetup.DebugMode = IsDebug; runtimeSetup.PrivateBinding = privateBinding; runtimeSetup.HostType = typeof(TestHost); runtimeSetup.HostArguments = new object[] { options ?? new OptionsAttribute() }; languageSetup.Options["ApplicationBase"] = BaseDirectory; languageSetup.Options["NoAdaptiveCompilation"] = NoAdaptiveCompilation; languageSetup.Options["CompilationThreshold"] = CompilationThreshold; languageSetup.Options["Verbosity"] = 2; var runtime = Ruby.CreateRuntime(runtimeSetup); return(Ruby.GetEngine(runtime)); }
static RubyHasher() { runtime = Ruby.CreateRuntime(); engine = Ruby.GetEngine(runtime); }