-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from Advance-Technologies-Foundation/develop
Release 2.0.0.9
- Loading branch information
Showing
67 changed files
with
1,119 additions
and
480 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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Clio.Common; | ||
using Clio.Project.NuGet; | ||
using CommandLine; | ||
|
||
namespace Clio.Command | ||
{ | ||
|
||
[Verb("check-nuget-update", Aliases = new string[] { "check" }, HelpText = "Check for package updates in NuGet")] | ||
public class CheckNugetUpdateOptions : EnvironmentOptions | ||
{ | ||
|
||
[Option('s', "Source", Required = false, HelpText = "Specifies the server URL", | ||
Default = "https://www.nuget.org")] | ||
public string SourceUrl { get; set; } | ||
|
||
} | ||
|
||
public class CheckNugetUpdateCommand : Command<CheckNugetUpdateOptions> | ||
{ | ||
private INuGetManager _nugetManager; | ||
|
||
public CheckNugetUpdateCommand(INuGetManager nugetManager) { | ||
nugetManager.CheckArgumentNull(nameof(nugetManager)); | ||
_nugetManager = nugetManager; | ||
} | ||
|
||
private static string GetNameAndVersion(string name, PackageVersion version) { | ||
return $"{name} ({version})"; | ||
} | ||
|
||
private static string GetPackageUpdateMessage(PackageForUpdate packageForUpdate) { | ||
LastVersionNugetPackages lastVersionNugetPackages = packageForUpdate.LastVersionNugetPackages; | ||
PackageInfo applPkg = packageForUpdate.ApplicationPackage; | ||
string pkgName = applPkg.Descriptor.Name; | ||
string message = $" {GetNameAndVersion(pkgName, applPkg.Version)} --> " + | ||
$"{GetNameAndVersion(pkgName, lastVersionNugetPackages.Last.Version)}"; | ||
return lastVersionNugetPackages.LastIsStable || lastVersionNugetPackages.StableIsNotExists | ||
? message | ||
: $"{message}; Stable: {GetNameAndVersion(pkgName, lastVersionNugetPackages.Stable.Version)}"; | ||
} | ||
|
||
private static void PrintPackagesForUpdate(IEnumerable<PackageForUpdate> packagesForUpdate) { | ||
Console.WriteLine("Packages for update:"); | ||
foreach (PackageForUpdate packageForUpdate in packagesForUpdate) { | ||
Console.WriteLine(GetPackageUpdateMessage(packageForUpdate)); | ||
} | ||
} | ||
|
||
public override int Execute(CheckNugetUpdateOptions options) { | ||
try { | ||
IEnumerable<PackageForUpdate> packagesForUpdate = _nugetManager.GetPackagesForUpdate(options.SourceUrl); | ||
PrintPackagesForUpdate(packagesForUpdate); | ||
Console.WriteLine("Done"); | ||
return 0; | ||
} catch (Exception e) { | ||
Console.WriteLine(e.Message); | ||
return 1; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
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,35 +1,19 @@ | ||
namespace Clio.Command.PackageCommand | ||
{ | ||
using System; | ||
using System.Threading; | ||
using Clio.Common; | ||
|
||
public class DeletePackageCommand : BaseRemoteCommand | ||
public class DeletePackageCommand : RemoteCommand<DeletePkgOptions> | ||
{ | ||
|
||
public DeletePackageCommand(IApplicationClient applicationClient) | ||
: base(applicationClient) { | ||
public DeletePackageCommand(IApplicationClient applicationClient, EnvironmentSettings settings) | ||
: base(applicationClient, settings) { | ||
} | ||
|
||
private static string DeletePackageUrl => AppUrl + @"/ServiceModel/AppInstallerService.svc/DeletePackage"; | ||
protected override string ServicePath => @"/ServiceModel/AppInstallerService.svc/DeletePackage"; | ||
|
||
private void DeletePackage(string code) { | ||
Console.WriteLine("Deleting..."); | ||
string deleteRequestData = "\"" + code + "\""; | ||
ApplicationClient.ExecutePostRequest(DeletePackageUrl, deleteRequestData, Timeout.Infinite); | ||
Console.WriteLine("Deleted."); | ||
protected override string GetResponseData(DeletePkgOptions options) { | ||
return "\"" + options.Name + "\""; | ||
} | ||
|
||
public int Delete(DeletePkgOptions options) { | ||
try { | ||
Configure(options); | ||
DeletePackage(options.Name); | ||
Console.WriteLine("Done"); | ||
return 0; | ||
} catch (Exception e) { | ||
Console.WriteLine(e.Message); | ||
return 1; | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.