Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into dynamic-widgets
- Loading branch information
Showing
27 changed files
with
472 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const fs = require('fs'); | ||
const versionInfo = require('../../frontend/express/version.info'); | ||
var versions=[]; | ||
var marked_version=""; | ||
var current_version=""; | ||
|
||
//get current version | ||
if(versions && versionInfo.version) | ||
current_version = versionInfo.version; | ||
|
||
//load marked version | ||
if (fs.existsSync(__dirname+"/../../countly_marked_version.json"))//read form file(if exist); | ||
{ | ||
var olderVersions=[]; | ||
try | ||
{ | ||
var data = fs.readFileSync(__dirname+"/../../countly_marked_version.json"); | ||
try { olderVersions = JSON.parse(data);} | ||
catch (SyntaxError) {//unable to parse file | ||
console.error(SyntaxError); | ||
} | ||
if(Array.isArray(olderVersions)) | ||
marked_version = olderVersions[olderVersions.length-1].version; | ||
}catch(error){console.error(error);} | ||
} | ||
//reading version numbers from upgrade folder | ||
var pattern = new RegExp(/^(([0-9])*\.)*[0-9]*$/); | ||
try | ||
{ | ||
var dir_items = fs.readdirSync("../upgrade"); | ||
for (var i=0; i<dir_items.length; i++) | ||
{ | ||
if(dir_items[i] != '.') | ||
{ | ||
try | ||
{ | ||
stat = fs.statSync("../upgrade/"+dir_items[i]); | ||
if(stat.isDirectory() && pattern.test(dir_items[i])) | ||
{ | ||
var my_name = dir_items[i] | ||
versions.push(dir_items[i]); | ||
} | ||
}catch(error) | ||
{ | ||
console.error(error); | ||
} | ||
} | ||
} | ||
|
||
}catch(error) | ||
{ | ||
console.error(error); | ||
} | ||
versions = versions.sort(); | ||
|
||
var from=0; | ||
var til=versions.length-1; | ||
|
||
if(current_version=="") | ||
{ | ||
console.error("could not load current version."); | ||
return; | ||
} | ||
|
||
if(marked_version=="") | ||
{ | ||
console.error("Could not load marked version."); | ||
return; | ||
} | ||
if(current_version==marked_version) | ||
{ | ||
console.error("up to date"); | ||
return; | ||
} | ||
else | ||
{ | ||
while(versions[from]<=marked_version && from<versions.length){ from++;} | ||
while(versions[til]>current_version && til>=0){ til--;} | ||
|
||
if(til==-1 || from ==versions.length) | ||
{ | ||
console.error("version range not found"); | ||
return; | ||
} | ||
else{ | ||
versions = versions.slice(from,til+1); | ||
console.log(versions.join(";")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.