Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f06ff2

Browse files
committed
fix version check
1 parenta7d5a67 commit8f06ff2

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

‎lib/reducers/checks/check-setup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function hasDirectory() {
77
resolve(true);
88
}
99
else{
10-
resolve(true);
10+
resolve(false);
1111
}
1212
});
1313
}
@@ -18,7 +18,7 @@ function hasPackageJson() {
1818
if(!hasPackageJson){
1919
resolve(true);
2020
}
21-
resolve(true);
21+
resolve(false);
2222
});
2323
}
2424
exports.hasPackageJson=hasPackageJson;
@@ -30,7 +30,7 @@ function hasTutorialDep() {
3030
if(!hasTutorialDep){
3131
resolve(true);
3232
}
33-
resolve(true);
33+
resolve(false);
3434
});
3535
}
3636
exports.hasTutorialDep=hasTutorialDep;

‎lib/reducers/checks/check-system.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
"use strict";
22
varcommand_line_1=require('../../services/command-line');
3+
functionmatchVersions(v){
4+
returnv.match(/([0-9]+)\.([0-9]+)/);
5+
}
36
functionminVersion(command,minVersion){
47
returnnewPromise(function(resolve,reject){
58
varminOrLater=command_line_1.default(command,'-v')
69
.then(function(res){
710
if(parseInt(res,10).toString()==='NaN'){
811
returnfalse;
912
}
10-
varhasSecondDigit=res.match(/([0-9]+)\.([0-9]+)/);
11-
if(!!hasSecondDigit){
12-
varversions=minVersion.match(/([0-9]+)\.([0-9]+)/);
13-
varfirstDigit=parseInt(hasSecondDigit[1],10);
14-
varfirstVersion=parseInt(versions[1],10);
13+
varmins=matchVersions(minVersion);
14+
if(!!mins){
15+
varresMins=matchVersions(res);
16+
varfirstDigit=parseInt(resMins[1],10);
17+
varfirstVersion=parseInt(mins[1],10);
1518
returnfirstDigit>firstVersion||
16-
firstDigit===firstVersion&&parseInt(hasSecondDigit[2],10)>=parseInt(firstVersion[2],10);
19+
firstDigit===firstVersion&&parseInt(resMins[2],10)>=parseInt(firstVersion[2],10);
1720
}
1821
else{
1922
returnparseInt(res,10)>=parseInt(minVersion,10);

‎lib/reducers/checks/verify.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
varcheck_system_1=require('./check-system');
33
varcheck_setup_1=require('./check-setup');
44
varresult=function(x){returnx;};
5-
varallTrue=function(obj){
5+
functionallTrue(obj){
66
returnObject.values(obj).every(function(x){returnx===true;});
7-
};
7+
}
88
functionverifySetup(){
99
varchecks={
1010
system:{
@@ -20,7 +20,6 @@ function verifySetup() {
2020
checks.system.passed=allTrue(checks.system);
2121
checks.setup.passed=allTrue(checks.setup);
2222
checks.passed=checks.system.passed&&checks.setup.passed;
23-
console.log('checks',checks);
2423
returnchecks;
2524
}
2625
Object.defineProperty(exports,"__esModule",{value:true});

‎src/reducers/checks/check-setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function hasDirectory(): Promise<boolean> {
99
if(!hasDirectory){
1010
resolve(true);
1111
}else{
12-
resolve(true);
12+
resolve(false);
1313
}
1414
});
1515
}
@@ -20,7 +20,7 @@ export function hasPackageJson(): Promise<boolean> {
2020
if(!hasPackageJson){
2121
resolve(true);
2222
}
23-
resolve(true);
23+
resolve(false);
2424
});
2525
}
2626

@@ -32,7 +32,7 @@ export function hasTutorialDep(): Promise<boolean> {
3232
if(!hasTutorialDep){
3333
resolve(true);
3434
}
35-
resolve(true);
35+
resolve(false);
3636
});
3737
}
3838

‎src/reducers/checks/check-system.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
importcommandLinefrom'../../services/command-line';
22

3+
functionmatchVersions(v:string):string[]{
4+
returnv.match(/([0-9]+)\.([0-9]+)/);
5+
}
6+
37
functionminVersion(command:string,minVersion:string):Promise<boolean>{
48
returnnewPromise((resolve,reject)=>{
59
letminOrLater:Promise<boolean>=commandLine(command,'-v')
@@ -9,13 +13,13 @@ function minVersion(command: string, minVersion: string): Promise<boolean> {
913
returnfalse;
1014
}
1115
// two digits, ex: 0.10
12-
lethasSecondDigit=res.match(/([0-9]+)\.([0-9]+)/);
13-
if(!!hasSecondDigit){
14-
letversions=minVersion.match(/([0-9]+)\.([0-9]+)/);
15-
letfirstDigit=parseInt(hasSecondDigit[1],10);
16-
letfirstVersion=parseInt(versions[1],10);
16+
letmins=matchVersions(minVersion);
17+
if(!!mins){
18+
letresMins=matchVersions(res);
19+
letfirstDigit=parseInt(resMins[1],10);
20+
letfirstVersion=parseInt(mins[1],10);
1721
returnfirstDigit>firstVersion||
18-
firstDigit===firstVersion&&parseInt(hasSecondDigit[2],10)>=parseInt(firstVersion[2],10);
22+
firstDigit===firstVersion&&parseInt(resMins[2],10)>=parseInt(firstVersion[2],10);
1923
}else{
2024
// single digit, ex: 3.0
2125
returnparseInt(res,10)>=parseInt(minVersion,10);

‎src/reducers/checks/verify.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function verifySetup() {
2020
checks.system.passed=allTrue(checks.system);
2121
checks.setup.passed=allTrue(checks.setup);
2222
checks.passed=checks.system.passed&&checks.setup.passed;
23-
console.log('checks',checks);
2423
returnchecks;
2524
}
2625
Object.defineProperty(exports,"__esModule",{value:true});

‎src/reducers/checks/verify.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ export default function verifySetup(): CR.Checks {
2626
checks.system.passed=allTrue(checks.system);
2727
checks.setup.passed=allTrue(checks.setup);
2828
checks.passed=checks.system.passed&&checks.setup.passed;
29-
console.log('checks',checks);
3029
returnchecks;
3130
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp