aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/install.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-05 08:51:32 +0000
committerAleksey Kladov <[email protected]>2021-03-05 08:51:32 +0000
commit142f9a03fd4bad366439b18d8de7f2237bed65ab (patch)
treed57e4695c79e7485a1295adac9a2aafa20e9a3df /xtask/src/install.rs
parent97b1550ddaf9599dada343aa960de02f0a06de2e (diff)
Cleanup install command
Diffstat (limited to 'xtask/src/install.rs')
-rw-r--r--xtask/src/install.rs33
1 files changed, 15 insertions, 18 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index ea2194248..3e8fbe0a6 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -5,12 +5,24 @@ use std::{env, path::PathBuf, str};
5use anyhow::{bail, format_err, Context, Result}; 5use anyhow::{bail, format_err, Context, Result};
6use xshell::{cmd, pushd}; 6use xshell::{cmd, pushd};
7 7
8use crate::flags;
9
8// Latest stable, feel free to send a PR if this lags behind. 10// Latest stable, feel free to send a PR if this lags behind.
9const REQUIRED_RUST_VERSION: u32 = 50; 11const REQUIRED_RUST_VERSION: u32 = 50;
10 12
11pub(crate) struct InstallCmd { 13impl flags::Install {
12 pub(crate) client: Option<ClientOpt>, 14 pub(crate) fn run(self) -> Result<()> {
13 pub(crate) server: Option<ServerOpt>, 15 if cfg!(target_os = "macos") {
16 fix_path_for_mac().context("Fix path for mac")?
17 }
18 if let Some(server) = self.server() {
19 install_server(server).context("install server")?;
20 }
21 if let Some(client) = self.client() {
22 install_client(client).context("install client")?;
23 }
24 Ok(())
25 }
14} 26}
15 27
16#[derive(Clone, Copy)] 28#[derive(Clone, Copy)]
@@ -70,21 +82,6 @@ pub(crate) enum Malloc {
70 Jemalloc, 82 Jemalloc,
71} 83}
72 84
73impl InstallCmd {
74 pub(crate) fn run(self) -> Result<()> {
75 if cfg!(target_os = "macos") {
76 fix_path_for_mac().context("Fix path for mac")?
77 }
78 if let Some(server) = self.server {
79 install_server(server).context("install server")?;
80 }
81 if let Some(client) = self.client {
82 install_client(client).context("install client")?;
83 }
84 Ok(())
85 }
86}
87
88fn fix_path_for_mac() -> Result<()> { 85fn fix_path_for_mac() -> Result<()> {
89 let mut vscode_path: Vec<PathBuf> = { 86 let mut vscode_path: Vec<PathBuf> = {
90 const COMMON_APP_PATH: &str = 87 const COMMON_APP_PATH: &str =