From f5aba15d35cd7fc639c9e0c8f5e221bb2a4341fb Mon Sep 17 00:00:00 2001 From: raychu86 Date: Fri, 28 Aug 2020 20:15:08 -0700 Subject: [PATCH] Update the remote convention in leo.toml --- leo/commands/publish.rs | 4 ++-- package/src/root/manifest.rs | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/leo/commands/publish.rs b/leo/commands/publish.rs index d102a6f3ec..cc81281cab 100644 --- a/leo/commands/publish.rs +++ b/leo/commands/publish.rs @@ -107,8 +107,8 @@ impl CLI for PublishCommand { zip_file.write(&path)?; let form_data = Form::new() - .text("name", package_name) - .text("remote", package_remote) + .text("name", package_name.clone()) + .text("remote", format!("{}/{}", package_remote.author, package_name)) .text("version", package_version) .file("file", zip_file.get_file_path(&path))?; diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 97e38997aa..7ba4b76016 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -26,13 +26,18 @@ use std::{ pub const MANIFEST_FILE_NAME: &str = "Leo.toml"; +#[derive(Clone, Deserialize)] +pub struct Remote { + pub author: String, +} + #[derive(Deserialize)] pub struct Package { pub name: String, pub version: String, pub description: Option, pub license: Option, - pub remote: Option, + pub remote: Option, } #[derive(Deserialize)] @@ -77,7 +82,7 @@ impl Manifest { self.package.license.clone() } - pub fn get_package_remote(&self) -> Option { + pub fn get_package_remote(&self) -> Option { self.package.remote.clone() } @@ -98,8 +103,10 @@ impl Manifest { name = "{name}" version = "0.1.0" description = "The {name} package" -remote = "[AUTHOR]/{name}" license = "MIT" + +[remote] +author = "[AUTHOR]" "#, name = self.package.name )