The start of a new world.

pull/1350/head^2
Jamie.Rees 8 years ago
parent 4836ab7e6c
commit 99c04e389f

16
Ombi/.gitignore vendored

@ -0,0 +1,16 @@
../app/**/*.js
../app/**/*.js.map
../wwwroot/**
# dependencies
../node_modules
../bower_components
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings

@ -0,0 +1,4 @@
;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/
cd ..
dotnet restore
dotnet publish -c Release -r win10-x64

@ -0,0 +1,7 @@
;https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/
cd ..
dotnet restore
dotnet publish -c Release -r win10-x64
dotnet publish -c Release -r osx.10.12-x64
dotnet publish -c Release -r ubuntu.16.10-x64
dotnet publish -c Release -r debian.8-x64

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D30CCF8-A115-4EB7-A34D-07780D752789}"
ProjectSection(SolutionItems) = preProject
Build\publish windows.bat = Build\publish windows.bat
Build\publish.bat = Build\publish.bat
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -0,0 +1,3 @@
{
"directory": "bower_components"
}

@ -0,0 +1,17 @@
/app/**/*.js
/app/**/*.js.map
/wwwroot/**
# dependencies
/node_modules
/bower_components
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
/systemjs.config.js*

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Ombi.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
public IActionResult Contact()
{
ViewData["Message"] = "Your contact page.";
return View();
}
public IActionResult Error()
{
return View();
}
}
}

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;osx.10.12-x64;ubuntu.16.10-x64;debian.8-x64;</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Styles\" />
<Folder Include="app\" />
<Content Include="app\**\*.js" CopyToPublishDirectory="PreserveNewest" />
<Content Include="app\**\*.html" CopyToPublishDirectory="PreserveNewest" />
<Content Include="app\**\*.css" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<None Update="app\search\search.component.js.map">
<DependentUpon>search.component.js</DependentUpon>
</None>
</ItemGroup>
</Project>

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace Ombi
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

@ -0,0 +1,22 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52038/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Ombi": {
"commandName": "Project"
}
}
}

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
namespace Ombi
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"app")),
RequestPath = new PathString("/app"),
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "spa-fallback",
template: "{*url}",
defaults: new { controller = "Home", action = "Index" });
});
}
}
}

@ -0,0 +1,14 @@
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
</p>

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Ombi</title>
<base href="@Url.Content("~/")" />
<link href="@Url.Content("~/css/lib/pace-theme-center-simple.css")" rel="stylesheet" />
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="@Url.Content("~/lib/system.js")?v=@ViewBag.AssemblyVersion"></script>
<script src="@Url.Content("~/lib/jquery.js")?v=@ViewBag.AssemblyVersion"></script>
<script src="@Url.Content("~/lib/systemjs.config.js")?v=@ViewBag.AssemblyVersion"></script>
</head>
<body>
@RenderBody()
<ombi></ombi>
</body>
</html>

@ -0,0 +1,2 @@
@using Ombi
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

@ -0,0 +1 @@
<router-outlet></router-outlet>

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'ombi',
moduleId: module.id,
templateUrl: './app.component.html'
})
export class AppComponent {
}

@ -0,0 +1,44 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import 'jquery.nanoscroller';
import { RouterModule, Routes } from '@angular/router';
import { HttpModule } from '@angular/http';
import { SearchComponent } from './search/search.component';
import { PageNotFoundComponent } from './errors/not-found.component';
import { MenubarModule } from 'primeng/components/menubar/menubar';
import { GrowlModule } from 'primeng/components/growl/growl';
const routes: Routes = [
{ path: '*', component: PageNotFoundComponent },
{ path: 'search', component: SearchComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(routes),
BrowserModule,
BrowserAnimationsModule,
HttpModule,
MenubarModule,
GrowlModule,
//ITAdminModule
],
declarations: [
AppComponent,
PageNotFoundComponent,
SearchComponent
],
providers: [
//MessageService,
//UtilService
],
bootstrap: [AppComponent]
})
export class AppModule { }

@ -0,0 +1,29 @@
// Config
enum envs {
local,
test,
next,
live
}
var envVar = "#{Environment}";
var env = envs.local;
if (envs[envVar]) {
env = envs[envVar];
}
export var config = {
envs: envs,
env: env,
systemJS: {
bundle: <boolean>{
[envs.local]: false,
[envs.test]: true,
[envs.next]: true,
[envs.live]: true
}[env]
}
}
export default config;

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
template: '<h2>Page not found</h2>'
})
export class PageNotFoundComponent { }

@ -0,0 +1,13 @@
import './polyfills';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import { config } from './config';
if (config.env !== config.envs.local) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);

@ -0,0 +1,14 @@
// TypeScript transpiles our app to ES5 but some dependencies are written in ES6 so must polyfill
import 'core-js/es6/string';
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import { config } from './config';
if (config.env === config.envs.local) {
Error['stackTraceLimit'] = Infinity;
require('zone.js/dist/long-stack-trace-zone');
}

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'ombi',
moduleId: module.id,
templateUrl: './search.component.html'
})
export class SearchComponent {
}

@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

@ -0,0 +1,8 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

@ -0,0 +1,13 @@
{
"name": "ombi",
"private": true,
"dependencies": {
"bootstrap": "3.3.7",
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6",
"PACE": "pace#^1.0.2",
"font-awesome": "^4.7.0"
}
}

@ -0,0 +1,24 @@
// Configure bundling and minification for the project.
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
[
{
"outputFileName": "wwwroot/css/site.min.css",
// An array of relative input file paths. Globbing patterns supported
"inputFiles": [
"wwwroot/css/site.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js"
],
// Optionally specify minification options
"minify": {
"enabled": true,
"renameLocals": true
},
// Optionally generate .map file
"sourceMap": false
}
]

@ -0,0 +1,252 @@
/// <binding BeforeBuild='build' Clean='clean' ProjectOpened='watch' />
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var changed = require('gulp-changed');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var path = require('path');
var del = require('del');
var merge = require('merge-stream');
var gulpif = require('gulp-if');
var runSequence = require('run-sequence');
var cleancss = require('gulp-clean-css');
var filter = require('gulp-filter');
var systemJSBuilder = require('systemjs-builder');
var run = require('gulp-run');
var paths = {
wwwroot: './wwwroot/',
npm: { // These will be resolved automatically and copied to output directory as its name, only works for pre-bundled modules e.g. angular
src: [
'@angular/animations',
'@angular/animations/browser',
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/http',
'@angular/router',
'@angular/forms'
],
dest: './lib'
},
lib: { // These are simple single-file dependencies with optional rename, for more files or folders use modules
src: [
{
file: './node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
rename: '@angular/platform-browser/animations'
},
{
file: './node_modules/systemjs/dist/system.src.js',
rename: 'system'
},
{
file: './node_modules/systemjs/dist/system-polyfills.src.js',
rename: 'system-polyfills'
},
'./bower_components/jquery/dist/jquery.js',
'./bower_components/PACE/pace.js',
'./primeng/ripple.js',
'./node_modules/nanoscroller/bin/javascripts/jquery.nanoscroller.js',
'./systemjs.config.js'
],
dest: './lib/'
},
libcss: [ // Normal css files to be copied
{
src: [
'./bower_components/PACE/themes/purple/pace-theme-center-simple.css',
'./node_modules/primeng/resources/primeng.css',
'./node_modules/nanoscroller/bin/css/nanoscroller.css'
],
dest: './css/lib/'
},
{
src: './Styles/**/*.css',
dest: './css',
filter: '**/*.css'
}
],
libfonts: [ // Library fonts
{
src: [
'./bower_components/font-awesome/fonts/*'
],
dest: './fonts/lib/'
}
],
modules: [ // This is for modules with multiple files that require each other, used when npm can't be used
{
name: 'zone.js',
src: ['./node_modules/zone.js/**/*.js'],
dest: './lib/zone.js/'
},
{
name: 'rxjs',
src: ['./node_modules/rxjs/**/*.js', '!./node_modules/rxjs/src/**/*.js'],
dest: './lib/rxjs/'
},
{
name: 'core-js',
src: ['./node_modules/core-js/**/*.js'],
dest: './lib/core-js/'
},
{
name: 'primeng',
src: './node_modules/primeng/**/*.js',
dest: './lib/primeng/'
}
],
sass: { // Simple sass->css compilation
src: ['./Styles/**/*.scss', '!./Styles/primeng/**'],
dest: './css/',
filter: '**/*.css'
},
bundle: { // This is the config for the bundler, you shouldn't need to change this
root: './',
dest: './lib/bundle.js',
bundle: 'app/main.js',
}
}
gulp.task('npm', function () {
var streams = []
for (let module of paths.npm.src) {
let file = require.resolve(module);
streams.push(
gulp.src(file)
.pipe(gulpif(global.full, sourcemaps.init()))
.pipe(gulpif(global.full, uglify({ source_map: true })))
.pipe(rename((path => { path.basename = module })))
.pipe(gulpif(global.full, sourcemaps.write('../maps')))
.pipe(gulp.dest(path.join(paths.wwwroot, paths.npm.dest)))
);
}
return merge(streams);
})
gulp.task('lib', function () {
var streams = []
for (let module of paths.lib.src) {
streams.push(
gulp.src(typeof module === "string" ? module : module.file)
.pipe(gulpif(global.full, sourcemaps.init()))
.pipe(gulpif(global.full, uglify({ source_map: true })))
.pipe(rename(function (path) {
if (typeof module !== "string" && module.rename) {
path.basename = module.rename;
}
}))
.pipe(gulpif(global.full, sourcemaps.write('maps')))
.pipe(gulp.dest(path.join(paths.wwwroot, paths.lib.dest)))
);
}
return merge(streams);
})
gulp.task('libcss', function () {
var streams = []
for (let module of paths.libcss) {
var f = filter("**/*.css", { restore: true });
streams.push(
gulp.src(module.src)
.pipe(f)
.pipe(gulpif(global.full, sourcemaps.init()))
.pipe(gulpif(global.full, cleancss()))
.pipe(gulpif(global.full, sourcemaps.write(`${module.name ? '.' : ''}./maps/${module.name ? module.name : ''}`)))
.pipe(f.restore)
.pipe(gulp.dest(path.join(paths.wwwroot, module.dest)))
);
}
return merge(streams);
})
gulp.task('libfonts', function () {
var streams = []
for (let module of paths.libfonts) {
streams.push(
gulp.src(module.src)
.pipe(gulp.dest(path.join(paths.wwwroot, module.dest)))
);
}
return merge(streams);
})
gulp.task('modules', function () {
var streams = []
for (let module of paths.modules) {
streams.push(
gulp.src(module.src)
.pipe(gulpif(global.full, sourcemaps.init()))
.pipe(gulpif(global.full, uglify({ source_map: true })))
.pipe(gulpif(global.full, sourcemaps.write(`${module.name ? '.' : ''}./maps/${module.name ? module.name : ''}`)))
.pipe(gulp.dest(path.join(paths.wwwroot, module.dest)))
);
}
return merge(streams);
})
gulp.task('sass', function () {
return gulp.src(paths.sass.src)
.pipe(changed(paths.sass.dest))
.pipe(gulpif(global.full, sourcemaps.init()))
.pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError))
.pipe(gulpif(global.full, sourcemaps.write('maps')))
.pipe(gulp.dest(path.join(paths.wwwroot, paths.sass.dest)))
});
gulp.task('bundle', function () {
var builder = new systemJSBuilder(paths.bundle.root);
builder.config({
baseURL: paths.wwwroot,
packages: {
'.': {
defaultExtension: 'js'
}
},
paths: {
'*': 'lib/*',
'app/*': 'app/*'
}
});
del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true });
return builder.bundle(paths.bundle.bundle, path.join(paths.wwwroot, paths.bundle.dest), {
sourceMaps: true
})
})
gulp.task('clean', function () {
return del([
...paths.npm.src.map(x => path.join(paths.npm.dest, x + "**")),
paths.sass.dest + paths.sass.filter,
paths.lib.dest,
paths.bundle.dest,
...paths.modules.map(m => m.dest),
...paths.libcss.map(m => m.dest + (m.filter ? m.filter : '')),
...paths.libfonts.map(m => m.dest)
].map(x => path.join(paths.wwwroot, x)), { force: true });
})
gulp.task('typescript', function () {
return run('tsc').exec();
});
gulp.task('fullvar', () => { global.full = true });
gulp.task('libs')
gulp.task('copy', ['lib', 'libcss', 'libfonts', 'npm', 'modules']);
gulp.task('compile', ['sass']);
gulp.task('build', callback => runSequence('copy', 'compile', callback));
gulp.task('full', callback => runSequence('clean', 'build', callback));
// Use this in a build server environment to compile and bundle everything
gulp.task('publish', callback => runSequence('fullvar', 'full', 'typescript', 'bundle', callback));
// Auto compiles sass files on change, note that this doesn't seem to pick up new files at the moment
gulp.task('watch', function () {
gulp.watch(paths.sass.src, ['sass']);
gulp.watch('./Styles/**/*.css', ['libcss']); // legacy css
});

@ -0,0 +1,42 @@
{
"name": "ombi",
"version": "1.0.0",
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@angular/router": "^4.0.0",
"@types/jquery": "^2.0.33",
"@types/systemjs": "^0.20.2",
"core-js": "^2.4.1",
"del": "^2.2.2",
"gulp": "~3.9.1",
"gulp-changed": "^1.3.0",
"gulp-clean-css": "^3.0.4",
"gulp-filter": "^5.0.0",
"gulp-if": "^2.0.2",
"gulp-rename": "^1.2.2",
"gulp-run": "^1.7.1",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.9.0",
"gulp-systemjs-builder": "^0.15.0",
"gulp-uglify": "^1.5.4",
"merge-stream": "^1.0.1",
"nanoscroller": "^0.8.7",
"primeng": "^2.0.5",
"run-sequence": "^1.2.2",
"rxjs": "^5.0.3",
"systemjs": "^0.19.41",
"systemjs-builder": "^0.15.34",
"typescript": "^2.2.1",
"zone.js": "^0.8.5"
}
}

@ -0,0 +1,20 @@
System.import('/app/config.js').then((module: any) => {
var config = module.config.systemJS;
System.config({
baseURL: '/lib',
packages: {
'.': {
defaultExtension: 'js'
}
},
map: { app: '../app' }
})
if (config.bundle) {
System.import('bundle').then(() => {
System.import('/app/main');
})
} else {
System.import('/app/main')
}
});

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": [ "es5", "es2015" ],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"alwaysStrict": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true
},
"compileOnSave": true
}
Loading…
Cancel
Save