cupboard-project / cupboard Goto Github PK
View Code? Open in Web Editor NEWA framework for provisioning local environments to a desired state, using the .NET SDK.
License: MIT License
A framework for provisioning local environments to a desired state, using the .NET SDK.
License: MIT License
Create provider to install dotnet global tools
The cached output does not make sense when listing a specific package in GetPackageState
Basically the provider thinks only the first chocolatey package is installed.
We can either drop the cache or use a dictionary of some sort.
Dropping the cache means fixing it so that the vscode package provider perhaps list a specific extension.
I can work on a fix, I just need to hear what you would want as an solution :)
Hello,
I've gone over the code and demo an i understand that in current state it does not support MacOs or Linux. Do you believe it should be included. If so when is it planed. Will you accept help with that?
Thank you
Think it would be useful to have a power scheme provider
we can either use P/Invoke
directly or call powercfg.exe
and parse the output.
Here is an example of P/Invoke for powrprof
I am already doing something in PowerShell (see below) but I want to be sure that state has not changed:
# Select Performance power scheme
$powerlist = powercfg /l
$performancePowerGuid =
$powerlist `
| Select-String -Pattern "Power Scheme GUID: ([a-z0-9\-]+).+performance" `
| Select-Object -First 1 | ForEach-Object {"$($_.matches.groups[1])"}
powercfg /setactive $performancePowerGuid
#Turn Off the display
Powercfg /Change monitor-timeout-ac 0
Powercfg /Change monitor-timeout-dc 0
Powercfg /Change standby-timeout-ac 0
Powercfg /Change standby-timeout-dc 0
Powercfg /Change disk-timeout-ac 0
Powercfg /Change disk-timeout-dc 0
Powercfg /Change hibernate-timeout-ac 0
Powercfg /Change hibernate-timeout-dc 0
# Disable battery saver
powercfg /setdcvalueindex SCHEME_CURRENT SUB_ENERGYSAVER ESBATTTHRESHOLD 0
powercfg /setdcvalueindex SCHEME_CURRENT SUB_ENERGYSAVER ESBRIGHTNESS 100
# Disable Hibernate
Powercfg /hibernate off
Add support for Windows Firewall rules. Maybe based on the Windows Firewall Helper.
Rationale
Many application need to access resources over the network, like databases, Web- or E-Mail servers, and network folders. The application should be able to set the neccesary windows firewall rules itself - given the windows firewall is enabled. The rules should not apply on linux systems.
Some packages have package-parameters
to further drive what they do.
Add support for including these.
At the moment CupboardFixture does not have a way to add more dependencies.
I can of course copy my own cupboard fixture, but would be nice if it was possible to extend.
like:
--force
- Skip checksum check--version
Install a specified version of the packageInspired by #21
Running as sudo in Linux shouldn't be required.
Using the example to create a MVP i get
Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Cupboard.Internal.WmiFacts.GetFacts(IRemainingArguments args)+MoveNext()
at Cupboard.Internal.FactBuilder.Build(IRemainingArguments args) in /_/src/Cupboard/Internal/FactBuilder.cs:line 20
at Cupboard.Internal.ExecutionEngine.Run(IRemainingArguments args, IStatusUpdater status, Boolean dryRun) in /_/src/Cupboard/Internal/ExecutionEngine.cs:line 33
at Cupboard.Internal.RunCommand.Run(CommandContext context, Settings settings) in /_/src/Cupboard/Internal/Cli/RunCommand.cs:line 135
at Cupboard.Internal.RunCommand.Execute(CommandContext context, Settings settings) in /_/src/Cupboard/Internal/Cli/RunCommand.cs:line 105
at Spectre.Console.Cli.Command`1.Spectre.Console.Cli.ICommand.Execute(CommandContext context, CommandSettings settings) in /_/src/Spectre.Console/Cli/CommandOfT.cs:line 44
at Spectre.Console.Cli.CommandExecutor.Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) in /_/src/Spectre.Console/Cli/Internal/CommandExecutor.cs:line 115
at Spectre.Console.Cli.CommandExecutor.Execute(IConfiguration configuration, IEnumerable`1 args) in /_/src/Spectre.Console/Cli/Internal/CommandExecutor.cs:line 84
at Spectre.Console.Cli.CommandApp.RunAsync(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandApp.cs:line 87
at Spectre.Console.Cli.CommandApp.Run(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandApp.cs:line 61
at Spectre.Console.Cli.CommandApp`1.Run(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandAppOfT.cs:line 42
at Cupboard.CupboardHost.Run(String[] args) in /_/src/Cupboard/CupboardHost.cs:line 30
I am running this on Windows. I've attached my csproj & 3 classes as they are tiny.
MachineSetup.zip
How it could look like:
Set execution policy? [y/n]: y
....
....
Install Chocolatey? [y/n]: y
....
....
Install VS Code? [y/n]: n
Skipping "Install VS Code"
Add support for:
--prerelease
(i like to be bold on some packages)--ignore-checksum
(the chrome package is notorious for a bad checksun)--package-parameters
(some packages like the visual studio & sql server packages require some extra parameters)In addition to chocolatey, Scoop is another popular option to install windows applications.
Enable Discussions so that we can ask questions
@patriksvensson I was exploring the last native dependency: Mono.Posix.NETStandard, I tried removing it and I could still build the project.
is there any reason for it?
elo ๐
I've stepped into some compiler errors while following the README and implementing the Chocolatey
example.
If you say that I'm not missing anything and they can be fixed, I'd be more than happy to open a PR.
The Chocolatey
sealed class is missing a closing curly bracket at the very end.
OSPlatform
The IF
statement inside the MyWindowsComputer
catalog example, is showing the error Cannot apply operator '!=' to operands of type 'Cupboard.Fact' and 'System.Runtime.InteropServices.OSPlatform'
.
To fix it I have to access the Value
property and cast it to OSPlatform
:
if ((OSPlatform)context.Facts["os.platform"].Value != OSPlatform.Windows)
{
return;
}
Build
functionI can't use the Run(string[] args)
function after the AddCatalog<MyWindowsComputer>()
one, during the CupboardHost builder creation.
To fix it, I have to call Build()
and then Run(args)
:
return CupboardHost.CreateBuilder()
.AddCatalog<MyWindowsComputer>()
.Build()
.Run(args);
I think it would be more useful to see the execution plan as a tree instead of a table.
We should probably remove net5.0 support in favor of net6.0 LTS.
This will also allow us to use new language features and make the code a bit neater.
@jetersen Any objections to this?
When a chocolatey package requires a reboot have the option to let the reboot happen and then resume the setup process post reboot.
There are some registry related things that depend on only having the key.
ie. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Network\NewNetworkWindowOff
Currently this is not possible:
context.Resource<RegistryValue>("Disable New Network Popup")
.Path(@"HKLM:\System\CurrentControlSet\Control\Network\NewNetworkWindowOff")
.Ensure(RegistryKeyState.Exist);
As value is checked before making sure the path exist:
RegistryKeyProvider is marked obsolete and yet also checks for value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.