File tree Expand file tree Collapse file tree 4 files changed +34
-12
lines changed
Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,10 @@ const fs = require('fs')
88const path = require ( 'path' )
99const util = require ( './util' )
1010
11- const liquidcore_version = '0.6.2'
12-
1311; ( ( ) => {
14- const gradle = ( override ) => {
12+ const gradle = async ( override ) => {
1513 var args = {
16- version : liquidcore_version
14+ version : await util . get_latest_version ( )
1715 }
1816 Object . assign ( args , override )
1917
@@ -28,7 +26,7 @@ const liquidcore_version = '0.6.2'
2826 console . log ( '' )
2927 console . log ( 'Where <options> are:' )
3028 console . log ( ' --dev Configures for building addons locally out of node_modules' )
31- console . log ( ' --version=<version> Use specific version of LiquidCore (default: ' + liquidcore_version + ')' )
29+ console . log ( ' --version=<version> Use specific version of LiquidCore (default: ' + args . version + ')' )
3230 console . log ( ' --liquidcore=<path> Use local build of LiquidCore (mutually exclusive with --version)' )
3331 console . log ( '' )
3432 console . log ( 'If you need to install liquidcore addons, specify them in a local package.json file' )
@@ -56,7 +54,7 @@ const liquidcore_version = '0.6.2'
5654 " if (findProject(':LiquidCore') != null) {\n" +
5755 " implementation project(':LiquidCore')\n" +
5856 " } else {\n" +
59- " implementation 'com.github.LiquidPlayer:LiquidCore:" + liquidcore_version + "'\n" +
57+ " implementation 'com.github.LiquidPlayer:LiquidCore:" + args . version + "'\n" +
6058 " }\n\n"
6159
6260 let settings_gradle = ''
Original file line number Diff line number Diff line change @@ -8,15 +8,14 @@ const fs = require('fs')
88const path = require ( 'path' )
99const util = require ( './util' )
1010
11- const liquidcore_version = '0.6.2'
1211const default_ios_target_version = '11.0'
1312const Specs = 'https://github.com/LiquidPlayer/Specs.git'
1413
1514; ( ( ) => {
16- const pod = ( override ) => {
15+ const pod = async ( override ) => {
1716 var args = {
1817 iosVersion : default_ios_target_version ,
19- version : liquidcore_version ,
18+ version : await util . get_latest_version ( ) ,
2019 specs : Specs
2120 }
2221 Object . assign ( args , override )
@@ -158,4 +157,4 @@ const Specs = 'https://github.com/LiquidPlayer/Specs.git'
158157 }
159158
160159 module . exports = pod
161- } ) ( )
160+ } ) ( )
Original file line number Diff line number Diff line change 11const fs = require ( 'fs' )
22const path = require ( 'path' )
3+ const https = require ( 'https' )
34
45; ( ( ) => {
56 let resolved_paths = [ ]
@@ -37,8 +38,32 @@ const path = require('path')
3738 const version = ( s ) => s . split ( '.' ) . map ( ( v , n ) =>
3839 ( s . length - n - 1 ) * 100 * parseInt ( v ) ) . reduce ( ( p , v ) => Number . isInteger ( v ) ?p + v :v )
3940
41+ function get_latest_version ( ) {
42+ return new Promise ( ( resolve , reject ) => {
43+ const options = {
44+ host : 'api.github.com' ,
45+ port : 443 ,
46+ path : '/repos/LiquidPlayer/LiquidCore/releases/latest' ,
47+ method : 'GET'
48+ }
49+ const request = https . request ( options , ( response ) => {
50+ response . setEncoding ( 'utf8' ) ;
51+ if ( response . statusCode < 200 || response . statusCode > 299 ) {
52+ reject ( new Error ( 'Failed to load page, status code: ' + response . statusCode ) )
53+ }
54+ const body = [ ]
55+ response . on ( 'data' , ( chunk ) => body . push ( chunk ) )
56+ response . on ( 'end' , ( ) => resolve ( JSON . parse ( body . join ( '' ) ) . tag_name ) )
57+ } )
58+ request . on ( 'error' , ( err ) => reject ( err ) )
59+ request . setHeader ( 'User-Agent' , 'curl/7.54.0' )
60+ request . end ( )
61+ } )
62+ }
63+
4064 module . exports = {
4165 recurse_packages : process ,
42- version : version
66+ version : version ,
67+ get_latest_version : get_latest_version
4368 }
4469} ) ( )
Original file line number Diff line number Diff line change 11{
22 "name" : " liquidcore-cli" ,
3- "version" : " 0.4.8 " ,
3+ "version" : " 0.4.9 " ,
44 "description" : " Command line utilities for LiquidCore" ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments