Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate runtime state for enable, disable, file delete + version bump #538

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ protected override async ValueTask ExecuteCommand()
var connection = await GetCurrentConnection();
var device = await GetCurrentDevice();

var state = await device.IsRuntimeEnabled(CancellationToken);

if (state == true)
{
Logger?.LogInformation($"{Strings.DisablingRuntime}...");
await device.RuntimeDisable(CancellationToken);
}

// get a list of files in the target folder
var folder = Path.GetDirectoryName(MeadowFile)!.Replace(Path.DirectorySeparatorChar, '/');
if (string.IsNullOrWhiteSpace(folder))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ protected override async ValueTask ExecuteCommand()

Logger?.LogInformation($"{Strings.DisablingRuntime}...");

await device.RuntimeDisable(CancellationToken);

var state = await device.IsRuntimeEnabled(CancellationToken);

Logger?.LogInformation($"Runtime is {(state ? "ENABLED" : "DISABLED")}");
if (state == false)
{
Logger?.LogInformation("Runtime already disabled");
}
else
{
await device.RuntimeDisable(CancellationToken);

state = await device.IsRuntimeEnabled(CancellationToken);

Logger?.LogInformation($"Runtime is {(state ? "ENABLED" : "DISABLED")}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ protected override async ValueTask ExecuteCommand()

Logger?.LogInformation($"{Strings.EnablingRuntime}...");

await device.RuntimeEnable(CancellationToken);

var state = await device.IsRuntimeEnabled(CancellationToken);

Logger?.LogInformation($"Runtime is {(state ? "ENABLED" : "DISABLED")}");
if (state == true)
{
Logger?.LogInformation("Runtime already enabled");
}
else
{
await device.RuntimeEnable(CancellationToken);

state = await device.IsRuntimeEnabled(CancellationToken);

Logger?.LogInformation($"Runtime is {(state ? "ENABLED" : "DISABLED")}");
}
}
}
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Authors>Wilderness Labs, Inc</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.29.0</PackageVersion>
<PackageVersion>2.0.30.0</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.CLI/</PackageProjectUrl>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.CLI</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ namespace Meadow.CLI;

public static class Constants
{
public const string CLI_VERSION = "2.0.29.0";
public const string CLI_VERSION = "2.0.30.0";
}
Loading