From 53454c8f67c6c458777b2b5b40e42bc85039168c Mon Sep 17 00:00:00 2001 From: fang duan Date: Fri, 14 Jul 2023 23:45:48 +0800 Subject: [PATCH] add envs for rtx ruby core plugin (#682) --- src/env.rs | 8 ++++++++ src/plugins/core/ruby.rs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/env.rs b/src/env.rs index d558ec76d0..26dc353b7b 100644 --- a/src/env.rs +++ b/src/env.rs @@ -149,6 +149,14 @@ pub static NVM_DIR: Lazy = pub static NODENV_ROOT: Lazy = Lazy::new(|| var_path("NODENV_ROOT").unwrap_or_else(|| HOME.join(".nodenv"))); +// ruby +pub static RTX_RUBY_BUILD_REPO: Lazy = Lazy::new(|| { + var("RTX_RUBY_BUILD_REPO").unwrap_or_else(|_| "https://github.com/rbenv/ruby-build.git".into()) +}); +pub static RTX_RUBY_INSTALL_REPO: Lazy = Lazy::new(|| { + var("RTX_RUBY_INSTALL_REPO") + .unwrap_or_else(|_| "https://github.com/postmodern/ruby-install.git".into()) +}); pub static RTX_RUBY_INSTALL: Lazy = Lazy::new(|| var_is_true("RTX_RUBY_INSTALL")); pub static RTX_RUBY_APPLY_PATCHES: Lazy> = Lazy::new(|| var("RTX_RUBY_APPLY_PATCHES").ok()); diff --git a/src/plugins/core/ruby.rs b/src/plugins/core/ruby.rs index d6a326186d..2e6302c94b 100644 --- a/src/plugins/core/ruby.rs +++ b/src/plugins/core/ruby.rs @@ -74,7 +74,7 @@ impl RubyPlugin { file::remove_all(&tmp)?; file::create_dir_all(tmp.parent().unwrap())?; let git = Git::new(tmp.clone()); - git.clone("https://github.com/rbenv/ruby-build.git")?; + git.clone(&env::RTX_RUBY_BUILD_REPO)?; cmd!("sh", "install.sh") .env("PREFIX", self.ruby_build_path()) @@ -108,7 +108,7 @@ impl RubyPlugin { file::remove_all(&tmp)?; file::create_dir_all(tmp.parent().unwrap())?; let git = Git::new(tmp.clone()); - git.clone("https://github.com/postmodern/ruby-install")?; + git.clone(&env::RTX_RUBY_INSTALL_REPO)?; cmd!("make", "install") .env("PREFIX", self.ruby_install_path())