MCPcopy Create free account
hub / github.com/ThatGuySam/doesitarm / downloadStorkExecutable

Function downloadStorkExecutable

helpers/stork/executable.js:44–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43// 👩‍💻 Bash Download example - https://github.com/jmooring/hugo-stork/blob/main/build.sh
44export async function downloadStorkExecutable () {
45 const execDownloadUrl = getStorkExecutableDownloadUrl()
46
47 // console.log( { execDownloadUrl } )
48
49 // Delete any existing executable
50 // so we don't get write errors
51 // or false positives from preexisting executable files
52 await fs.remove( storkExecutablePath )
53
54 // Download the binary
55 await execa( `curl`, [
56 '-fsSL',
57 execDownloadUrl,
58
59 // Set filename
60 '-o',
61 storkExecutableName
62 ])
63
64
65 // Set the downloaded binary as executable
66 await fs.chmod( storkExecutablePath, '755' )
67 // Check that our downloaded binary is executable
68
69
70 // console.log( 'isExecutable', isExecutable )
71 if ( !(await isExecutable( storkExecutablePath )) ) throw new Error( `Downloaded binary at ${ storkExecutablePath } is not executable.` )
72
73
74 // Check Stork version
75 // so we know our binary is working
76 const { stdout } = await execa( storkExecutablePath, [
77 '--version'
78 ])
79
80 console.log( 'Stork Version', stdout )
81 if ( !stdout.includes( storkVersion ) ) throw new Error( 'Stork --version command failed.' )
82
83 return stdout
84}
85
86
87export async function buildIndex () {

Callers 3

build-stork.jsFile · 0.90

Calls 3

isExecutableFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected