public void CoffeeScriptSmokeTest()
        {
            var input = @"v = x*5 for x in [1...10]";
            using (var fixture = new CoffeeScriptCompiler(new InstanceProvider<IJavaScriptRuntime>(
                () => new IEJavaScriptRuntime()))) {

                var result = fixture.Compile(input);
                Assert.False(String.IsNullOrWhiteSpace(result));
            }
        }
Beispiel #2
0
 public CompileResults Compile(string inPath, string outPath)
 {
     CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(new SassAndCoffee.Core.InstanceProvider<IJavaScriptRuntime>(() => new IEJavaScriptRuntime()));
     using (StreamReader sr = new StreamReader(inPath))
     {
         string content = sr.ReadToEnd();
         string output = compiler.Compile(content);
         using (StreamWriter sw = new StreamWriter(outPath))
         {
             sw.WriteLine(OrangeBits.GetHeader(inPath));
             sw.Write(output);
         }
     }
     return null;
 }
        public void CoffeeScriptFailTest()
        {
            var input = "test.invlid.stuff/^/g!%%";
            using (var fixture = new CoffeeScriptCompiler(new InstanceProvider<IJavaScriptRuntime>(
                () => new IEJavaScriptRuntime()))) {

                bool shouldDie = false;

                try {
                    var result = fixture.Compile(input);
                    if (result.StartsWith("ENGINE FAULT"))
                        shouldDie = true;
                    else Console.WriteLine(result);
                } catch (Exception ex) {
                    Console.WriteLine("Ex: " + ex.Message);
                    shouldDie = true;
                }

                Assert.True(shouldDie);
            }
        }
        public void Process(BundleContext context, BundleResponse response)
        {
            var coffee = new CoffeeScriptCompiler(new InstanceProvider<IJavaScriptRuntime>(() => new IEJavaScriptRuntime()));

            response.ContentType = "text/javascript";
            response.Content = string.Empty;

            foreach (var fileInfo in response.Files)
            {
                if (fileInfo.Extension.Equals(".coffee", StringComparison.Ordinal))
                {
                    var result = coffee.Compile(File.ReadAllText(fileInfo.FullName));

                    response.Content += result;
                }
                else if (fileInfo.Extension.Equals(".js", StringComparison.Ordinal))
                {
                    response.Content += File.ReadAllText(fileInfo.FullName);
                }
            }
        }
 public SassCoffeeCompiler(CoffeeScriptCompiler coffeeScriptCompiler)
 {
     _coffeeScriptCompiler = coffeeScriptCompiler;
 }
 public string GetOutput(string input)
 {
     var compiler = new CoffeeScriptCompiler(new InstanceProvider<IJavaScriptRuntime>(() => new IEJavaScriptRuntime()));
     return compiler.Compile(input);
 }