Skip to content

Commit 030a789

Browse files
committed
importing chapter 6 and tests
1 parent 533d4d8 commit 030a789

File tree

208 files changed

+167228
-702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+167228
-702
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "www/lib"
3+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Specifies intentionally untracked files to ignore when using Git
2+
# http://git-scm.com/docs/gitignore
3+
4+
node_modules/
5+
platforms/
6+
plugins/

bower.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
2-
"name": "HelloIonic",
2+
"name": "chapter6",
33
"private": "true",
44
"devDependencies": {
55
"ionic": "driftyco/ionic-bower#1.0.0-beta.14"
6+
},
7+
"dependencies": {
8+
"moment-timezone": "~0.2.5",
9+
"suncalc": "~1.6.0",
10+
"angular-mocks": "~1.3.13"
611
}
712
}

config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<widget id="com.ionicframework.chapter9921535" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3-
<name>chapter9</name>
2+
<widget id="com.ionicframework.chapter6324530" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>chapter6</name>
44
<description>
55
An Ionic Framework and Cordova project.
66
</description>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Install all plugins listed in package.json
5+
* https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js
6+
*/
7+
var exec = require('child_process').exec;
8+
var path = require('path');
9+
var sys = require('sys');
10+
11+
var packageJSON = require('../../package.json');
12+
var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova';
13+
// var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd);
14+
15+
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
16+
packageJSON.cordovaPlugins.forEach(function (plugin) {
17+
exec('cordova plugin add ' + plugin, function (error, stdout, stderr) {
18+
sys.puts(stdout);
19+
});
20+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Push plugins to cordovaPlugins array after_plugin_add
5+
*/
6+
var fs = require('fs');
7+
var packageJSON = require('../../package.json');
8+
9+
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
10+
process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
11+
if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) {
12+
packageJSON.cordovaPlugins.push(plugin);
13+
}
14+
});
15+
16+
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2));
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Remove plugins from cordovaPlugins array after_plugin_rm
5+
*/
6+
var fs = require('fs');
7+
var packageJSON = require('../../package.json');
8+
9+
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
10+
11+
process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
12+
var index = packageJSON.cordovaPlugins.indexOf(plugin);
13+
if (index > -1) {
14+
packageJSON.cordovaPlugins.splice(index, 1);
15+
}
16+
});
17+
18+
fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2));

hooks/after_prepare/010_add_platform_class.js

100644100755
File mode changed.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* After prepare, files are copied to the platforms/ios and platforms/android folders.
5+
* Lets clean up some of those files that arent needed with this hook.
6+
*/
7+
var fs = require('fs');
8+
var path = require('path');
9+
10+
var deleteFolderRecursive = function(removePath) {
11+
if( fs.existsSync(removePath) ) {
12+
fs.readdirSync(removePath).forEach(function(file,index){
13+
var curPath = path.join(removePath, file);
14+
if(fs.lstatSync(curPath).isDirectory()) { // recurse
15+
deleteFolderRecursive(curPath);
16+
} else { // delete file
17+
fs.unlinkSync(curPath);
18+
}
19+
});
20+
fs.rmdirSync(removePath);
21+
}
22+
};
23+
24+
var iosPlatformsDir = path.resolve(__dirname, '../../platforms/ios/www/lib/ionic/scss');
25+
var androidPlatformsDir = path.resolve(__dirname, '../../platforms/android/assets/www/lib/ionic/scss');
26+
27+
deleteFolderRecursive(iosPlatformsDir);
28+
deleteFolderRecursive(androidPlatformsDir);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* On a fresh clone, the local platforms/ and plugins/ directories will be
5+
* missing, so ensure they get created before the first platform is added.
6+
*/
7+
var fs = require('fs');
8+
var path = require('path');
9+
10+
var platformsDir = path.resolve(__dirname, '../../platforms');
11+
var pluginsDir = path.resolve(__dirname, '../../plugins');
12+
13+
try {
14+
fs.mkdirSync(platformsDir, function (err) {
15+
if (err) { console.error(err); }
16+
});
17+
} catch(ex) {}
18+
19+
try {
20+
fs.mkdirSync(pluginsDir, function (err) {
21+
if (err) { console.error(err); }
22+
});
23+
} catch(ex) {}

0 commit comments

Comments
 (0)