Skip to content

Commit

Permalink
Do not run Hadoop yarn (fix r-darwish#378) (r-darwish#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-darwish authored Apr 3, 2020
1 parent 5230233 commit f103f59
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/steps/node.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![allow(unused_imports)]

use crate::error::SkipStep;
use crate::executor::{CommandExt, RunType};
use crate::terminal::print_separator;
use crate::utils::{require, PathExt};
use anyhow::Result;
use log::debug;

use directories::BaseDirs;
use std::path::PathBuf;
Expand Down Expand Up @@ -51,6 +53,12 @@ pub fn run_npm_upgrade(_base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
pub fn yarn_global_update(run_type: RunType) -> Result<()> {
let yarn = require("yarn")?;

let output = Command::new(&yarn).arg("version").check_output()?;
if output.contains("Hadoop") {
debug!("Yarn is Hadoop yarn");
return Err(SkipStep.into());
}

print_separator("Yarn");
run_type.execute(&yarn).args(&["global", "upgrade", "-s"]).check_run()
}
23 changes: 12 additions & 11 deletions src/steps/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,18 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {

debug!("oh-my-zsh custom dir: {}", custom_dir.display());

let mut custom_plugins = Repositories::new(ctx.git());
for entry in fs::read_dir(custom_dir)? {
let entry = entry?;
custom_plugins.insert_if_repo(entry.path());
}

custom_plugins.remove(&oh_my_zsh.to_string_lossy());

if !custom_plugins.is_empty() {
println!("Pulling custom plugins");
ctx.git().multi_pull(&custom_plugins, ctx)?;
if let Ok(custom_plugins_dir) = fs::read_dir(custom_dir) {
let mut custom_plugins = Repositories::new(ctx.git());

for entry in custom_plugins_dir {
let entry = entry?;
custom_plugins.insert_if_repo(entry.path());
}
custom_plugins.remove(&oh_my_zsh.to_string_lossy());
if !custom_plugins.is_empty() {
println!("Pulling custom plugins");
ctx.git().multi_pull(&custom_plugins, ctx)?;
}
}

ctx.run_type()
Expand Down

0 comments on commit f103f59

Please sign in to comment.