nzbdrone now requires grunt to work.

This commit is contained in:
Keivan Beigi
2013-03-28 18:49:14 -07:00
parent 3b22c087c6
commit 1c04a670d9
21 changed files with 123 additions and 179 deletions
@@ -1,43 +0,0 @@
using System;
using System.IO;
using System.Linq;
using Nancy;
using Nancy.Responses;
namespace NzbDrone.Api.FrontendModule
{
public class BootstrapModule : NancyModule
{
private readonly ICompileLess _lessCompiler;
public BootstrapModule(ICompileLess lessCompiler)
{
_lessCompiler = lessCompiler;
Get[@"static/content/bootstrap/bootstrap.less"] = x => OnGet();
}
private Response OnGet()
{
/* var urlParts = Request.Path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
if (urlParts.Length < 2)
{
return new NotFoundResponse();
}
urlParts[0] = "NzbDrone.Backbone";
var filePath = Path.Combine(urlParts);
if (!File.Exists(filePath))
{
return new NotFoundResponse();
}*/
var css = _lessCompiler.Compile(Path.Combine("NzbDrone.Backbone","Content","Bootstrap","bootstrap.less"));
return new TextResponse(HttpStatusCode.OK, css) { ContentType = "text/css" };
}
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ namespace NzbDrone.Api.FrontendModule
}
return View["NzbDrone.Backbone/index.html"];
return View["UI/index.html"];
}
}
}
@@ -1,56 +0,0 @@
using System.IO;
using System.Linq;
using dotless.Core;
using dotless.Core.Importers;
using dotless.Core.Input;
using dotless.Core.Parser;
namespace NzbDrone.Api.FrontendModule
{
public interface ICompileLess
{
string Compile(string filePath);
}
public class LessCompiler : ICompileLess
{
public string Compile(string filePath)
{
var parser = new Parser()
{
Importer = new Importer(new LessFileReader(filePath))
};
var lessEngine = new LessEngine(parser, null, false, true);
var lessContent = File.ReadAllText(filePath);
return lessEngine.TransformToCss(lessContent, filePath);
}
class LessFileReader : IFileReader
{
private readonly string _rootFolders;
public LessFileReader(string masterFile)
{
_rootFolders = new FileInfo(masterFile).Directory.FullName;
}
public byte[] GetBinaryFileContents(string fileName)
{
return File.ReadAllBytes(Path.Combine(_rootFolders, fileName));
}
public string GetFileContents(string fileName)
{
return File.ReadAllText(Path.Combine(_rootFolders, fileName));
}
public bool DoesFileExist(string fileName)
{
return File.Exists(Path.Combine(_rootFolders, fileName));
}
}
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ namespace NzbDrone.Api
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", @"NzbDrone.Backbone", new string[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" }));
Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", @"UI", new[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" }));
}
}
-5
View File
@@ -61,9 +61,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="dotless.ClientOnly">
<HintPath>..\packages\DotlessClientOnly.1.3.1.0\lib\dotless.ClientOnly.dll</HintPath>
</Reference>
<Reference Include="FluentValidation">
<HintPath>..\packages\FluentValidation.3.4.6.0\lib\Net40\FluentValidation.dll</HintPath>
</Reference>
@@ -106,8 +103,6 @@
<Compile Include="Extensions\NancyJsonSerializer.cs" />
<Compile Include="Extensions\Serializer.cs" />
<Compile Include="FrontendModule\IndexModule.cs" />
<Compile Include="FrontendModule\BootstrapModule.cs" />
<Compile Include="FrontendModule\LessService.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" />
<Compile Include="Resolvers\EndTimeResolver.cs" />
-1
View File
@@ -2,7 +2,6 @@
<packages>
<package id="Autofac" version="3.0.1" targetFramework="net40" />
<package id="AutoMapper" version="2.2.1" targetFramework="net40" />
<package id="DotlessClientOnly" version="1.3.1.0" targetFramework="net40" />
<package id="FluentValidation" version="3.4.6.0" targetFramework="net40" />
<package id="Nancy" version="0.16.1" targetFramework="net40" />
<package id="Nancy.Bootstrappers.Autofac" version="0.16.1" targetFramework="net40" />