This repository was archived by the owner on May 27, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
1
const Binary = require ( './binary' ) ;
2
+
3
+ const os = require ( 'os' ) ;
4
+
5
+ function getPlatform ( ) {
6
+ const type = os . type ( ) ;
7
+ const arch = os . arch ( ) ;
8
+
9
+ if ( type === 'Windows_NT' && arch === 'x64' ) return 'win' ;
10
+ if ( type === 'Linux' && arch === 'x64' ) return 'linux' ;
11
+ if ( type === 'Darwin' && arch === 'x64' ) return 'macos' ;
12
+
13
+ throw new Error ( `Unsupported platform: ${ type } ${ arch } ` ) ;
14
+ }
15
+
2
16
function getBinary ( ) {
3
17
const name = 'rune' ;
4
18
const version = require ( '../package.json' ) . version ;
5
- const url = `https://github.com/ancientproject/cli/releases/download/v${ version } /${ name } -cli-win -64.zip` ;
19
+ const url = `https://github.com/ancientproject/cli/releases/download/v${ version } /${ name } -cli-${ getPlatform ( ) } -64.zip` ;
6
20
return new Binary ( url , { name } ) ;
7
21
}
8
22
Original file line number Diff line number Diff line change 2
2
3
3
const getBinary = require ( './getBinary' ) ;
4
4
5
-
6
5
if ( ! getBinary ( ) . exist ( ) )
6
+ {
7
+ console . log ( ">> installing binaries..." ) ;
7
8
getBinary ( ) . install ( ) ;
8
- getBinary ( ) . run ( ) ;
9
+ }
10
+ else
11
+ getBinary ( ) . run ( ) ;
You can’t perform that action at this time.
0 commit comments