MCPcopy Create free account
hub / github.com/aspizu/goboscript / fetch

Method fetch

src/standard_library.rs:116–150  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

114 }
115
116 pub fn fetch(&self) -> anyhow::Result<()> {
117 if self.path.exists() {
118 return Ok(());
119 }
120 fs::create_dir_all(&self.path).with_context(|| {
121 format!(
122 "Failed to create standard library version directory {}",
123 self.version
124 )
125 })?;
126 if !Command::new("git")
127 .args([
128 "clone",
129 "--depth=1",
130 "https://github.com/goboscript/std",
131 "--branch",
132 &format!("v{}", self.version),
133 self.path.to_str().unwrap(),
134 ])
135 .stdout(Stdio::null())
136 .stderr(Stdio::null())
137 .status()
138 .with_context(|| format!("Failed to clone standard library version {}", self.version))?
139 .success()
140 {
141 bail!("Failed to clone standard library version {}", self.version);
142 }
143 fs::remove_dir_all(self.path.join(".git")).with_context(|| {
144 format!(
145 "Failed to remove .git directory from standard library version {}",
146 self.version
147 )
148 })?;
149 Ok(())
150 }
151}

Callers 1

buildFunction · 0.80

Calls 2

newFunction · 0.85
argsMethod · 0.80

Tested by

no test coverage detected