示例#1
0
 static int Main(string[] args)
 {
     int exitcode = 0;
     try {
         EmbeddedRuby er = new EmbeddedRuby();
         er.Decoder = new GZipDecoder();
         er.Mount("App");
         exitcode = er.Run("PROJECTNAME.rb", args);
     } catch (Exception e) {
         Console.WriteLine(e.Message);
     }
     Console.WriteLine();
     return exitcode;
 }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                var er = new EmbeddedRuby();
                var resources = er.AddAssembly("IREmbeddedLibraries");
                resources.Mount("Files/ironruby");
                resources.Mount("Files/rspec-1.3.0/lib");
                resources.Mount("Files/site_ruby/1.8");
                resources.Mount("Files/1.8");

                er.Mount("Applications");
                er.Run("user_spec.rb", args);
            }
            catch (Exception)
            {
              // not sure why when rspec exits throws an exception
            }

            Console.WriteLine("Press Enter to Exit");
            Console.ReadLine();
        }
示例#3
0
        static int Main(string[] args)
        {
            int exitcode = 0;

            // bottles
            Console.WriteLine("bottles.rb");
            Console.WriteLine("----------");
            try {
                EmbeddedRuby er1 = new EmbeddedRuby();
                er1.Mount("Applications");
                exitcode = er1.Run("bottles.rb");
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            // list_args.rb
            Console.WriteLine("list_args.rb");
            Console.WriteLine("------------");
            try {
                EmbeddedRuby er1 = new EmbeddedRuby();
                er1.Mount("Applications");
                exitcode = er1.Run("list_args.rb", args);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            // file access
            Console.WriteLine("file_accesses.rb");
            Console.WriteLine("----------------");
            try {
                EmbeddedRuby er1 = new EmbeddedRuby();
                er1.Mount("Applications");
                exitcode = er1.Run("file_accesses.rb");
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            // rexml
            Console.WriteLine("test_rexml.rb");
            Console.WriteLine("-------------");
            try {
                EmbeddedRuby er1 = new EmbeddedRuby();
                er1.Mount("Applications");
                er1.AddAssembly("IREmbeddedLibraries").Mount("Files/site_ruby/1.8").Mount("Files/1.8");
                exitcode = er1.Run("test_rexml.rb");
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            // Demo of test::unit
            Console.WriteLine("test_unit_app.rb");
            Console.WriteLine("----------------");
            try {
                EmbeddedRuby er2 = new EmbeddedRuby();
                er2.AddAssembly("IRTestResources", "Files/Core").Mount("Files/TestUnit");
                er2.Mount("Applications");
                exitcode = er2.Run("test_unit_app.rb");
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            // Demo of test::unit and flexmock
            Console.WriteLine("test_mocking_app.rb");
            Console.WriteLine("-------------------");
            try {
                EmbeddedRuby er3 = new EmbeddedRuby();
                er3.AddAssembly("IRTestResources", "Files/Core").Mount("Files/FlexMock").Mount("Files/TestUnit");
                er3.Mount("Applications");
                exitcode = er3.Run("test_mocking_app.rb");
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine();

            return exitcode;
        }