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

Commited6359c

Browse files
committed
cleanup & path fixes
1 parentdf473d6 commited6359c

File tree

11 files changed

+189
-141
lines changed

11 files changed

+189
-141
lines changed

‎lib/actions/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
"use strict";
22
varType=require('./actionTypes');
33
var_base_1=require('../_base');
44
varpackage_1=require('../services/package');

‎lib/components/menu/menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var default_1 = (function (_super) {
6969
routeToProjects:function(){returndispatch(Action.setRoute('projects'));},
7070
quit:function(){
7171
render_1.togglePanel();
72-
subscriptions_1.onDeactivateSubscriptionsAndUnmount();
72+
subscriptions_1.onDeactivate();
7373
}
7474
};
7575
}),

‎lib/services/package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
varpath=require('path');
3-
varsetGlobals_1=require('./setGlobals');
3+
varset_globals_1=require('./set-globals');
44
varAction=require('../actions/actions');
55
var_base_1=require('../_base');
66
var_=require('lodash');
@@ -31,7 +31,7 @@ var PackageService = (function () {
3131
PackageService.prototype.selectPackage=function(packageName){
3232
varpackagePath=path.join(window.coderoad.dir,'node_modules',packageName);
3333
this.config=require(path.join(packagePath,'package.json'));
34-
setGlobals_1.setGlobals(this.config);
34+
set_globals_1.setGlobals(this.config);
3535
this.data=require(path.join(packagePath,this.config.main));
3636
this.packageName=packageName;
3737
};

‎lib/services/set-globals.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use strict";
2+
varpath=require('path');
3+
varexists_1=require('./exists');
4+
functionsetGlobals(config){
5+
window.coderoad=Object.assign(window.coderoad,{
6+
tutorial:config.name,
7+
suffix:config.config.testSuffix.substring(config.config.testSuffix.lastIndexOf('.')+1,config.config.testSuffix.length),
8+
tutorialDir:path.join(window.coderoad.dir,'node_modules',config.name,config.config.testDir),
9+
testRunner:config.config.testRunner,
10+
testRunnerOptions:config.config.testRunnerOptions||{}
11+
});
12+
loadRepo(config);
13+
loadRunnerDep(config);
14+
}
15+
exports.setGlobals=setGlobals;
16+
functionloadRunnerDep(config){
17+
varflatDep=path.join(window.coderoad.dir,'node_modules',config.config.testRunner,'package.json');
18+
vartreeDep=path.join(window.coderoad.dir,'node_modules',config.name,'node_modules',config.config.testRunner,'package.json');
19+
varrunnerMain;
20+
varrunnerRoot;
21+
if(exists_1.fileExists(flatDep)){
22+
runnerMain=require(flatDep).main;
23+
runnerRoot=flatDep;
24+
}
25+
elseif(exists_1.fileExists(treeDep)){
26+
runnerMain=require(treeDep).main;
27+
runnerRoot=treeDep;
28+
}
29+
else{
30+
varmessage='Error loading test runner. Post an issue. https://github.com/coderoad/atom-coderoad/issues';
31+
console.log(message);
32+
throwmessage;
33+
}
34+
varslash=window.coderoad.win ?'\\' :'/';
35+
runnerMain=path.join.apply(null,runnerMain.split(slash));
36+
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf(slash));
37+
varpathToMain=path.join(runnerRoot,runnerMain);
38+
if(!!require(pathToMain).default){
39+
window.coderoad.runner=require(pathToMain).default;
40+
}
41+
else{
42+
window.coderoad.runner=require(pathToMain);
43+
}
44+
}
45+
functionloadRepo(config){
46+
if(config.bugs&&config.bugs.url){
47+
window.coderoad.issuesPath=config.bugs.url;
48+
}
49+
if(config.repo&&config.repo.url){
50+
varrepo=config.repo.url;
51+
if(!!repo.match(/\.git$/)){
52+
repo=repo.slice(0,repo.length-4);
53+
}
54+
window.coderoad.repo=repo;
55+
}
56+
window.coderoad.edit=config.config.edit&&!!window.coderoad.repo||false;
57+
}

‎src/actions/actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
import*asTypefrom'./actionTypes';
32
import{store}from'../_base';
43
importPackagefrom'../services/package';

‎src/components/menu/menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import{connect}from'react-redux';
44
import*asActionfrom'../../actions/actions';
55
import{togglePanel}from'../render';
6-
import{onDeactivateSubscriptionsAndUnmount}from'../../atom/subscriptions';
6+
import{onDeactivate}from'../../atom/subscriptions';
77

88
import{AppBar,IconButton,IconMenu,MenuItem,Divider}from'material-ui';
99
letMoreVertIcon=require('material-ui/lib/svg-icons/navigation/more-vert');
@@ -26,7 +26,7 @@ let NavigationClose = require('material-ui/lib/svg-icons/navigation/close');
2626
routeToProjects:()=>dispatch(Action.setRoute('projects')),
2727
quit:()=>{
2828
togglePanel();
29-
onDeactivateSubscriptionsAndUnmount();
29+
onDeactivate();
3030
}
3131
};
3232
})

‎src/services/package.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*aspathfrom'path';
2-
import{setGlobals}from'./setGlobals';
2+
import{setGlobals}from'./set-globals';
33
import*asActionfrom'../actions/actions';
44
import{store}from'../_base';
55
const_=require('lodash');
File renamed without changes.

‎src/typings/cr/cr.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ declare namespace CR {
101101
interfaceCoderoad{
102102
dir:string;
103103
testRunner?:string;
104-
suffix:string;
104+
suffix?:string;
105105
tutorial?:string;
106106
tutorialDir?:string;
107107
tutorialOptions?:Object;

‎src/typings/tsd.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
/// <reference path="assertion-error/assertion-error.d.ts" />
22
/// <reference path="atom/atom.d.ts" />
3-
/// <reference path="chai/chai.d.ts" />
43
/// <reference path="classnames/classnames.d.ts" />
54
/// <reference path="es6-promise/es6-promise.d.ts" />
6-
/// <reference path="mocha/mocha.d.ts" />
75
/// <reference path="node/node.d.ts" />
86
/// <reference path="react-dom/react-dom.d.ts" />
97
/// <reference path="react-redux/react-redux.d.ts" />
108
/// <reference path="react/react-addons-css-transition-group.d.ts" />
119
/// <reference path="react/react.d.ts" />
12-
/// <reference path="redux-devtools/redux-devtools.d.ts" />
13-
/// <reference path="redux-thunk/redux-thunk.d.ts" />
1410
/// <reference path="redux/redux.d.ts" />
1511
/// <reference path="text-buffer/text-buffer.d.ts" />
1612
/// <reference path="react/react-addons-css-transition-group.d.ts" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp