Add rust quick start

This commit is contained in:
Caelan Sayler
2024-02-26 14:35:40 +00:00
parent 40190504dd
commit d40eb92295
4 changed files with 61 additions and 49 deletions

View File

@@ -11,7 +11,7 @@
[![Codecov](https://img.shields.io/codecov/c/github/velopack/velopack?style=flat-square)](https://app.codecov.io/gh/velopack/velopack) [![Codecov](https://img.shields.io/codecov/c/github/velopack/velopack?style=flat-square)](https://app.codecov.io/gh/velopack/velopack)
[![License](https://img.shields.io/github/license/velopack/velopack?style=flat-square)](https://github.com/velopack/velopack/blob/develop/LICENSE) [![License](https://img.shields.io/github/license/velopack/velopack?style=flat-square)](https://github.com/velopack/velopack/blob/develop/LICENSE)
Velopack is an installation and auto-update framework for cross-platform .NET applications. It's opinionated, extremely easy to use with zero config needed. With just one command you can be up and running with an installable application, and it's lightning fast for your users, too. Velopack is an installation and auto-update framework for cross-platform applications. It's opinionated, extremely easy to use with zero config needed. With just one command you can be up and running with an installable application, and it's lightning fast for your users, too.
## Features ## Features
@@ -19,58 +19,14 @@ Velopack is an installation and auto-update framework for cross-platform .NET ap
- 🎯 **Cross platform** Velopack supports building packages for **Windows**, **OSX**, and **Linux**. No matter your target, Velopack can create a release in just one command. - 🎯 **Cross platform** Velopack supports building packages for **Windows**, **OSX**, and **Linux**. No matter your target, Velopack can create a release in just one command.
- 🚀 **Automatic migrations** - If you are coming from [Squirrel.Windows](https://github.com/Squirrel/Squirrel.Windows) or [Clowd.Squirrel](https://github.com/clowd/Clowd.Squirrel), Velopack will automatically migrate your application. Just build your Velopack release and deploy! [Read more.](https://velopack.io/docs/migrating.html) - 🚀 **Automatic migrations** - If you are coming from [Squirrel.Windows](https://github.com/Squirrel/Squirrel.Windows) or [Clowd.Squirrel](https://github.com/clowd/Clowd.Squirrel), Velopack will automatically migrate your application. Just build your Velopack release and deploy! [Read more.](https://velopack.io/docs/migrating.html)
- ⚡️ **Lightning fast** Velopack is written in Rust for native performance. Creating releases is multi-threaded, and produces delta packages for ultra fast app updates. Applying update packages is highly optimised, and often can be done in the background. - ⚡️ **Lightning fast** Velopack is written in Rust for native performance. Creating releases is multi-threaded, and produces delta packages for ultra fast app updates. Applying update packages is highly optimised, and often can be done in the background.
- 📔 **Language agnostic** - With support for C#, Rust, JS, and more. Use a familiar API for updates no matter what your project is written in. Check out [Velopack Fusion](https://github.com/velopack/velopack.fusion) for more info.
https://github.com/velopack/velopack/assets/1287295/0ff1bea7-15ed-42ae-8bdd-9519f1033432 https://github.com/velopack/velopack/assets/1287295/0ff1bea7-15ed-42ae-8bdd-9519f1033432
## Getting Started
This is a very simple example of the steps you would take to generate an installer and update packages for your application. Be sure to [read the documentation](https://velopack.io/docs/) for an overview of more features!
1. Install the command line tool `vpk`:
```cmd
dotnet tool update -g vpk
```
2. Install the [Velopack NuGet Package](https://www.nuget.org/packages/velopack) in your main project:
```cmd
dotnet add package Velopack
```
3. Configure your Velopack app at the beginning of `Program.Main`:
```cs
static void Main(string[] args)
{
VelopackApp.Build().Run();
// ... your other startup code below
}
```
4. Publish dotnet and build your first Velopack release! 🎉
```cmd
dotnet publish -c Release --self-contained -r win-x64 -o .\publish
vpk pack -u YourAppId -v 1.0.0 -p .\publish -e yourMainApp.exe
```
5. Add automatic updating to your app:
```cs
private static async Task UpdateMyApp()
{
var mgr = new UpdateManager("https://the.place/you-host/updates");
// check for new version
var newVersion = await mgr.CheckForUpdatesAsync();
if (newVersion == null)
return; // no update available
// download new version
await mgr.DownloadUpdatesAsync(newVersion);
// install new version and restart app
mgr.ApplyUpdatesAndRestart(newVersion);
}
```
If you're not sure how these instructions fit into your app, check the example apps for common scenarios such as WPF or Avalonia.
## Documentation ## Documentation
- 📖 [Read the docs](https://velopack.io/docs/) - [Quick start guides](https://velopack.io/docs/getting-started/csharp.html)
- 🕶️ [View example apps](examples) - 🕶️ [View example apps](examples)
- 📖 [Read the docs](https://velopack.io/docs/)
## Community ## Community
- ❓ Ask questions, get support, or discuss ideas on [our Discord server](https://discord.gg/CjrCrNzd3F) - ❓ Ask questions, get support, or discuss ideas on [our Discord server](https://discord.gg/CjrCrNzd3F)

View File

@@ -0,0 +1,53 @@
*Applies to: Windows, MacOS, Linux*
# Getting Started: Rust
1. Add Velopack to your `Cargo.toml`:
```toml
[dependencies]
velopack = { version = "0.0", features = ["async"] } # Replace with actual version and desired features
```
2. Add the following code to your `main()` function:
```rust
use velopack::*;
fn main() {
// VelopackApp should be the first thing to run
// In some circumstances it may terminate/restart the process to perform tasks.
VelopackApp::build().run();
// ... your other app startup code here
}
```
3. Add auto-updates somewhere to your app:
```rust
use velopack::*;
use anyhow::Result;
fn update_my_app() -> Result<()> {
let um = UpdateManager::new("https://the.place/you-host/updates", None)?;
let updates: Option<UpdateInfo> = um.check_for_updates()?;
if updates.is_none() {
return Ok(()); // no updates available
}
let updates = updates.unwrap();
um.download_updates(&updates, |progress| {
println!("Download progress: {}%", progress);
})?;
um.apply_updates_and_restart(&updates, RestartArgs::None)?;
Ok(())
}
```
4. Build your app with cargo:
```sh
cargo build --release
```
5. Package your Velopack release / installers:
```sh
vpk pack -u MyAppUniqueId -v 1.0.0 -p /target/release -e myexename.exe
```
✅ You're Done! Your app now has auto-updates and an installer.
You can upload your release to your website, or use the `vpk upload` command to publish it to the destination of your choice.

View File

@@ -1,5 +1,5 @@
# Documentation # Documentation
Velopack is an installation and auto-update framework for cross-platform .NET applications. It's opinionated, extremely easy to use with zero config needed. With just one command you can be up and running with an installable application, and it's lightning fast for your users, too. Velopack is an installation and auto-update framework for cross-platform desktop applications. It's opinionated, extremely easy to use with zero config needed. With just one command you can be up and running with an installable application, and it's lightning fast for your users, too.
Be sure to check us out on [GitHub](https://github.com/velopack/velopack) and [join our Discord](https://discord.gg/CjrCrNzd3F) for any questions/support! Be sure to check us out on [GitHub](https://github.com/velopack/velopack) and [join our Discord](https://discord.gg/CjrCrNzd3F) for any questions/support!

View File

@@ -7,6 +7,9 @@
- name: Quick - C# .NET - name: Quick - C# .NET
href: getting-started/csharp.md href: getting-started/csharp.md
- name: Quick - Rust
href: getting-started/rust.md
- name: Sample Apps - name: Sample Apps
items: items:
- name: C# Avalonia / Cross Platform - name: C# Avalonia / Cross Platform