Funnel everything through `PBAR.info`

master
Alex Crichton 6 years ago
parent bcbfc4fc86
commit 90055c682f
  1. 2
      src/bindgen.rs
  2. 4
      src/build.rs
  3. 4
      src/command/build.rs
  4. 2
      src/command/login.rs
  5. 2
      src/command/pack.rs
  6. 2
      src/command/publish/mod.rs
  7. 13
      src/progressbar.rs
  8. 2
      src/test/webdriver.rs

@ -40,7 +40,7 @@ pub fn install_wasm_bindgen(
} }
let msg = format!("{}Installing wasm-bindgen...", emoji::DOWN_ARROW); let msg = format!("{}Installing wasm-bindgen...", emoji::DOWN_ARROW);
PBAR.step(&msg); PBAR.info(&msg);
let dl = download_prebuilt_wasm_bindgen(&cache, version, install_permitted); let dl = download_prebuilt_wasm_bindgen(&cache, version, install_permitted);
match dl { match dl {

@ -63,7 +63,7 @@ pub fn rustup_add_wasm_target() -> Result<(), Error> {
// ... otherwise fall back to rustup to add the target // ... otherwise fall back to rustup to add the target
let msg = format!("{}Adding Wasm target...", emoji::TARGET); let msg = format!("{}Adding Wasm target...", emoji::TARGET);
PBAR.step(&msg); PBAR.info(&msg);
let mut cmd = Command::new("rustup"); let mut cmd = Command::new("rustup");
cmd.arg("target").arg("add").arg("wasm32-unknown-unknown"); cmd.arg("target").arg("add").arg("wasm32-unknown-unknown");
child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?; child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?;
@ -77,7 +77,7 @@ pub fn cargo_build_wasm(
extra_options: &Vec<String>, extra_options: &Vec<String>,
) -> Result<(), Error> { ) -> Result<(), Error> {
let msg = format!("{}Compiling to Wasm...", emoji::CYCLONE); let msg = format!("{}Compiling to Wasm...", emoji::CYCLONE);
PBAR.step(&msg); PBAR.info(&msg);
let mut cmd = Command::new("cargo"); let mut cmd = Command::new("cargo");
cmd.current_dir(path).arg("build").arg("--lib"); cmd.current_dir(path).arg("build").arg("--lib");
match profile { match profile {

@ -238,9 +238,9 @@ impl Build {
self.out_dir.display() self.out_dir.display()
); );
PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); PBAR.info(&format!("{} Done in {}", emoji::SPARKLE, &duration));
PBAR.message(&format!( PBAR.info(&format!(
"{} Your wasm pkg is ready to publish at {}.", "{} Your wasm pkg is ready to publish at {}.",
emoji::PACKAGE, emoji::PACKAGE,
self.out_dir.display() self.out_dir.display()

@ -20,6 +20,6 @@ pub fn login(
npm::npm_login(&registry, &scope, always_auth, &auth_type)?; npm::npm_login(&registry, &scope, always_auth, &auth_type)?;
info!("Logged you in!"); info!("Logged you in!");
PBAR.message(&"👋 logged you in!".to_string()); PBAR.info(&"👋 logged you in!".to_string());
Ok(()) Ok(())
} }

@ -22,6 +22,6 @@ pub fn pack(path: Option<PathBuf>) -> result::Result<(), Error> {
npm::npm_pack(&pkg_directory.to_string_lossy())?; npm::npm_pack(&pkg_directory.to_string_lossy())?;
info!("Your package is located at {:#?}", crate_path.join("pkg")); info!("Your package is located at {:#?}", crate_path.join("pkg"));
PBAR.message("🎒 packed up your package!"); PBAR.info("🎒 packed up your package!");
Ok(()) Ok(())
} }

@ -77,6 +77,6 @@ pub fn publish(
npm::npm_publish(&pkg_directory.to_string_lossy(), access)?; npm::npm_publish(&pkg_directory.to_string_lossy(), access)?;
info!("Published your package!"); info!("Published your package!");
PBAR.message("💥 published your package!"); PBAR.info("💥 published your package!");
Ok(()) Ok(())
} }

@ -7,24 +7,17 @@ use emoji;
pub struct ProgressOutput; pub struct ProgressOutput;
impl ProgressOutput { impl ProgressOutput {
/// Inform the user that the given `step` is being executed, with details in
/// `message`.
pub fn step(&self, message: &str) {
self.info(message);
}
/// Print the given message. /// Print the given message.
pub fn message(&self, message: &str) { fn message(&self, message: &str) {
eprintln!("{}", message); eprintln!("{}", message);
} }
/// Add an informational message. /// Add an informational message.
pub fn info(&self, message: &str) { pub fn info(&self, message: &str) {
let info = format!( let info = format!(
"{} {}: {}", "{}: {}",
emoji::INFO,
style("[INFO]").bold().dim(), style("[INFO]").bold().dim(),
message message,
); );
self.message(&info); self.message(&info);
} }

@ -17,7 +17,7 @@ fn get_and_notify(
return Ok(Some(dl.binary(name)?)); return Ok(Some(dl.binary(name)?));
} }
if installation_allowed { if installation_allowed {
PBAR.step(&format!("Getting {}...", name)); PBAR.info(&format!("Getting {}...", name));
} }
match cache.download(installation_allowed, name, &[name], &url)? { match cache.download(installation_allowed, name, &[name], &url)? {
Some(dl) => Ok(Some(dl.binary(name)?)), Some(dl) => Ok(Some(dl.binary(name)?)),

Loading…
Cancel
Save