[📦 NEW] go get -u all (#262)

This commit is contained in:
Andrei Pavel
2019-11-20 14:41:05 +02:00
committed by Roey Darwish Dror
parent 4b495629c8
commit e5f7c74c84
3 changed files with 22 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ pub enum Step {
Rustup, Rustup,
Cargo, Cargo,
Flutter, Flutter,
Go,
Shell, Shell,
Opam, Opam,
Vcpkg, Vcpkg,

View File

@@ -355,6 +355,15 @@ fn run() -> Result<(), Error> {
)?; )?;
} }
if config.should_run(Step::Go) {
execute(
&mut report,
"Go",
|| generic::run_go(&base_dirs, run_type),
config.no_retry(),
)?;
}
if config.should_run(Step::Emacs) { if config.should_run(Step::Emacs) {
execute(&mut report, "Emacs", || emacs.upgrade(run_type), config.no_retry())?; execute(&mut report, "Emacs", || emacs.upgrade(run_type), config.no_retry())?;
} }

View File

@@ -4,6 +4,7 @@ use crate::terminal::{print_separator, shell};
use crate::utils::{self, PathExt}; use crate::utils::{self, PathExt};
use directories::BaseDirs; use directories::BaseDirs;
use failure::ResultExt; use failure::ResultExt;
use std::env;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
@@ -20,11 +21,21 @@ pub fn run_cargo_update(run_type: RunType) -> Result<(), Error> {
pub fn run_flutter_upgrade(run_type: RunType) -> Result<(), Error> { pub fn run_flutter_upgrade(run_type: RunType) -> Result<(), Error> {
let flutter = utils::require("flutter")?; let flutter = utils::require("flutter")?;
print_separator("Flutter");
print_separator("Flutter");
run_type.execute(&flutter).arg("upgrade").check_run() run_type.execute(&flutter).arg("upgrade").check_run()
} }
pub fn run_go(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> {
let go = utils::require("go")?;
env::var("GOPATH")
.unwrap_or_else(|_| base_dirs.home_dir().join("go").to_str().unwrap().to_string())
.require()?;
print_separator("Go");
run_type.execute(&go).arg("get").arg("-u").arg("all").check_run()
}
pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> {
let gem = utils::require("gem")?; let gem = utils::require("gem")?;
base_dirs.home_dir().join(".gem").require()?; base_dirs.home_dir().join(".gem").require()?;