mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Rename commands
--HG-- branch : dev
This commit is contained in:
@@ -2,9 +2,11 @@ using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Orchard.Commands;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Packaging.Services;
|
||||
|
||||
namespace Orchard.Packaging.Commands {
|
||||
[OrchardFeature("Gallery")]
|
||||
public class GalleryCommands : DefaultOrchardCommandHandler {
|
||||
private readonly IPackageManager _packageManager;
|
||||
|
||||
@@ -12,6 +14,7 @@ namespace Orchard.Packaging.Commands {
|
||||
_packageManager = packageManager;
|
||||
}
|
||||
|
||||
#if false
|
||||
[CommandHelp("harvest <moduleName>\r\n\t" + "Package a module into a distributable")]
|
||||
[CommandName("harvest")]
|
||||
public void PackageCreate(string moduleName) {
|
||||
@@ -31,12 +34,30 @@ namespace Orchard.Packaging.Commands {
|
||||
Context.Output.Write(charBuffer, 0, charCount);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[CommandHelp("harvest post <moduleName> <feedUrl>\r\n\t" + "Package a module into a distributable and push it to a feed server.")]
|
||||
[CommandName("harvest post")]
|
||||
public void PackageCreate(string moduleName, string feedUrl) {
|
||||
[CommandHelp("gallery submit module <moduleName> <feedUrl>\r\n\t" + "Package a module into a distributable and push it to a feed server.")]
|
||||
[CommandName("gallery submit module")]
|
||||
public void SubmitModule(string moduleName, string feedUrl) {
|
||||
var packageData = _packageManager.Harvest(moduleName);
|
||||
|
||||
try {
|
||||
_packageManager.Push(packageData, feedUrl);
|
||||
Context.Output.WriteLine("Success");
|
||||
}
|
||||
catch (WebException webException) {
|
||||
var text = new StreamReader(webException.Response.GetResponseStream()).ReadToEnd();
|
||||
throw new ApplicationException(text);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandHelp("gallery submit package <filePath> <feedUrl>\r\n\t" + "Push a packaged module to a feed server.")]
|
||||
[CommandName("gallery submit package")]
|
||||
public void SubmitPackage(string filePath, string feedUrl) {
|
||||
using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) {
|
||||
var packageData = new PackageData {
|
||||
PackageStream = stream
|
||||
};
|
||||
|
||||
try {
|
||||
_packageManager.Push(packageData, feedUrl);
|
||||
@@ -49,4 +70,5 @@ namespace Orchard.Packaging.Commands {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,8 +16,8 @@ namespace Orchard.Packaging.Commands {
|
||||
[OrchardSwitch]
|
||||
public string Filename { get; set; }
|
||||
|
||||
[CommandHelp("packaging create package <moduleName>\r\n\t" + "Create a package for the module <moduleName>. The default filename is <moduleName>-<moduleVersion>.zip.")]
|
||||
[CommandName("packaging create package")]
|
||||
[CommandHelp("package create <moduleName>\r\n\t" + "Create a package for the module <moduleName>. The default filename is <moduleName>-<moduleVersion>.zip.")]
|
||||
[CommandName("package create")]
|
||||
[OrchardSwitches("Filename")]
|
||||
public void CreatePackage(string moduleName) {
|
||||
var packageData = _packageManager.Harvest(moduleName);
|
||||
@@ -37,8 +37,8 @@ namespace Orchard.Packaging.Commands {
|
||||
Context.Output.WriteLine(T("Package \"{0}\" successfully created", fileInfo.FullName));
|
||||
}
|
||||
|
||||
[CommandHelp("packaging install package <filename>\r\n\t" + "Install a module from a package <filename>.")]
|
||||
[CommandName("packaging install package")]
|
||||
[CommandHelp("package install <filename>\r\n\t" + "Install a module from a package <filename>.")]
|
||||
[CommandName("package install ")]
|
||||
public void InstallPackage(string filename) {
|
||||
if (!File.Exists(filename)) {
|
||||
Context.Output.WriteLine(T("File \"{0}\" does not exist.", filename));
|
||||
|
Reference in New Issue
Block a user