This commit is contained in:
Jamie.Rees 2017-09-13 09:20:26 +01:00
commit 0e6a1707f4
20 changed files with 44 additions and 18 deletions

View file

@ -28,19 +28,19 @@ GitVersion versionInfo = null;
var buildSettings = new DotNetCoreBuildSettings
{
Framework = "netcoreapp1.1",
Framework = "netcoreapp2.0",
Configuration = "Release",
OutputDirectory = Directory(buildDir),
};
var publishSettings = new DotNetCorePublishSettings
{
Framework = "netcoreapp1.1",
Framework = "netcoreapp2.0",
Configuration = "Release",
OutputDirectory = Directory(buildDir),
};
var artifactsFolder = buildDir + "/netcoreapp1.1/";
var artifactsFolder = buildDir + "/netcoreapp2.0/";
var windowsArtifactsFolder = artifactsFolder + "win10-x64/published";
var osxArtifactsFolder = artifactsFolder + "osx.10.12-x64/published";
var ubuntuArtifactsFolder = artifactsFolder + "ubuntu.16.04-x64/published";
@ -151,10 +151,10 @@ Task("Publish-Windows")
.Does(() =>
{
publishSettings.Runtime = "win10-x64";
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/win10-x64/published");
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/win10-x64/published");
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
CopyFile(buildDir + "/netcoreapp1.1/win10-x64/Swagger.xml", buildDir + "/netcoreapp1.1/win10-x64/published/Swagger.xml");
CopyFile(buildDir + "/netcoreapp2.0/win10-x64/Swagger.xml", buildDir + "/netcoreapp2.0/win10-x64/published/Swagger.xml");
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
});
@ -162,10 +162,10 @@ Task("Publish-OSX")
.Does(() =>
{
publishSettings.Runtime = "osx.10.12-x64";
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/osx.10.12-x64/published");
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/osx.10.12-x64/published");
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
CopyFile(buildDir + "/netcoreapp1.1/osx.10.12-x64/Swagger.xml", buildDir + "/netcoreapp1.1/osx.10.12-x64/published/Swagger.xml");
CopyFile(buildDir + "/netcoreapp2.0/osx.10.12-x64/Swagger.xml", buildDir + "/netcoreapp2.0/osx.10.12-x64/published/Swagger.xml");
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
});
@ -173,30 +173,30 @@ Task("Publish-Ubuntu")
.Does(() =>
{
publishSettings.Runtime = "ubuntu.16.04-x64";
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/ubuntu.16.04-x64/published");
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/ubuntu.16.04-x64/published");
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
CopyFile(buildDir + "/netcoreapp1.1/ubuntu.16.04-x64/Swagger.xml", buildDir + "/netcoreapp1.1/ubuntu.16.04-x64/published/Swagger.xml");
CopyFile(buildDir + "/netcoreapp2.0/ubuntu.16.04-x64/Swagger.xml", buildDir + "/netcoreapp2.0/ubuntu.16.04-x64/published/Swagger.xml");
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
});
Task("Publish-Debian")
.Does(() =>
{
publishSettings.Runtime = "debian.8-x64";
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/debian.8-x64/published");
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/debian.8-x64/published");
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
CopyFile(buildDir + "/netcoreapp1.1/debian.8-x64/Swagger.xml", buildDir + "/netcoreapp1.1/debian.8-x64/published/Swagger.xml");
CopyFile(buildDir + "/netcoreapp2.0/debian.8-x64/Swagger.xml", buildDir + "/netcoreapp2.0/debian.8-x64/published/Swagger.xml");
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
});
Task("Publish-Centos")
.Does(() =>
{
publishSettings.Runtime = "centos.7-x64";
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp1.1/centos.7-x64/published");
publishSettings.OutputDirectory = Directory(buildDir) + Directory("netcoreapp2.0/centos.7-x64/published");
DotNetCorePublish("./src/Ombi/Ombi.csproj", publishSettings);
CopyFile(buildDir + "/netcoreapp1.1/centos.7-x64/Swagger.xml", buildDir + "/netcoreapp1.1/centos.7-x64/published/Swagger.xml");
CopyFile(buildDir + "/netcoreapp2.0/centos.7-x64/Swagger.xml", buildDir + "/netcoreapp2.0/centos.7-x64/published/Swagger.xml");
DotNetCorePublish("./src/Ombi.Updater/Ombi.Updater.csproj", publishSettings);
});

View file

@ -6,6 +6,7 @@
<FileVersion>3.0.0.0</FileVersion>
<Version></Version>
<PackageVersion></PackageVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>

1
src/Ombi/.gitignore vendored
View file

@ -20,3 +20,4 @@ testem.log
#/typings
/systemjs.config.js*
/Logs/**
**.db

View file

@ -14,6 +14,7 @@ namespace Ombi.Controllers.External
/// </summary>
[Admin]
[ApiV1]
[Produces("application/json")]
public class EmbyController : Controller
{
/// <summary>

View file

@ -15,6 +15,7 @@ namespace Ombi.Controllers.External
{
[Admin]
[ApiV1]
[Produces("application/json")]
public class PlexController : Controller
{
public PlexController(IPlexApi plexApi, ISettingsService<PlexSettings> plexSettings)

View file

@ -11,6 +11,7 @@ namespace Ombi.Controllers.External
{
[Admin]
[ApiV1]
[Produces("application/json")]
public class RadarrController : Controller
{
public RadarrController(IRadarrApi radarr, ISettingsService<RadarrSettings> settings)

View file

@ -12,6 +12,7 @@ namespace Ombi.Controllers.External
{
[Admin]
[ApiV1]
[Produces("application/json")]
public class SonarrController : Controller
{
public SonarrController(ISonarrApi sonarr, ISettingsService<SonarrSettings> settings)

View file

@ -25,6 +25,7 @@ namespace Ombi.Controllers.External
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
[Admin]
[ApiV1]
[Produces("application/json")]
public class TesterController : Controller
{
/// <summary>

View file

@ -35,6 +35,7 @@ namespace Ombi.Controllers
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
[PowerUser]
[ApiV1]
[Produces("application/json")]
public class IdentityController : Controller
{
public IdentityController(UserManager<OmbiUser> user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,

View file

@ -11,6 +11,7 @@ using Ombi.Config;
namespace Ombi.Controllers
{
[ApiV1]
[Produces("application/json")]
public class ImagesController : Controller
{
public ImagesController(IFanartTvApi api, IApplicationConfigRepository config, IOptions<LandingPageBackground> options)

View file

@ -13,6 +13,7 @@ namespace Ombi.Controllers
{
[ApiV1]
[AllowAnonymous]
[Produces("application/json")]
public class LandingPageController
{
public LandingPageController(ISettingsService<PlexSettings> plex, ISettingsService<EmbySettings> emby,

View file

@ -8,6 +8,7 @@ namespace Ombi.Controllers
{
[Authorize]
[ApiV1]
[Produces("application/json")]
public class LoggingController : Controller
{
public LoggingController(ILogger logger)

View file

@ -13,6 +13,7 @@ namespace Ombi.Controllers
{
[Authorize]
[ApiV1]
[Produces("application/json")]
public class RequestController : Controller
{
public RequestController(IMovieRequestEngine engine, ITvRequestEngine tvRequestEngine)

View file

@ -15,6 +15,7 @@ namespace Ombi.Controllers
{
[Authorize]
[ApiV1]
[Produces("application/json")]
public class SearchController : Controller
{
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger)

View file

@ -30,6 +30,7 @@ namespace Ombi.Controllers
/// <seealso cref="Ombi.Controllers.BaseV1ApiController" />
[Admin]
[ApiV1]
[Produces("application/json")]
public class SettingsController : Controller
{
/// <summary>

View file

@ -37,6 +37,7 @@ using Ombi.Settings.Settings.Models;
namespace Ombi.Controllers
{
[ApiV1]
[Produces("application/json")]
public class StatusController : Controller
{
public StatusController(ISettingsService<OmbiSettings> ombi)

View file

@ -18,6 +18,7 @@ using Ombi.Store.Repository;
namespace Ombi.Controllers
{
[ApiV1]
[Produces("application/json")]
public class TokenController
{
public TokenController(UserManager<OmbiUser> um, IOptions<TokenAuthentication> ta,

View file

@ -40,6 +40,10 @@
</ResolvedFileToPublish>
</ItemGroup>
</Target>
<ItemGroup>
<None Remove="Ombi.db" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.0" />

View file

@ -71,11 +71,10 @@ namespace Ombi
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)
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<OmbiContext>(options =>
options.UseSqlite("Data Source=Ombi.db"));
services.AddDbContext<OmbiContext>();
services.AddIdentity<OmbiUser, IdentityRole>()
.AddEntityFrameworkStores<OmbiContext>()
@ -179,13 +178,20 @@ namespace Ombi
x.Audience = "Ombi";
x.TokenValidationParameters = tokenValidationParameters;
});
// Build the intermediate service provider
var serviceProvider = services.BuildServiceProvider();
//return the provider
return serviceProvider;
}
// 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, IMemoryCache cache)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,
IMemoryCache cache, IServiceProvider serviceProvider)
{
var ctx = (IOmbiContext)app.ApplicationServices.GetService(typeof(IOmbiContext));
var ctx = serviceProvider.GetService<IOmbiContext>();