Skip to content

Commit 607c307

Browse files
authored
Merge pull request #120 from weexteam/bugfix-alisource
fixbug-support alisource for ios platform
2 parents 8ffa615 + 84439c0 commit 607c307

File tree

4 files changed

+41
-27
lines changed

4 files changed

+41
-27
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ node_js:
99
script: ./node_modules/mocha/bin/mocha tests/*.test.js
1010
before_install:
1111
- brew install nvm;
12-
- brew install android-platform-tools;
12+
# - brew install android-platform-tools;
1313
- gem install -n /usr/local/bin cocoapods

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ weexpack 所提供的命令大致可分为三组,分别是:
367367

368368
## changelog
369369

370+
0.3.13
371+
* 修复创建ali内部源问题
372+
370373

371374
0.3.12
372375
* 修复merge问题

lib/src/platforms/PlatformApiPoly.js

+36-25
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,15 @@ PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, option
9393

9494
var templatePath = path.join(options.platformDetails.libDir, 'bin', 'templates');
9595
return Q().then(function(){
96-
copyPlatform(templatePath, destinationDir)
97-
//修改source
98-
if(options.ali&&options.platformDetails.platform == "ios"){
99-
var weexPluginRootDir = path.join(destinationDir, 'Weexplugin');
100-
var xcodeProjDir;
101-
var xcodeCordovaProj;
102-
103-
try {
104-
xcodeProjDir = fs.readdirSync(weexPluginRootDir).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0];
105-
if (!xcodeProjDir) {
106-
throw new CordovaError('The provided path "' + weexPluginRootDir + '" is not a Weex iOS project.');
107-
}
108-
109-
var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj'));
110-
xcodeCordovaProj = path.join(weexPluginRootDir, cordovaProjName);
111-
} catch(e) {
112-
throw new CordovaError('The provided path "'+weexPluginRootDir+'" is not a weexpack iOS project.');
113-
}
114-
var Podfile = require('./ios_pack/lib/Podfile').Podfile;
115-
var project_name = xcodeCordovaProj.split('/').pop();
116-
var podfileFile = new Podfile(path.join(weexPluginRootDir, Podfile.FILENAME), project_name)
117-
podfileFile.writeUseAliSource()
118-
}
119-
return PlatformApiPoly;
120-
})
96+
copyPlatform(templatePath, destinationDir)
97+
//修改source
98+
if(options.ali&&options.platformDetails.platform == "ios"){
99+
var weexPluginRootDir = path.join(destinationDir, 'Weexplugin');
100+
changeSource(destinationDir)
101+
changeSource(weexPluginRootDir)
102+
}
103+
return PlatformApiPoly;
104+
})
121105

122106
// WEEX_HOOK
123107
// var command = path.join(options.platformDetails.libDir, 'bin', 'create');
@@ -133,6 +117,33 @@ PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, option
133117
// });
134118
};
135119

120+
function changeSource (destinationDir){
121+
122+
var weexPluginRootDir = path.join(destinationDir);
123+
var xcodeProjDir;
124+
var xcodeCordovaProj;
125+
126+
try {
127+
xcodeProjDir = fs.readdirSync(weexPluginRootDir).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0];
128+
if (!xcodeProjDir) {
129+
throw new CordovaError('The provided path "' + weexPluginRootDir + '" is not a Weex iOS project.');
130+
}
131+
132+
var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj'));
133+
xcodeCordovaProj = path.join(weexPluginRootDir, cordovaProjName);
134+
} catch(e) {
135+
throw new CordovaError('The provided path "'+weexPluginRootDir+'" is not a weexpack iOS project.');
136+
}
137+
var Podfile = require('./ios_pack/lib/Podfile').Podfile;
138+
var project_name = xcodeCordovaProj.split('/').pop();
139+
var podfileFile = new Podfile(path.join(weexPluginRootDir, Podfile.FILENAME), project_name)
140+
podfileFile.writeUseAliSource()
141+
142+
143+
}
144+
145+
146+
136147
/**
137148
* Updates already installed platform.
138149
*

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weexpack",
3-
"version": "0.3.12",
3+
"version": "0.3.13",
44
"description": "Weex pack tool",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)