Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Add "kpm publish" command
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengTian committed Mar 19, 2015
1 parent 907fc79 commit 97890b7
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/Microsoft.Framework.PackageManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,58 @@ public int Main(string[] args)
});
});

app.Command("publish", c =>
{
c.Description = "Bundle application for deployment";
var argProject = c.Argument("[project]", "Path to project, default is current directory");
var optionOut = c.Option("-o|--out <PATH>", "Where does it go", CommandOptionType.SingleValue);
var optionConfiguration = c.Option("--configuration <CONFIGURATION>", "The configuration to use for deployment (Debug|Release|{Custom})",
CommandOptionType.SingleValue);
var optionNoSource = c.Option("--no-source", "Compiles the source files into NuGet packages",
CommandOptionType.NoValue);
var optionRuntime = c.Option("--runtime <RUNTIME>", "Name or full path of the runtime folder to include, or \"active\" for current runtime on PATH",
CommandOptionType.MultipleValue);
var optionNative = c.Option("--native", "Build and include native images. User must provide targeted CoreCLR runtime versions along with this option.",
CommandOptionType.NoValue);
var optionWwwRoot = c.Option("--wwwroot <NAME>", "Name of public folder in the project directory",
CommandOptionType.SingleValue);
var optionWwwRootOut = c.Option("--wwwroot-out <NAME>",
"Name of public folder in the bundle, can be used only when the '--wwwroot' option or 'webroot' in project.json is specified",
CommandOptionType.SingleValue);
var optionQuiet = c.Option("--quiet", "Do not show output such as source/destination of bundled files",
CommandOptionType.NoValue);
c.HelpOption("-?|-h|--help");
c.OnExecute(() =>
{
var options = new BundleOptions
{
OutputDir = optionOut.Value(),
ProjectDir = argProject.Value ?? System.IO.Directory.GetCurrentDirectory(),
Configuration = optionConfiguration.Value() ?? "Debug",
RuntimeTargetFramework = _environment.RuntimeFramework,
WwwRoot = optionWwwRoot.Value(),
WwwRootOut = optionWwwRootOut.Value() ?? optionWwwRoot.Value(),
NoSource = optionNoSource.HasValue(),
Runtimes = optionRuntime.HasValue() ?
string.Join(";", optionRuntime.Values).
Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) :
new string[0],
Native = optionNative.HasValue(),
Reports = CreateReports(optionVerbose.HasValue(), optionQuiet.HasValue())
};
var manager = new BundleManager(_hostServices, options);
if (!manager.Bundle())
{
return -1;
}
return 0;
});
});

app.Command("pack", c =>
{
c.Description = "Build NuGet packages for the project in given directory";
Expand Down

0 comments on commit 97890b7

Please sign in to comment.