Skip to content

Commit

Permalink
Added support for beta versions and fixed an issue where downloading …
Browse files Browse the repository at this point in the history
…groovy files wasn't working

Closes #2
  • Loading branch information
dcmeglio committed May 6, 2020
1 parent 6ba4869 commit c518a17
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public int Execute(ManifestAddAppOptions options)
oauth = options.Oauth ?? false
});
SetNonNullPropertyIfSpecified(app, "version", options.Version);
SetNonNullPropertyIfSpecified(app, "betaVersion", options.BetaVersion);
SetNonNullPropertyIfSpecified(app, "betaLocation", options.BetaLocation);
var alternateNames = BuildAlternateNames(options.AlternateNames);
if (alternateNames != null)
app.Add("alternateNames", alternateNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public int Execute(ManifestAddDriverOptions options)
required = options.Required ?? false
});
SetNonNullPropertyIfSpecified(driver, "version", options.Version);
SetNonNullPropertyIfSpecified(driver, "betaVersion", options.BetaVersion);
SetNonNullPropertyIfSpecified(driver, "betaLocation", options.BetaLocation);
var alternateNames = BuildAlternateNames(options.AlternateNames);
if (alternateNames != null)
driver.Add("alternateNames", alternateNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;

namespace HubitatPackageManagerTools.Executors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public int Execute(ManifestModifyAppOptions options)
if (app != null)
{
SetNullableProperty(app, "version", options.Version);
SetNullableProperty(app, "betaVersion", options.BetaVersion);
SetNullableProperty(app, "betaLocation", options.BetaLocation);

if (options.Required == true)
app["required"] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public int Execute(ManifestModifyDriverOptions options)
if (driver != null)
{
SetNullableProperty(driver, "version", options.Version);
SetNullableProperty(driver, "betaVersion", options.BetaVersion);
SetNullableProperty(driver, "betaLocation", options.BetaLocation);

if (options.Required == true)
driver["required"] = true;
Expand Down
10 changes: 6 additions & 4 deletions HubitatPackageManagerTools/HubitatPackageManagerTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<AssemblyName>hpm</AssemblyName>
<Version>1.2.2</Version>
<AssemblyVersion>1.2.2</AssemblyVersion>
<FileVersion>1.2.2</FileVersion>
<Version>1.3.0</Version>
<AssemblyVersion>1.3.0</AssemblyVersion>
<FileVersion>1.3.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -21,6 +21,8 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>


<ItemGroup>
<TrimmerRootAssembly Include="System.ComponentModel.EventBasedAsync" />
</ItemGroup>

</Project>
6 changes: 5 additions & 1 deletion HubitatPackageManagerTools/Options/ManifestAddAppOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ internal class ManifestAddAppOptions : ManifestOptionsBase
{
[Option(HelpText = "The URL of the app's Groovy file.", Required = true)]
public string Location { get; set; }
[Option(HelpText = "The version of the driver.")]
[Option(HelpText = "The URL of the app's beta Groovy file.")]
public string BetaLocation { get; set; }
[Option(HelpText = "The version of the app.")]
public string Version { get; set; }
[Option(HelpText = "The beta version of the app.")]
public string BetaVersion { get; set; }
[Option(HelpText = "Whether or not the app is required.")]
public bool? Required { get; set; }
[Option(HelpText = "Whether or not the app uses OAuth.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ internal class ManifestAddDriverOptions : ManifestOptionsBase
{
[Option(HelpText = "The URL of the driver's Groovy file.", Required = true)]
public string Location { get; set; }
[Option(HelpText = "The URL of the driver's beta Groovy file.")]
public string BetaLocation { get; set; }
[Option(HelpText = "The version of the driver.")]
public string Version { get; set; }
[Option(HelpText = "The beta version of the driver.")]
public string BetaVersion { get; set; }
[Option(HelpText = "Whether or not the driver is required.")]
public bool? Required { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ internal class ManifestModifyAppOptions : ManifestOptionsBase
public string Id { get; set; }
[Option(HelpText = "The URL of the app's Groovy file.", Group = "modify")]
public string Location { get; set; }
[Option(HelpText = "The version of the driver.", Group = "modify")]
[Option(HelpText = "The URL of the app's beta Groovy file.")]
public string BetaLocation { get; set; }
[Option(HelpText = "The version of the app.", Group = "modify")]
public string Version { get; set; }
[Option(HelpText = "The beta version of the app.")]
public string BetaVersion { get; set; }
[Option(HelpText = "Whether or not the app is required.", Group = "modify", Default = null)]
public bool? Required { get; set; }
[Option(HelpText = "Whether or not the app uses OAuth.", Group = "modify", Default = null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ internal class ManifestModifyDriverOptions : ManifestOptionsBase
public string Id { get; set; }
[Option(HelpText = "The URL of the driver's Groovy file.", Group = "modify")]
public string Location { get; set; }
[Option(HelpText = "The URL of the driver's beta Groovy file.")]
public string BetaLocation { get; set; }
[Option(HelpText = "The beta version of the driver.")]
public string BetaVersion { get; set; }
[Option(HelpText = "The version of the driver.", Group = "modify")]
public string Version { get; set; }
[Option(HelpText = "Whether or not the driver is required.", Group = "modify")]
Expand Down

0 comments on commit c518a17

Please sign in to comment.