@@ -93,31 +93,15 @@ PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, option
93
93
94
94
var templatePath = path . join ( options . platformDetails . libDir , 'bin' , 'templates' ) ;
95
95
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 ( / \. x c o d e p r o j $ / 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
+ } )
121
105
122
106
// WEEX_HOOK
123
107
// var command = path.join(options.platformDetails.libDir, 'bin', 'create');
@@ -133,6 +117,33 @@ PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, option
133
117
// });
134
118
} ;
135
119
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 ( / \. x c o d e p r o j $ / 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
+
136
147
/**
137
148
* Updates already installed platform.
138
149
*
0 commit comments