feat(garage_updates): an auto updater for garage apps
Asks Garage for the newest release of a project, downloads it with resume, checks the sha256, installs it beside the old one and restarts into it. Splash on garage_ui, a native stub and a first time installer for windows, bundle swap on mac, the system installer on android. No-op on web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KHotisA4hV2xmuZsHTksFX
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
444933b004
commit
d3b232f0ee
@@ -0,0 +1,36 @@
|
||||
// Not a flutter test, a plain dart program:
|
||||
//
|
||||
// dart run test/core_headless.dart
|
||||
//
|
||||
// It imports core and nothing else and runs on the standalone vm, which has
|
||||
// no dart:ui. If core ever picked up a flutter import this wouldnt compile.
|
||||
|
||||
import "dart:io";
|
||||
|
||||
import "package:garage_updates/core.dart";
|
||||
|
||||
Future<void> main() async {
|
||||
final engine = UpdateEngine.detect(project: "proj_headless", build: 1);
|
||||
|
||||
// `dart run` is the jit, so this is a dev copy and the engine must sit still
|
||||
if (engine.installed) {
|
||||
stderr.writeln("FAIL: a dart run was taken for an install");
|
||||
exit(1);
|
||||
}
|
||||
engine.reportIfNotInstalled();
|
||||
|
||||
final info = await engine.check();
|
||||
if (info.status != UpdateStatus.unknown) {
|
||||
stderr.writeln("FAIL: an engine with no install asked the server");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
final state = StateFile(File("${Directory.systemTemp.path}/garage_updates_headless_missing.json"));
|
||||
if (state.read() != null) {
|
||||
stderr.writeln("FAIL: a missing state file read as something");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
engine.close();
|
||||
print("core runs headless: supported=$kUpdatesSupported arch=${currentUpdateArch()} platform=${currentUpdatePlatform()}");
|
||||
}
|
||||
Reference in New Issue
Block a user