Skip to content

Commit

Permalink
Using cordova hooks structure correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
lathonez committed Feb 29, 2016
1 parent bae34ae commit 82be26a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ log.txt
coverage/
bower_components/
dist/
hooks/
hooks/after_prepare/010_add_platform_class.js
resources/
node_modules/
tmp/
Expand All @@ -33,4 +33,4 @@ UserInterfaceState.xcuserstate
platforms
plugins

.travis/travis_rsa.pem
.travis/travis_rsa.pem
1 change: 0 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<hook type="before_compile" src="cordovaHooks/beforeCompile.js" />
</widget>
37 changes: 37 additions & 0 deletions hooks/after_prepare/delete_test_assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node

var del = require('del');
var fs = require('fs');
var path = require('path');

var rootdir = process.argv[2];

if (rootdir) {

// go through each of the platform directories that have been prepared
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);

for(var x=0; x<platforms.length; x++) {
// open up the index.html file at the www root
try {
var platform = platforms[x].trim().toLowerCase();
var testBuildPath;

if(platform == 'android') {
testBuildPath = path.join('platforms', platform, 'assets', 'www', 'build', 'test');
} else {
testBuildPath = path.join('platforms', platform, 'www', 'build', 'test');
}

if(fs.existsSync(testBuildPath)) {
console.log('Removing test build from assets after prepare: ' + testBuildPath);
del.sync(testBuildPath);
} else {
console.log('Test build @ ' + testBuildPath + ' does not exist for removal');
}

} catch(e) {
process.stdout.write(e);
}
}
}
9 changes: 0 additions & 9 deletions hooks/beforeCompile.js

This file was deleted.

0 comments on commit 82be26a

Please sign in to comment.