Struct self_github_update::backends::github::UpdateBuilder
source · pub struct UpdateBuilder { /* private fields */ }
Expand description
github::Update
builder
Configure download and installation from
https://api.github.com/repos/<repo_owner>/<repo_name>/releases/latest
Implementations§
source§impl UpdateBuilder
impl UpdateBuilder
sourcepub fn repo_owner(&mut self, owner: &str) -> &mut Self
pub fn repo_owner(&mut self, owner: &str) -> &mut Self
Set the repo owner, used to build a github api url
sourcepub fn repo_name(&mut self, name: &str) -> &mut Self
pub fn repo_name(&mut self, name: &str) -> &mut Self
Set the repo name, used to build a github api url
sourcepub fn with_url(&mut self, url: &str) -> &mut Self
pub fn with_url(&mut self, url: &str) -> &mut Self
Set the optional github url, e.g. for a github enterprise installation.
The url should provide the path to your API endpoint and end without a trailing slash,
for example https://api.github.com
or https://github.mycorp.com/api/v3
sourcepub fn current_version(&mut self, ver: &str) -> &mut Self
pub fn current_version(&mut self, ver: &str) -> &mut Self
Set the current app version, used to compare against the latest available version.
The cargo_crate_version!
macro can be used to pull the version from your Cargo.toml
sourcepub fn target_version_tag(&mut self, ver: &str) -> &mut Self
pub fn target_version_tag(&mut self, ver: &str) -> &mut Self
Set the target version tag to update to. This will be used to search for a release
by tag name:
/repos/:owner/:repo/releases/tags/:tag
If not specified, the latest available release is used.
sourcepub fn target(&mut self, target: &str) -> &mut Self
pub fn target(&mut self, target: &str) -> &mut Self
Set the target triple that will be downloaded, e.g. x86_64-unknown-linux-gnu
.
If unspecified, the build target of the crate will be used
sourcepub fn identifier(&mut self, identifier: &str) -> &mut Self
pub fn identifier(&mut self, identifier: &str) -> &mut Self
Set the identifiable token for the asset in case of multiple compatible assets
If unspecified, the first asset matching the target will be chosen
sourcepub fn bin_name(&mut self, name: &str) -> &mut Self
pub fn bin_name(&mut self, name: &str) -> &mut Self
Set the exe’s name. Also sets bin_path_in_archive
if it hasn’t already been set.
This method will append the platform specific executable file suffix
(see std::env::consts::EXE_SUFFIX
) to the name if it’s missing.
sourcepub fn bin_install_path<A: AsRef<Path>>(
&mut self,
bin_install_path: A
) -> &mut Self
pub fn bin_install_path<A: AsRef<Path>>( &mut self, bin_install_path: A ) -> &mut Self
Set the installation path for the new exe, defaults to the current executable’s path
sourcepub fn bin_path_in_archive(&mut self, bin_path: &str) -> &mut Self
pub fn bin_path_in_archive(&mut self, bin_path: &str) -> &mut Self
Set the path of the exe inside the release tarball. This is the location
of the executable relative to the base of the tar’d directory and is the
path that will be copied to the bin_install_path
. If not specified, this
will default to the value of bin_name
. This only needs to be specified if
the path to the binary (from the root of the tarball) is not equal to just
the bin_name
.
§Example
For a tarball myapp.tar.gz
with the contents:
myapp.tar/
|------- bin/
| |--- myapp # <-- executable
The path provided should be:
Update::configure()
.bin_path_in_archive("bin/myapp")
sourcepub fn show_download_progress(&mut self, show: bool) -> &mut Self
pub fn show_download_progress(&mut self, show: bool) -> &mut Self
Toggle download progress bar, defaults to off
.
sourcepub fn set_progress_style(
&mut self,
progress_template: String,
progress_chars: String
) -> &mut Self
pub fn set_progress_style( &mut self, progress_template: String, progress_chars: String ) -> &mut Self
Set download progress style.
sourcepub fn show_output(&mut self, show: bool) -> &mut Self
pub fn show_output(&mut self, show: bool) -> &mut Self
Toggle update output information, defaults to true
.
sourcepub fn no_confirm(&mut self, no_confirm: bool) -> &mut Self
pub fn no_confirm(&mut self, no_confirm: bool) -> &mut Self
Toggle download confirmation. Defaults to false
.
sourcepub fn auth_token(&mut self, auth_token: &str) -> &mut Self
pub fn auth_token(&mut self, auth_token: &str) -> &mut Self
Set the authorization token, used in requests to the github api url
This is to support private repos where you need a GitHub auth token. Make sure not to bake the token into your app; it is recommended you obtain it via another mechanism, such as environment variables or prompting the user for input
sourcepub fn build(&self) -> Result<Box<dyn ReleaseUpdate>>
pub fn build(&self) -> Result<Box<dyn ReleaseUpdate>>
Confirm config and create a ready-to-use Update
- Errors:
- Config - Invalid
Update
configuration
- Config - Invalid