搜尋套件、儲存庫與 APP 分類

套件詳情v1.3.4

release_updater

一種簡單的方法,可自動更新本機目錄中的發行/安裝檔案。

AndroidiOSmacOSWindowsLinux
近 30 天下載
4840
喜歡數
34
Pub 分數
160

安裝套件

flutter pub add release_updater

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

release_updater 是一個 Flutter/Dart 套件,可簡化在本機目錄中自動更新發行或安裝檔的過程。它讓開發者能透過從遠端來源取得並取代它們,來管理版本化的資源,例如應用程式二進位檔或設定檔。適用於需要頻繁更新卻無需完整重新安裝的應用程式,支援 Android、iOS、macOS、Windows 與 Linux 等多個平台。此套件透過減少手動檔案管理並確保跨環境的一致性,簡化部署工作流程。

適用情境

  • 自動化應用資源更新
  • 管理帶版本的安裝檔案
  • 將本機建構與遠端發行同步
  • 優化CI/CD流程
  • 部署後更新設定檔

主要特色

  • 自動檔案取代
  • 遠端來源整合
  • 跨平台支援
  • 簡單的 CLI 命令
  • 版本感知更新

適合對象

  • 開發人員管理頻繁的應用程式更新
  • 使用自動化部署工作流程的團隊
  • 具有分散式建構產物的專案
  • CI/CD 流水線整合
  • 需要本機檔案同步的應用程式

使用建議

  • 需要網路存取以進行更新
  • 遠端來源設定的手動設定
  • 僅限本機目錄更新
  • 不適用於執行時應用程式更新
  • 依賴外部檔案的可用性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

release_updater

pub package Null Safety Codecov Dart CI GitHub Tag New Commits Last Commits Pull Requests Code size License

This package brings a simple way to automatically update release/installation files in a local directory.

It also comes with built-in CLI tools to easily generate a release bundle (Zip file) or serve release files for multiple platforms.

Motivation

Since Dart can run in many native platforms (Linux/x64, macOS/x64/arm64, Windows/x86), it's not simple to manage all the different releases+platforms files that a compiled Dart application can have.

In the same way that modern Browsers, and many other applications, can have automatic builds and updates for multiple platforms, this package provides tools and an API to easily achieve that.

API Documentation

See the API Documentation for a full list of functions, classes and extension.

Usage

import 'dart:io';

import 'package:release_updater/release_updater_io.dart';

void main() async {
  var storage = ReleaseStorageDirectory('appx', Directory('/install/path'));
  
  var provider = ReleaseProviderHttp.baseURL('https://your.domain/appx/releases');

  var releaseUpdater = ReleaseUpdater(storage, provider);

  var version = await releaseUpdater.update();

  print('»  Updated to version: $version');

  var runResult = await releaseUpdater.runReleaseProcess('run.exe', ['-a']);

  var exitCode = runResult!.exitCode;
  
  print('»  Exit code: $exitCode');
  print('»  Result: ${runResult.stdout}');

  exit(exitCode);
}

ReleaseProvider

You can implement your own ReleaseProvider or use just the built-in ReleaseProviderHttp class.

CLI Tools

  • release_updater: A CLI updater.

  • release_updater_server: A simple HTTP server to provide releases using the shelf package.

release_updater

The release_updater is a CLI for the ReleaseUpdater class.

To build a release:

$> release_packer release_packer.json build ./source-dir ./releases-dir -Pupload-url=http://your-server:8090/ -Pupload-user=userx -Pupload-pass=pass123
  • The -P arguments are properties to the JSON configuration file (see %UPLOAD_URL% below).

Example of a release_packer.json file:

{
  "name": "appx",
  "version_from": "pubspec.yaml",
  "prepare": [
    "dart_pub_get",
    {"dart_compile_exe": "bin/foo.dart"},
    {"windows_gui": "bin/foo.exe"}
  ],
  "finalize": [
    {"rm": "bin/foo.exe"},
    {
      "upload_release": {
        "url": "%UPLOAD_URL%",
        "authorization": {
          "user": "%UPLOAD_USER%",
          "pass": "%UPLOAD_PASS%"
        }
      }
    }
  ],
  "files": [
    "README.md",
    {"hello.txt": "hello-world.txt"},
    {"bin/foo.exe": "."},
    {"libfoo-arm64.dylib": ".", "platform":  "^macos-arm64$"},
    {"libfoo-x64.dylib": ".", "platform":  "^macos-x64$"},
    {"libfoo.so": ".", "platform":  "^linux.*$"},
    {"libfoo.dll": ".", "platform":  "^windows.*$"}
  ]
}
JSON Format:
  • name: the application name, for the Release name.

  • version: the version of the Release.

  • version_from: the JSON or YAML file to provide the field version (if the parameter field is not provided).

  • platform: is a RegExp string to match the building platform. See the ReleasePlatform class.

  • Command types:

    • dart_pub_get: performs a dart pub get.
    • dart_compile_exe: performs a dart compile exe %dart_script.
    • dart: performs a dart %command.
    • windows_gui: Changes an executable Windows Subsistem to GUI.
    • command: performs a shell %command.
    • rm: Deletes a file.
    • upload_release: uploads the generated release.
      • url: release server base URL.
      • authorization: HTTP basic authorization.
        • username: authentication username.
        • password: authentication password.
  • Command errors:

    • A command that fails aborts the build: the error is logged, the remaining commands are NOT executed, and the release_packer CLI exits with code 1. This avoids a silent error generating and releasing an incomplete package/artifact.
    • Some commands are just ignored (skipped) when not applicable, and do NOT abort the build:
      • rm of a file that doesn't exist.
      • windows_gui over a file that is not a Windows executable (the usual case when building on another platform).
  • files: each entry of files can be:

    • A String with a file path:
      "file/path.txt"
      
    • A Map with extra parameters:
      • A file with a renamed path and a specific platform.
        {"source/file/path.txt": "release/file/path", "platform": "^regexp"}
        
      • A file without rename it:
        {"source/file/path.txt": "."}
        
      • A directory tree:
        {"lib/resources/": "packages/pack_name/resources/"}
        
      • A file from a dart_compile_exe command:
        {"bin/client.exe": "client.exe", "dart_compile_exe": "bin/client.dart"}
        
      • A Windows executable file with the Windows Subsistem set to GUI:
        {"bin/client.exe": "client.exe", "windows_gui": true}
        
release_updater_server

To serve a release directory:

$> release_updater_server releases-server-config.json

Config file:

{
  "releases-directory": "/path/to/releases",
  "port": 8090,
  "address": "0.0.0.0",
  "upload-user": "userx",
  "upload-pass": "123456"
}
  • If the properties upload-user and upload-pass (with length >= 6) are defined, upload of files will be allowed.
    • All files are saved in the releases-directory without any sub-directory.
    • Upload errors can block an IP for 30min.
  • A high volume of requests can block an IP for 2min.

Source

The official source code is hosted @ GitHub:

  • https://github.com/gmpassos/release_updater

Features and bugs

Please file feature requests and bugs at the issue tracker.

Contribution

Any help from the open-source community is always welcome and needed:

  • Found an issue?
    • Please fill a bug report with details.
  • Wish a feature?
    • Open a feature request with use cases.
  • Are you using and liking the project?
    • Promote the project: create an article, do a post or make a donation.
  • Are you a developer?
    • Fix a bug and send a pull request.
    • Implement a new feature, like other training algorithms and activation functions.
    • Improve the Unit Tests.
  • Have you already helped in any way?
    • Many thanks from me, the contributors and everybody that uses this project!

If you donate 1 hour of your time, you can contribute a lot, because others will do the same, just be part and start with your 1 hour.

Author

Graciliano M. Passos: gmpassos@GitHub.

License

Apache License - Version 2.0

所屬分類

依賴

依賴清單 15 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。