nzbdrone now requires grunt to work.

pull/3113/head
Keivan Beigi 12 years ago
parent 3b22c087c6
commit 1c04a670d9

@ -14,8 +14,8 @@ module.exports = function(grunt) {
},
less:{
bootstrap:{
src: ["NzbDrone.Backbone/Content/Bootstrap/bootstrap.less"],
dest: "NzbDrone.Backbone/Content/bootstrap.css"
src: ["NzbDrone.Backbone/Content/bootstrap/bootstrap.less"],
dest: "_output/UI/Content/bootstrap.css"
}
},
@ -31,20 +31,80 @@ module.exports = function(grunt) {
},
files: {
src: ['NzbDrone.Backbone/**/*emplate.html'],
dest: 'NzbDrone.Backbone/templates.js'
dest: '_output/UI/templates.js'
},
},
copy:{
index:{
src: 'NzbDrone.Backbone/index.html',
dest: '_output/UI/index.html'
},
scripts:{
expand:true,
cwd: 'NzbDrone.Backbone/',
src: '**/*.js',
dest: '_output/UI/'
},
styles:{
expand:true,
cwd: 'NzbDrone.Backbone/',
src: '**/*.css',
dest: '_output/UI/'
},
images:{
expand:true,
cwd: 'NzbDrone.Backbone/',
src: '**/*.png',
dest: '_output/UI/'
},
templates:{
expand:true,
cwd: 'NzbDrone.Backbone/',
src: '**/*emplate.html',
dest: '_output/UI/'
},
fonts:{
expand:true,
src: 'NzbDrone.Backbone/Content/Fonts/*.*',
dest: '_output/UI/Content/Fonts/',
flatten: true
}
},
watch:{
bootstrap:{
files: '<%= less.bootstrap.src %>',
files: 'NzbDrone.Backbone/Content/bootstrap/*.less',
tasks: ['less:bootstrap']
},
handlebars:{
files: '<%= handlebars.files.src %>',
tasks: ['handlebars']
},
copyIndex:{
files: '<%= copy.index.src %>',
tasks: ['copy:index']
},
copyScripts:{
files: 'NzbDrone.Backbone/**/*.js',
tasks: ['copy:scripts']
},
copyStyles:{
files: 'NzbDrone.Backbone/**/*.js',
tasks: ['copy:styles']
},
copyImages:{
files: 'NzbDrone.Backbone/**/*.png',
tasks: ['copy:images']
},
copyTemplates:{
files: '<%= handlebars.files.src %>',
tasks: ['copy:templates']
},
copyFonts:{
files: '<%= copy.fonts.src %>',
tasks: ['copy:fonts']
}
}
});
@ -54,8 +114,9 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s).
grunt.registerTask('default', ['less:bootstrap','handlebars', 'watch']);
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']);
};

@ -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" };
}
}
}

@ -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));
}
}
}
}

@ -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" }));
}
}

@ -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" />

@ -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" />

@ -21,11 +21,13 @@
* Work: Lead Product Designer @ http://kyruus.com
*/
@FontAwesomePath: "../font";
@FontAwesomePath: "fonts";
@borderColor: #eee;
@iconMuted: #eee;
.border-radius(@radius) { -webkit-border-radius: @radius; -moz-border-radius: @radius; border-radius: @radius; }
@font-face {
font-family: 'FontAwesome';
src: url('@{FontAwesomePath}/fontawesome-webfont.eot?v=3.0.1');

@ -9,7 +9,7 @@
<link rel="apple-touch-icon" sizes="144x144" href="Static/Content/Images/apple-touch-icon-144.png" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300' rel='stylesheet' type='text/css'>
<link href="/static/content/bootstrap/bootstrap.less" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrap.slider.css" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrapSwitch.css" rel='stylesheet' type='text/css' />
<link href="/static/content/base.css" rel='stylesheet' type='text/css' />

@ -66,7 +66,7 @@
<Content Include="Content\Images\white-batch-32.png" />
<Content Include="Content\Images\white-batch-64.png" />
<Content Include="Content\toastr.css" />
<Content Include="Content\font\fontawesome-webfont.svg" />
<Content Include="Content\fonts\fontawesome-webfont.svg" />
<Content Include="Content\Images\ajax-loader.gif" />
<Content Include="Content\Images\apple-touch-icon-114.png" />
<Content Include="Content\Images\apple-touch-icon-144.png" />
@ -186,121 +186,121 @@
<Content Include="Upcoming\UpcomingModel.js" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\accordion.less" />
<Content Include="Content\bootstrap\accordion.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\alerts.less" />
<Content Include="Content\bootstrap\alerts.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\bootstrap.less" />
<Content Include="Content\bootstrap\bootstrap.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\breadcrumbs.less" />
<Content Include="Content\bootstrap\breadcrumbs.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\button-groups.less" />
<Content Include="Content\bootstrap\button-groups.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\buttons.less" />
<Content Include="Content\bootstrap\buttons.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\carousel.less" />
<Content Include="Content\bootstrap\carousel.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\close.less" />
<Content Include="Content\bootstrap\close.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\code.less" />
<Content Include="Content\bootstrap\code.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\component-animations.less" />
<Content Include="Content\bootstrap\component-animations.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\dropdowns.less" />
<Content Include="Content\bootstrap\dropdowns.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\font-awesome-ie7.less" />
<Content Include="Content\bootstrap\font-awesome-ie7.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\font-awesome.less" />
<Content Include="Content\bootstrap\font-awesome.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\forms.less" />
<Content Include="Content\bootstrap\forms.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\grid.less" />
<Content Include="Content\bootstrap\grid.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\hero-unit.less" />
<Content Include="Content\bootstrap\hero-unit.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\labels-badges.less" />
<Content Include="Content\bootstrap\labels-badges.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\layouts.less" />
<Content Include="Content\bootstrap\layouts.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\mixins.less" />
<Content Include="Content\bootstrap\mixins.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\modals.less" />
<Content Include="Content\bootstrap\modals.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\navbar.less" />
<Content Include="Content\bootstrap\navbar.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\navs.less" />
<Content Include="Content\bootstrap\navs.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\pager.less" />
<Content Include="Content\bootstrap\pager.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\pagination.less" />
<Content Include="Content\bootstrap\pagination.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\popovers.less" />
<Content Include="Content\bootstrap\popovers.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\progress-bars.less" />
<Content Include="Content\bootstrap\progress-bars.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\reset.less" />
<Content Include="Content\bootstrap\reset.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\scaffolding.less" />
<Content Include="Content\bootstrap\scaffolding.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\sprites.less" />
<Content Include="Content\bootstrap\sprites.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\tables.less" />
<Content Include="Content\bootstrap\tables.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\thumbnails.less" />
<Content Include="Content\bootstrap\thumbnails.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\tooltip.less" />
<Content Include="Content\bootstrap\tooltip.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\type.less" />
<Content Include="Content\bootstrap\type.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\utilities.less" />
<Content Include="Content\bootstrap\utilities.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\variables.less" />
<Content Include="Content\bootstrap\variables.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Bootstrap\wells.less" />
<Content Include="Content\bootstrap\wells.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\font\fontawesome-webfont.eot" />
<Content Include="Content\fonts\fontawesome-webfont.eot" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\font\fontawesome-webfont.ttf" />
<Content Include="Content\fonts\fontawesome-webfont.ttf" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\font\fontawesome-webfont.woff" />
<Content Include="Content\fonts\fontawesome-webfont.woff" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />

@ -36,7 +36,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\_output\Debug\</OutputPath>
<OutputPath>..\_output\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -48,7 +48,7 @@
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\_output\Release\</OutputPath>
<OutputPath>..\_output\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -104,6 +104,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\NzbDrone\app.config">
<Link>app.config</Link>
</None>
<None Include="..\NzbDrone\NLog.config">
<Link>NLog.config</Link>
</None>
@ -111,7 +114,6 @@
<Link>NLog.xsd</Link>
<SubType>Designer</SubType>
</None>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -36,7 +36,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\_output\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -48,7 +48,7 @@
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\_output\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>

@ -5,6 +5,7 @@
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="libs"/>
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />

@ -20,6 +20,7 @@
"grunt-contrib-handlebars": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-less": "*",
"grunt-contrib-concat": "*"
"grunt-contrib-concat": "*",
"grunt-contrib-copy": "*"
}
}

Loading…
Cancel
Save