Skip to content

Commit

Permalink
feat: introduce devnet and remove preview reserved channel (#609)
Browse files Browse the repository at this point in the history
* feat: introduce devnet and remove preview alias

* fmt
  • Loading branch information
kayagokalp authored May 14, 2024
1 parent ffa9b72 commit a22000e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/channel.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
constants::{
CHANNEL_BETA_1_FILE_NAME, CHANNEL_BETA_2_FILE_NAME, CHANNEL_BETA_3_FILE_NAME,
CHANNEL_BETA_4_FILE_NAME, CHANNEL_BETA_5_FILE_NAME, CHANNEL_LATEST_FILE_NAME,
CHANNEL_NIGHTLY_FILE_NAME, CHANNEL_PREVIEW_FILE_NAME, DATE_FORMAT_URL_FRIENDLY,
CHANNEL_BETA_4_FILE_NAME, CHANNEL_BETA_5_FILE_NAME, CHANNEL_DEVNET_FILE_NAME,
CHANNEL_LATEST_FILE_NAME, CHANNEL_NIGHTLY_FILE_NAME, DATE_FORMAT_URL_FRIENDLY,
FUELUP_GH_PAGES,
},
download::{download, DownloadCfg},
Expand All @@ -24,10 +24,10 @@ pub const BETA_2: &str = "beta-2";
pub const BETA_3: &str = "beta-3";
pub const BETA_4: &str = "beta-4";
pub const BETA_5: &str = "beta-5";
pub const PREVIEW: &str = "preview";
pub const DEVNET: &str = "devnet";
pub const NIGHTLY: &str = "nightly";
pub const CHANNELS: [&str; 8] = [
LATEST, NIGHTLY, BETA_1, BETA_2, BETA_3, BETA_4, BETA_5, PREVIEW,
LATEST, NIGHTLY, BETA_1, BETA_2, BETA_3, BETA_4, BETA_5, DEVNET,
];

#[derive(Debug, Deserialize, Serialize)]
Expand All @@ -54,7 +54,7 @@ pub fn is_beta_toolchain(name: &str) -> bool {
|| name == BETA_3
|| name == BETA_4
|| name == BETA_5
|| name == PREVIEW
|| name == DEVNET
}

fn format_nightly_url(date: &Date) -> Result<String> {
Expand Down Expand Up @@ -87,7 +87,7 @@ fn construct_channel_url(desc: &DistToolchainDescription) -> Result<String> {
DistToolchainName::Beta3 => url.push_str(CHANNEL_BETA_3_FILE_NAME),
DistToolchainName::Beta4 => url.push_str(CHANNEL_BETA_4_FILE_NAME),
DistToolchainName::Beta5 => url.push_str(CHANNEL_BETA_5_FILE_NAME),
DistToolchainName::Preview => url.push_str(CHANNEL_PREVIEW_FILE_NAME),
DistToolchainName::Devnet => url.push_str(CHANNEL_DEVNET_FILE_NAME),
};

Ok(url)
Expand Down
2 changes: 1 addition & 1 deletion src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub const CHANNEL_BETA_2_FILE_NAME: &str = "channel-fuel-beta-2.toml";
pub const CHANNEL_BETA_3_FILE_NAME: &str = "channel-fuel-beta-3.toml";
pub const CHANNEL_BETA_4_FILE_NAME: &str = "channel-fuel-beta-4.toml";
pub const CHANNEL_BETA_5_FILE_NAME: &str = "channel-fuel-beta-5.toml";
pub const CHANNEL_PREVIEW_FILE_NAME: &str = "channel-fuel-preview.toml";
pub const CHANNEL_DEVNET_FILE_NAME: &str = "channel-fuel-devnet.toml";

pub const DATE_FORMAT: &[FormatItem] = format_description!("[year]-[month]-[day]");
pub const DATE_FORMAT_URL_FRIENDLY: &[FormatItem] = format_description!("[year]/[month]/[day]");
8 changes: 4 additions & 4 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub const RESERVED_TOOLCHAIN_NAMES: &[&str] = &[
channel::BETA_4,
channel::BETA_5,
channel::NIGHTLY,
channel::PREVIEW,
channel::DEVNET,
// Stable is reserved, although currently unused.
channel::STABLE,
];
Expand All @@ -42,7 +42,7 @@ pub enum DistToolchainName {
Beta5,
Latest,
Nightly,
Preview,
Devnet,
}

impl fmt::Display for DistToolchainName {
Expand All @@ -55,7 +55,7 @@ impl fmt::Display for DistToolchainName {
DistToolchainName::Beta3 => write!(f, "{}", channel::BETA_3),
DistToolchainName::Beta4 => write!(f, "{}", channel::BETA_4),
DistToolchainName::Beta5 => write!(f, "{}", channel::BETA_5),
DistToolchainName::Preview => write!(f, "{}", channel::PREVIEW),
DistToolchainName::Devnet => write!(f, "{}", channel::DEVNET),
}
}
}
Expand All @@ -71,7 +71,7 @@ impl FromStr for DistToolchainName {
channel::BETA_3 => Ok(Self::Beta3),
channel::BETA_4 => Ok(Self::Beta4),
channel::BETA_5 => Ok(Self::Beta5),
channel::PREVIEW => Ok(Self::Preview),
channel::DEVNET => Ok(Self::Devnet),
_ => bail!("Unknown name for toolchain: {}", s),
}
}
Expand Down

0 comments on commit a22000e

Please sign in to comment.