diff --git a/Gruntfile.js b/Gruntfile.js index 46f67d419..719ca05e6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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']); }; \ No newline at end of file diff --git a/NzbDrone.Api/FrontendModule/BootstrapModule.cs b/NzbDrone.Api/FrontendModule/BootstrapModule.cs deleted file mode 100644 index 3b0bd04a4..000000000 --- a/NzbDrone.Api/FrontendModule/BootstrapModule.cs +++ /dev/null @@ -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" }; - } - } -} \ No newline at end of file diff --git a/NzbDrone.Api/FrontendModule/IndexModule.cs b/NzbDrone.Api/FrontendModule/IndexModule.cs index a89a18e5d..45198e141 100644 --- a/NzbDrone.Api/FrontendModule/IndexModule.cs +++ b/NzbDrone.Api/FrontendModule/IndexModule.cs @@ -24,7 +24,7 @@ private object Index() } - return View["NzbDrone.Backbone/index.html"]; + return View["UI/index.html"]; } } } \ No newline at end of file diff --git a/NzbDrone.Api/FrontendModule/LessService.cs b/NzbDrone.Api/FrontendModule/LessService.cs deleted file mode 100644 index b3bac4cbc..000000000 --- a/NzbDrone.Api/FrontendModule/LessService.cs +++ /dev/null @@ -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)); - } - } - } -} \ No newline at end of file diff --git a/NzbDrone.Api/NancyBootstrapper.cs b/NzbDrone.Api/NancyBootstrapper.cs index d8f7175e5..1c8fae5d3 100644 --- a/NzbDrone.Api/NancyBootstrapper.cs +++ b/NzbDrone.Api/NancyBootstrapper.cs @@ -104,7 +104,7 @@ protected override DiagnosticsConfiguration DiagnosticsConfiguration 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" })); } } diff --git a/NzbDrone.Api/NzbDrone.Api.csproj b/NzbDrone.Api/NzbDrone.Api.csproj index d852823c4..71fa895a8 100644 --- a/NzbDrone.Api/NzbDrone.Api.csproj +++ b/NzbDrone.Api/NzbDrone.Api.csproj @@ -61,9 +61,6 @@ False ..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll - - ..\packages\DotlessClientOnly.1.3.1.0\lib\dotless.ClientOnly.dll - ..\packages\FluentValidation.3.4.6.0\lib\Net40\FluentValidation.dll @@ -106,8 +103,6 @@ - - diff --git a/NzbDrone.Api/packages.config b/NzbDrone.Api/packages.config index a5e2d4c3a..c61a1a28d 100644 --- a/NzbDrone.Api/packages.config +++ b/NzbDrone.Api/packages.config @@ -2,7 +2,6 @@ - diff --git a/NzbDrone.Backbone/Content/Bootstrap/font-awesome.less b/NzbDrone.Backbone/Content/Bootstrap/font-awesome.less index 3a60645c5..5830acd76 100644 --- a/NzbDrone.Backbone/Content/Bootstrap/font-awesome.less +++ b/NzbDrone.Backbone/Content/Bootstrap/font-awesome.less @@ -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'); diff --git a/NzbDrone.Backbone/Content/font/FontAwesome.otf b/NzbDrone.Backbone/Content/fonts/FontAwesome - Copy.otf similarity index 100% rename from NzbDrone.Backbone/Content/font/FontAwesome.otf rename to NzbDrone.Backbone/Content/fonts/FontAwesome - Copy.otf diff --git a/NzbDrone.Backbone/Content/fonts/FontAwesome.otf b/NzbDrone.Backbone/Content/fonts/FontAwesome.otf new file mode 100644 index 000000000..64049bf2e Binary files /dev/null and b/NzbDrone.Backbone/Content/fonts/FontAwesome.otf differ diff --git a/NzbDrone.Backbone/Content/font/fontawesome-webfont.eot b/NzbDrone.Backbone/Content/fonts/fontawesome-webfont.eot similarity index 100% rename from NzbDrone.Backbone/Content/font/fontawesome-webfont.eot rename to NzbDrone.Backbone/Content/fonts/fontawesome-webfont.eot diff --git a/NzbDrone.Backbone/Content/font/fontawesome-webfont.svg b/NzbDrone.Backbone/Content/fonts/fontawesome-webfont.svg similarity index 100% rename from NzbDrone.Backbone/Content/font/fontawesome-webfont.svg rename to NzbDrone.Backbone/Content/fonts/fontawesome-webfont.svg diff --git a/NzbDrone.Backbone/Content/font/fontawesome-webfont.ttf b/NzbDrone.Backbone/Content/fonts/fontawesome-webfont.ttf similarity index 100% rename from NzbDrone.Backbone/Content/font/fontawesome-webfont.ttf rename to NzbDrone.Backbone/Content/fonts/fontawesome-webfont.ttf diff --git a/NzbDrone.Backbone/Content/font/fontawesome-webfont.woff b/NzbDrone.Backbone/Content/fonts/fontawesome-webfont.woff similarity index 100% rename from NzbDrone.Backbone/Content/font/fontawesome-webfont.woff rename to NzbDrone.Backbone/Content/fonts/fontawesome-webfont.woff diff --git a/NzbDrone.Backbone/Index.html b/NzbDrone.Backbone/Index.html index 519d1e37a..1ed3195e4 100644 --- a/NzbDrone.Backbone/Index.html +++ b/NzbDrone.Backbone/Index.html @@ -9,7 +9,7 @@ - + diff --git a/NzbDrone.Backbone/NzbDrone.Backbone.csproj b/NzbDrone.Backbone/NzbDrone.Backbone.csproj index 657d86247..3b55ad3be 100644 --- a/NzbDrone.Backbone/NzbDrone.Backbone.csproj +++ b/NzbDrone.Backbone/NzbDrone.Backbone.csproj @@ -66,7 +66,7 @@ - + @@ -186,121 +186,121 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/NzbDrone.Console/NzbDrone.Console.csproj b/NzbDrone.Console/NzbDrone.Console.csproj index 2321d4e93..e4149e3a6 100644 --- a/NzbDrone.Console/NzbDrone.Console.csproj +++ b/NzbDrone.Console/NzbDrone.Console.csproj @@ -36,7 +36,7 @@ true full false - ..\_output\Debug\ + ..\_output\ DEBUG;TRACE prompt 4 @@ -48,7 +48,7 @@ x86 pdbonly true - ..\_output\Release\ + ..\_output\ TRACE prompt 4 @@ -104,6 +104,9 @@ + + app.config + NLog.config @@ -111,7 +114,6 @@ NLog.xsd Designer - diff --git a/NzbDrone.Console/app.config b/NzbDrone.Console/app.config deleted file mode 100644 index 46c4e347d..000000000 --- a/NzbDrone.Console/app.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NzbDrone/NzbDrone.csproj b/NzbDrone/NzbDrone.csproj index 0bac335e5..ba62bd856 100644 --- a/NzbDrone/NzbDrone.csproj +++ b/NzbDrone/NzbDrone.csproj @@ -36,7 +36,7 @@ true full false - bin\Debug\ + ..\_output\ DEBUG;TRACE prompt 4 @@ -48,7 +48,7 @@ x86 pdbonly true - bin\Release\ + ..\_output\ TRACE prompt 4 diff --git a/NzbDrone/app.config b/NzbDrone/app.config index 46c4e347d..36278d6a2 100644 --- a/NzbDrone/app.config +++ b/NzbDrone/app.config @@ -5,6 +5,7 @@ + diff --git a/package.json b/package.json index 8ca638756..6428cb3c9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "grunt-contrib-handlebars": "*", "grunt-contrib-watch": "*", "grunt-contrib-less": "*", - "grunt-contrib-concat": "*" + "grunt-contrib-concat": "*", + "grunt-contrib-copy": "*" } }