-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7 - Added a way to add configuration to your host without modi…
…fying the core host
- Loading branch information
1 parent
5719a9a
commit ccbcf03
Showing
17 changed files
with
193 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,73 @@ | ||
Brochard | ||
======== | ||
# Brochard | ||
|
||
Orchard CMS running on ASP.Net VNext (DNX) | ||
Brochard is the implementation of Orchard CMS in Asp.Net VNext (also known as DNX) | ||
|
||
Getting Started | ||
--------------- | ||
## Getting Started | ||
|
||
First off, follow the instructions here https://github.com/aspnet/home in order to install DNVM. Next install Visual Studio 2015, or what ever you flavour of editor is. | ||
|
||
Next you want to clone the Repo. 'git clone https://github.com/OrchardCMS/Brochard.git' and checkout the master branch. | ||
|
||
Run the build.cmd file included in the repository to bootstrap dnx and build solution. | ||
Run the build.cmd file included in the repository to bootstrap DNX and build solution. | ||
|
||
Next navigate to 'D:\Brochard\src\OrchardVNext.Web' or where ever your retrospective folder is on the command line in Administrative mode. | ||
|
||
run.. 'dnx web' -> Hey you just kicked up the Orchard host. | ||
|
||
Then in your browser, call the url... http://localhost:5001/setup/index | ||
|
||
## Using Brochard | ||
|
||
### Creating a host | ||
|
||
When running Brochard, you need a client. The default implementation is to have a client talk to a host. | ||
|
||
The client is any project that creates the host. | ||
|
||
To create the host in a web project you would do | ||
|
||
```c# | ||
public class Startup { | ||
public IServiceProvider ConfigureServices(IServiceCollection services) { | ||
return services | ||
// AddHostSample is where the magic is done. This extension method lives in the Host (OrchardVNext.Hosting.Web) | ||
.AddHostSample() | ||
.BuildServiceProvider(); | ||
} | ||
} | ||
``` | ||
|
||
The Host has a small wrapper | ||
|
||
|
||
```c# | ||
public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) { | ||
// This will setup all your core services for a host | ||
return services.AddHost(internalServices => { | ||
// The core of the host | ||
internalServices.AddHostCore(); | ||
///... All extra things you want registered so that you don't have to touch the core host. | ||
}); | ||
``` | ||
|
||
### Additional module locations | ||
|
||
Additional locations for module discovery can be added in your host setup. | ||
|
||
```c# | ||
public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) { | ||
return services.AddHost(internalServices => { | ||
internalServices.AddHostCore(); | ||
|
||
internalServices.Configure<ExtensionHarvestingOptions>(options => { | ||
var expander = new ModuleLocationExpander( | ||
DefaultExtensionTypes.Module, | ||
new[] { "~/Core/OrchardVNext.Core", "~/Modules" }, | ||
"Module.txt" | ||
); | ||
|
||
options.ModuleLocationExpanders.Add(expander); | ||
}); | ||
}); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/OrchardVNext.Hosting/Extensions/Folders/CoreModuleFolders.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/OrchardVNext.Hosting/Extensions/Folders/ExtensionHarvestingOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OrchardVNext.Hosting.Extensions.Folders { | ||
public class ExtensionHarvestingOptions { | ||
public IList<IModuleLocationExpander> ModuleLocationExpanders { get; } | ||
= new List<IModuleLocationExpander>(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/OrchardVNext.Hosting/Extensions/Folders/ExtensionHarvestingOptionsSetup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Framework.OptionsModel; | ||
|
||
namespace OrchardVNext.Hosting.Extensions.Folders { | ||
/// <summary> | ||
/// Sets up default options for <see cref="ExtensionHarvestingOptions"/>. | ||
/// </summary> | ||
public class ExtensionHarvestingOptionsSetup : ConfigureOptions<ExtensionHarvestingOptions> { | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="ExtensionHarvestingOptions"/>. | ||
/// </summary> | ||
public ExtensionHarvestingOptionsSetup() | ||
: base(options => { }) { | ||
Order = -1000; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/OrchardVNext.Hosting/Extensions/Folders/ExtensionLocator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using OrchardVNext.Hosting.Extensions.Models; | ||
using Microsoft.Framework.OptionsModel; | ||
|
||
namespace OrchardVNext.Hosting.Extensions.Folders { | ||
public class ExtensionLocator : IExtensionLocator { | ||
private readonly IOptions<ExtensionHarvestingOptions> _optionsAccessor; | ||
private readonly IExtensionHarvester _extensionHarvester; | ||
|
||
public ExtensionLocator( | ||
[NotNull] IOptions<ExtensionHarvestingOptions> optionsAccessor, | ||
[NotNull] IExtensionHarvester extensionHarvester) { | ||
_optionsAccessor = optionsAccessor; | ||
_extensionHarvester = extensionHarvester; | ||
} | ||
|
||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() { | ||
return _optionsAccessor.Options.ModuleLocationExpanders | ||
.SelectMany(x => _extensionHarvester.HarvestExtensions( | ||
x.SearchPaths, x.ExtensionType, x.ManifestName, x.ManifestOptional)); | ||
} | ||
} | ||
} |
Oops, something went wrong.