Skip to content

Commit

Permalink
Merge pull request #92 from omarduarte/refactor-file-structure
Browse files Browse the repository at this point in the history
Refactors models and file structure
  • Loading branch information
kranrao committed Mar 19, 2015
2 parents d0fa855 + 708eae9 commit 4037bb7
Show file tree
Hide file tree
Showing 668 changed files with 129,978 additions and 291 deletions.
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory": "client/www/lib"
"directory": "www/lib"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ client/hooks/

# Compiled Dirs (http://nodejs.org/api/addons.html)
client/platforms/
platforms/
client/plugins/
client/www/lib/
coverage/
Expand Down
56 changes: 0 additions & 56 deletions client/package.json

This file was deleted.

48 changes: 0 additions & 48 deletions client/www/app/auth/user.signin.js

This file was deleted.

53 changes: 0 additions & 53 deletions client/www/app/auth/user.signup.js

This file was deleted.

21 changes: 0 additions & 21 deletions client/www/app/core/CurrentMode.js

This file was deleted.

21 changes: 0 additions & 21 deletions client/www/app/core/CurrentViewer.js

This file was deleted.

6 changes: 0 additions & 6 deletions client/www/app/core/core.module.js

This file was deleted.

8 changes: 0 additions & 8 deletions client/www/app/moment/moment.module.js

This file was deleted.

File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions hooks/after_platform_add/010_install_plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node

/**
* Install all plugins listed in package.json
* https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js
*/
var exec = require('child_process').exec;
var path = require('path');
var sys = require('sys');

var packageJSON = null;

try {
packageJSON = require('../../package.json');
} catch(ex) {
console.log('\nThere was an error fetching your package.json file.')
console.log('\nPlease ensure a valid package.json is in the root of this project\n')
return;
}

var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova';
// var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd);

packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
packageJSON.cordovaPlugins.forEach(function (plugin) {
exec('cordova plugin add ' + plugin, function (error, stdout, stderr) {
sys.puts(stdout);
});
});
16 changes: 16 additions & 0 deletions hooks/after_plugin_add/010_register_plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

/**
* Push plugins to cordovaPlugins array after_plugin_add
*/
var fs = require('fs');
var packageJSON = require('../../package.json');

packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) {
packageJSON.cordovaPlugins.push(plugin);
}
});

fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2));
18 changes: 18 additions & 0 deletions hooks/after_plugin_rm/010_deregister_plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

/**
* Remove plugins from cordovaPlugins array after_plugin_rm
*/
var fs = require('fs');
var packageJSON = require('../../package.json');

packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];

process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
var index = packageJSON.cordovaPlugins.indexOf(plugin);
if (index > -1) {
packageJSON.cordovaPlugins.splice(index, 1);
}
});

fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2));
28 changes: 28 additions & 0 deletions hooks/after_prepare/020_remove_sass_from_platforms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node

/**
* After prepare, files are copied to the platforms/ios and platforms/android folders.
* Lets clean up some of those files that arent needed with this hook.
*/
var fs = require('fs');
var path = require('path');

var deleteFolderRecursive = function(removePath) {
if( fs.existsSync(removePath) ) {
fs.readdirSync(removePath).forEach(function(file,index){
var curPath = path.join(removePath, file);
if(fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(removePath);
}
};

var iosPlatformsDir = path.resolve(__dirname, '../../platforms/ios/www/lib/ionic/scss');
var androidPlatformsDir = path.resolve(__dirname, '../../platforms/android/assets/www/lib/ionic/scss');

deleteFolderRecursive(iosPlatformsDir);
deleteFolderRecursive(androidPlatformsDir);
23 changes: 23 additions & 0 deletions hooks/before_platform_add/init_directories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node

/**
* On a fresh clone, the local platforms/ and plugins/ directories will be
* missing, so ensure they get created before the first platform is added.
*/
var fs = require('fs');
var path = require('path');

var platformsDir = path.resolve(__dirname, '../../platforms');
var pluginsDir = path.resolve(__dirname, '../../plugins');

try {
fs.mkdirSync(platformsDir, function (err) {
if (err) { console.error(err); }
});
} catch(ex) {}

try {
fs.mkdirSync(pluginsDir, function (err) {
if (err) { console.error(err); }
});
} catch(ex) {}
File renamed without changes.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
"sinon": "^1.12.2",
"sinon-chai": "^2.7.0"
},
"cordovaPlugins": [
"https://github.com/VitaliiBlagodir/cordova-plugin-datepicker",
"org.apache.cordova.media-capture",
"org.apache.cordova.camera",
"org.apache.cordova.media"
],
"dependencies": {
"node-sass": "^2.0.1"
}
Expand Down
Loading

0 comments on commit 4037bb7

Please sign in to comment.