From 4e52c2ddf2c95f53ca6e03930fa385f5b1602dd4 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 16:50:43 -0500 Subject: [PATCH 01/39] docs(contributing): Include Issue Submission --- contributing.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/contributing.md b/contributing.md index cd557b3..008c87a 100644 --- a/contributing.md +++ b/contributing.md @@ -1,6 +1,17 @@ -* When submitting a PR, make sure that the commit messages match the [AngularJS conventions][commit-message-format] (see below). -* When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix. -* When submitting a new feature, add tests that cover the feature. +## Issue submission + +In order for us to help you please check that you've completed the following steps: + +* Made sure you're on the latest version `npm update -g generator-ionic` +* Used the search feature to ensure that the bug hasn't been reported before +* Included as much information about the bug as possible, including any output you've received, what OS and version you're on, etc. +* Shared the output from running the following command in your project root as this can also help track down the issue. + +Unix: `yo --version && echo $PATH $NODE_PATH && node -e 'console.log(process.platform, process.versions)'` + +Windows: `yo --version && echo %PATH% %NODE_PATH% && node -e "console.log(process.platform, process.versions)"` + +[Submit your issue](https://github.com/diegonetto/generator-ionic/issues/new) ## Git Commit Guidelines From 380d9a69b7c0692dcf79c1c1bc17579727c3a072 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 16:54:08 -0500 Subject: [PATCH 02/39] docs(readme): Link to issue submission guidelines --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 8b32597..8638786 100644 --- a/README.md +++ b/README.md @@ -207,8 +207,15 @@ Now go edit a file and then refresh your browser to see your changes. (Currently See the [contributing docs](https://github.com/diegonetto/generator-ionic/blob/master/contributing.md). +When submitting an issue, please follow the [guidelines](https://github.com/diegonetto/generator-ionic/blob/master/contributing.md#issue-submission). Especially important is to make sure `generator-ionic` is up-to-date, and providing the command or commands that cause the issue. + + When submitting a PR, make sure that the commit messages match the [AngularJS conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/). +When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix. + +When submitting a new feature, add tests that cover the feature. + For testing & debugging the generator please refer to the Yeoman Generator [testing documentation](https://github.com/yeoman/generator/wiki/Testing-generators). ## License From b2cb5cf2279692c98c76bf0fa5510a4459cc381b Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 18:21:20 -0500 Subject: [PATCH 03/39] fix(sass): Ensure CSS or SCSS files are properly created. Change wiredep config. Closes #99 --- app/index.js | 21 +++++++++++++-------- templates/common/Gruntfile.js | 3 --- templates/styles/main.css | 9 +-------- templates/styles/main.sass | 7 ------- templates/styles/main.scss | 1 + 5 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 templates/styles/main.sass create mode 100644 templates/styles/main.scss diff --git a/app/index.js b/app/index.js index dea3c85..df36776 100644 --- a/app/index.js +++ b/app/index.js @@ -135,16 +135,21 @@ IonicGenerator.prototype.createIndexHtml = function createIndexHtml() { this.write(path.join(this.appPath, 'index.html'), this.indexFile); }; -IonicGenerator.prototype.copyStyles = function copyStyles() { - var sass = this.compass; - var mainFile = 'main.' + (sass ? 'sass' : 'css'); - +IonicGenerator.prototype.ensureStyles = function ensureStyles() { // Only create a main style file if the starter template didn't // have any styles. In the case it does, the starter should - // supply both main.css and main.sass files. - if (_.isEmpty(this.expand('app/styles/main.*'))) { - this.copy('styles/' + mainFile, 'app/styles/' + mainFile); - } + // supply both main.css and main.scss files, one of which + // will be deleted + var done = this.async(); + var unusedFile = 'main.' + (this.compass ? 'css' : 'scss'); + fs.unlink(path.resolve('app/styles', unusedFile), function (err) { + if (_.isEmpty(this.expand('app/styles/main.*'))) { + var cssFile = 'main.' + (this.compass ? 'scss' : 'css'); + this.copy('styles/' + cssFile, 'app/styles/' + cssFile); + } + done(); + }.bind(this)); + }; IonicGenerator.prototype.packageFiles = function packageFiles() { diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index fd22962..5d3b848 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -173,9 +173,6 @@ module.exports = function (grunt) { // Automatically inject Bower components into the app wiredep: { - options: { - cwd: '<%%= yeoman.app %>' - }, app: { src: ['<%%= yeoman.app %>/index.html'], ignorePath: /\.\.\// diff --git a/templates/styles/main.css b/templates/styles/main.css index d2783e4..a5a69e6 100644 --- a/templates/styles/main.css +++ b/templates/styles/main.css @@ -1,8 +1 @@ -/* Your app's CSS, go crazy, make it your own */ - -.ionic-logo { - display: block; - margin: 15px auto; - width: 96px; - height: 96px; -} +/* Your application styles go here */ diff --git a/templates/styles/main.sass b/templates/styles/main.sass deleted file mode 100644 index cbccc8a..0000000 --- a/templates/styles/main.sass +++ /dev/null @@ -1,7 +0,0 @@ -/* Your app's SASS, go crazy, make it your own */ - -.ionic-logo - display: block - margin: 15px auto - width: 96px - height: 96px \ No newline at end of file diff --git a/templates/styles/main.scss b/templates/styles/main.scss new file mode 100644 index 0000000..9719141 --- /dev/null +++ b/templates/styles/main.scss @@ -0,0 +1 @@ +// Your application styles go here From af92612f409c84dbc51e2d46c60af5668211cfae Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 18:21:45 -0500 Subject: [PATCH 04/39] 0.5.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0976953..5830bf0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-ionic", - "version": "0.5.3", + "version": "0.5.4", "description": "A generator for the Ionic Framework", "keywords": [ "yeoman-generator", From 86e0dac4cf9a973189d059eedf50e7b7fec9810c Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 18:23:36 -0500 Subject: [PATCH 05/39] docs(CHANGELOG): Update CHANGELOG --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeab70b..f313492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,13 @@ - + +### 0.5.4 (2014-09-07) + + +#### Bug Fixes + +* **sass:** Ensure CSS or SCSS files are properly created. Change wiredep config. ([b2cb5cf2](http://github.com/diegonetto/generator-ionic/commit/b2cb5cf2279692c98c76bf0fa5510a4459cc381b), closes [#99](http://github.com/diegonetto/generator-ionic/issues/99)) + + + ### 0.5.3 (2014-08-26) From 4ef83b3408305e7e24db1f49b7246a830dd43099 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 7 Sep 2014 23:12:16 -0500 Subject: [PATCH 06/39] fix(package.json): Remove warnings as mentioned in #99 --- templates/common/_package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/common/_package.json b/templates/common/_package.json index d1c74cb..ad2c748 100644 --- a/templates/common/_package.json +++ b/templates/common/_package.json @@ -1,6 +1,7 @@ { "name": "<%= appName %>", - "version": "0.0.0", + "version": "0.1.0", + "private": true, "dependencies": {}, "devDependencies": { "grunt": "~0.4.1", From 461530138740b74aba67ee79c36f86872b2d594d Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:30:36 +1000 Subject: [PATCH 07/39] Updated Readme with Android Walkthrough --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/README.md b/README.md index 8638786..b2b9402 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,70 @@ grunt emulate:ios ``` You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. +## Android Walkthrough (Research & Contribution by Luke Schoen @ltfschoen) + +- Install Generator Ionic +``` +npm cache clear +npm install -g generator-ionic +mkdir my-ionic-project && cd $_ +yo ionic +``` +- Run web server on your localhost: +``` +grunt serve +``` +- Download the latest [Android SDK](https://developer.android.com/sdk/index.html#download) +- On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip +- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: +``` +[Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] +``` +- Execute the following command in Terminal program to edit your Bash Profile document: +``` +touch ~/.bash_profile; open ~/.bash_profile +``` +- Copy and Paste the following at the top of the file (without removing existing data). Replace all instances below of adt-bundle-mac-x86_64-20140702 with the filename of the ZIP file that you downloaded. Save and close the file. +``` +export PATH=/user/local/bin:$PATH +export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools +export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools +``` +- Execute the updated Bash Profile with the following command in Terminal program to update the PATH: +``` +source ~/.bash_profile +``` +- Execute the following command in Terminal program to install Apache Ant using Homebrew +``` +brew install ant +``` +- Note: This step may be necessary to avoid encountering the following error: +``` +Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. +``` +- Execute the following command in Terminal program to open the Android Package Manager (APM): +``` +android +``` +- In the APM, expand Android 4.4.2 (API 19). Click checkboxes to install "SDK Platform" and "ARM EABI v7A System Image". Click "Install Packages..." +- Go to the Android SDK Manager menu in the top left of your screen. Click the "Tools" dropdown menu. Click "Manage AVDs...". This opens the AVD (Android Virtual Device) Manager. Click to select the device listed (i.e. default is AVD_for_Nexus Android 4.4.2). Click the "Repair..." Button on the right panel. Click the "Refresh" Button at the bottom right. Close the window. +- Execute the following command in Terminal program to install the Android Debug Bridge: +``` +brew install android-platform-tools +``` +- Note: The above steps may be necessary to avoid encountering the following errors: +``` +Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools. +Error executing "adb devices": /bin/sh: adb: command not found +emulator: ERROR: This AVD's configuration is missing a kernel file!! +``` +- Add the Android Platform with the following commands in Terminal program. No warnings or errors should be encountered. Note that it may take a while to load your app in the Android emulator. +``` +grunt platform:add:android +grunt build +grunt emulate:android +``` + ## Testing Your App To lessen the pain of testing your application, this generator configures your project with a handful of libraries that will hopefully make testing your application, dare I say, more enjoyable. From c1b0ee45967a1ddeea0f44fcbaa8a30a2b8d118d Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:32:28 +1000 Subject: [PATCH 08/39] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2b9402..9227e77 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,8 @@ grunt emulate:ios ``` You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. -## Android Walkthrough (Research & Contribution by Luke Schoen @ltfschoen) +## Android Walkthrough +Research & Contribution by @ltfschoen (Luke Schoen) - Install Generator Ionic ``` From 5bedc0d3cf3c024b9df0fc00f4c588c4e24e3f08 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:38:28 +1000 Subject: [PATCH 09/39] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9227e77..c28aa4e 100644 --- a/README.md +++ b/README.md @@ -163,11 +163,11 @@ npm install -g generator-ionic mkdir my-ionic-project && cd $_ yo ionic ``` -- Run web server on your localhost: +- Execute the following command in Terminal program to run a web server on your localhost. This will automatically open a tab in your default web browser at the following address and load your app http://127.0.0.1:9000/ ``` grunt serve ``` -- Download the latest [Android SDK](https://developer.android.com/sdk/index.html#download) +- Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) - On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip - Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: ``` From 33fc3fad0adc211528aa087e62f650a6b5329734 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:41:30 +1000 Subject: [PATCH 10/39] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c28aa4e..4aa1a94 100644 --- a/README.md +++ b/README.md @@ -169,21 +169,21 @@ grunt serve ``` - Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) - On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip -- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: +- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary in order to allow you to use the 'android' command and avoid encountering the following error: ``` [Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] ``` -- Execute the following command in Terminal program to edit your Bash Profile document: +- Execute the following command in the Terminal program to edit your Bash Profile document: ``` touch ~/.bash_profile; open ~/.bash_profile ``` -- Copy and Paste the following at the top of the file (without removing existing data). Replace all instances below of adt-bundle-mac-x86_64-20140702 with the filename of the ZIP file that you downloaded. Save and close the file. +- Copy and Paste the following at the top of the file (without removing existing data within the file). Replace all instances of adt-bundle-mac-x86_64-20140702 that are shown below with the filename of the ZIP file that you downloaded. Save and close the file. ``` export PATH=/user/local/bin:$PATH export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools ``` -- Execute the updated Bash Profile with the following command in Terminal program to update the PATH: +- Execute the updated Bash Profile with the following command in the Terminal program to update the PATH: ``` source ~/.bash_profile ``` @@ -191,7 +191,7 @@ source ~/.bash_profile ``` brew install ant ``` -- Note: This step may be necessary to avoid encountering the following error: +- Note: The above step may be necessary to avoid encountering the following error: ``` Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. ``` From c780f5501f5022fabda7ccc1b3ef529fb30ac756 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Thu, 11 Sep 2014 01:01:28 -0500 Subject: [PATCH 11/39] docs(contributing): Fix type. --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index 008c87a..4fb4201 100644 --- a/contributing.md +++ b/contributing.md @@ -5,7 +5,7 @@ In order for us to help you please check that you've completed the following ste * Made sure you're on the latest version `npm update -g generator-ionic` * Used the search feature to ensure that the bug hasn't been reported before * Included as much information about the bug as possible, including any output you've received, what OS and version you're on, etc. -* Shared the output from running the following command in your project root as this can also help track down the issue. +* Share the output from running the following command in your project root as this can also help track down the issue. Unix: `yo --version && echo $PATH $NODE_PATH && node -e 'console.log(process.platform, process.versions)'` From e6557551a147557b2693a4ab066b574252f16938 Mon Sep 17 00:00:00 2001 From: Jason Kurian Date: Wed, 24 Sep 2014 23:01:22 -0400 Subject: [PATCH 12/39] Add code climate badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bf1a51..f091855 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](http://i.imgur.com/BGrt2QK.png) -## Ionic Framework generator [![Build Status](https://api.travis-ci.org/JaKXz/generator-ionic.png?branch=master)](https://travis-ci.org/JaKXz/generator-ionic) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) +## Ionic Framework generator [![Build Status](https://api.travis-ci.org/JaKXz/generator-ionic.png?branch=master)](https://travis-ci.org/JaKXz/generator-ionic) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![Code Climate](https://codeclimate.com/github/JaKXz/generator-ionic/badges/gpa.svg)](https://codeclimate.com/github/JaKXz/generator-ionic) > Yeoman generator for Ionic - lets you quickly set up a hybrid mobile app project From fe04e3a8ac2e00ac592f20fa00064deb58f1b5b3 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 04:01:47 -0500 Subject: [PATCH 13/39] docs(docs): Update README to show using app-name during scaffolding. Closes #34 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8638786..45ae7c6 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Make a new directory, and `cd` into it mkdir my-ionic-project && cd $_ ``` -Run `yo ionic` +Run `yo ionic`, optionally passing an app name: ``` -yo ionic +yo ionic [app-name] ``` Follow the prompts to select from some common plugins and pick a starter template, then spin up a `connect` server with `watch` and `livereload` for developing in your browser From c0f87b4daf606a7da3e532282889fd61d7b860e0 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 11:20:23 -0500 Subject: [PATCH 14/39] feature(generator): Add ionic-cli support. Closes #112 --- templates/common/Gruntfile.js | 150 ++++++++++++++++++--------------- templates/common/_bowerrc | 2 +- templates/common/_package.json | 1 + 3 files changed, 83 insertions(+), 70 deletions(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 5d3b848..948f2ce 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -59,37 +59,27 @@ module.exports = function (grunt) { watch: { bower: { files: ['bower.json'], - tasks: ['wiredep'] + tasks: ['wiredep', 'newer:copy:app'] + }, + html: { + files: ['<%%= yeoman.app %>/**/*.html'], + tasks: ['newer:copy:app'] }, js: { files: ['<%%= yeoman.app %>/<%%= yeoman.scripts %>/**/*.js'], - tasks: ['newer:jshint:all'], - options: { - livereload: true - } + tasks: ['newer:copy:app', 'newer:jshint:all'] },<% if (compass) { %> compass: { files: ['<%%= yeoman.app %>/<%%= yeoman.styles %>/**/*.{scss,sass}'], - tasks: ['compass:server', 'autoprefixer'] + tasks: ['compass:server', 'autoprefixer', 'newer:copy:tmp'] },<% } else { %> styles: { files: ['<%%= yeoman.app %>/<%%= yeoman.styles %>/**/*.css'], - tasks: ['newer:copy:styles', 'autoprefixer'] + tasks: ['newer:copy:styles', 'autoprefixer', 'newer:copy:tmp'] },<% } %> gruntfile: { files: ['Gruntfile.js'], - tasks: ['ngconstant:development'] - }, - livereload: { - options: { - livereload: '<%%= connect.options.livereload %>' - }, - files: [ - '<%%= yeoman.app %>/*.html', - '<%%= yeoman.app %>/templates/**/*.html', - '.tmp/<%%= yeoman.styles %>/**/*.css', - '<%%= yeoman.app %>/<%%= yeoman.images %>/**/*.{png,jpg,jpeg,gif,webp,svg}' - ] + tasks: ['ngconstant:development', 'newer:copy:app'] } }, @@ -98,17 +88,7 @@ module.exports = function (grunt) { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. - hostname: 'localhost', - livereload: 35729 - }, - livereload: { - options: { - open: true, - base: [ - '.tmp', - '<%%= yeoman.app %>' - ] - } + hostname: 'localhost' }, dist: { options: { @@ -179,7 +159,7 @@ module.exports = function (grunt) { }<% if (compass) { %>, sass: { src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], - ignorePath: /(\.\.\/){1,2}bower_components\// + ignorePath: /(\.\.\/){1,2}lib\// }<% } %> }, @@ -189,13 +169,13 @@ module.exports = function (grunt) { options: { sassDir: '<%%= yeoman.app %>/<%%= yeoman.styles %>', cssDir: '.tmp/<%%= yeoman.styles %>', - generatedImagesDir: '.tmp/img/generated', - imagesDir: '<%%= yeoman.app %>/img', + generatedImagesDir: '.tmp/<%%= yeoman.images %>/generated', + imagesDir: '<%%= yeoman.app %>/<%%= yeoman.images %>', javascriptsDir: '<%%= yeoman.app %>/<%%= yeoman.scripts %>', fontsDir: '<%%= yeoman.app %>/<%%= yeoman.styles %>/fonts', - importPath: '<%%= yeoman.app %>/bower_components', - httpImagesPath: '/img', - httpGeneratedImagesPath: '/img/generated', + importPath: '<%%= yeoman.app %>/lib', + httpImagesPath: '/<%%= yeoman.images %>', + httpGeneratedImagesPath: '/<%%= yeoman.images %>/generated', httpFontsPath: '/<%%= yeoman.styles %>/fonts', relativeAssets: false, assetCacheBuster: false, @@ -203,7 +183,7 @@ module.exports = function (grunt) { }, dist: { options: { - generatedImagesDir: '<%%= yeoman.dist %>/img/generated' + generatedImagesDir: 'www/<%%= yeoman.images %>/generated' } }, server: { @@ -275,7 +255,7 @@ module.exports = function (grunt) { cwd: '<%%= yeoman.app %>', dest: 'www', src: [ - 'images/**/*.{png,jpg,jpeg,gif,webp,svg}', + '<%%= yeoman.images %>/**/*.{png,jpg,jpeg,gif,webp,svg}', '*.html', 'templates/**/*.html', 'fonts/*' @@ -295,7 +275,7 @@ module.exports = function (grunt) { }, fonts: { expand: true, - cwd: 'app/bower_components/ionic/release/fonts/', + cwd: 'app/lib/ionic/release/fonts/', dest: '<%%= yeoman.app %>/fonts/', src: '*' }, @@ -305,11 +285,20 @@ module.exports = function (grunt) { dest: '.tmp/<%%= yeoman.styles %>/', src: '{,*/}*.css' }, - all: { + app: { + expand: true, + cwd: '<%%= yeoman.app %>', + dest: 'www/', + src: [ + '**/*', + '!**/*.(scss,sass,css)', + ] + }, + tmp: { expand: true, - cwd: '<%%= yeoman.app %>/', - src: '**', - dest: 'www/' + cwd: '.tmp', + dest: 'www/', + src: '**/*' } }, @@ -367,13 +356,13 @@ module.exports = function (grunt) { basePath: '', frameworks: ['mocha', 'chai'], files: [ - '<%%= yeoman.app %>/bower_components/angular/angular.js', - '<%%= yeoman.app %>/bower_components/angular-animate/angular-animate.js', - '<%%= yeoman.app %>/bower_components/angular-sanitize/angular-sanitize.js', - '<%%= yeoman.app %>/bower_components/angular-ui-router/release/angular-ui-router.js', - '<%%= yeoman.app %>/bower_components/ionic/release/js/ionic.js', - '<%%= yeoman.app %>/bower_components/ionic/release/js/ionic-angular.js', - '<%%= yeoman.app %>/bower_components/angular-mocks/angular-mocks.js', + '<%%= yeoman.app %>/lib/angular/angular.js', + '<%%= yeoman.app %>/lib/angular-animate/angular-animate.js', + '<%%= yeoman.app %>/lib/angular-sanitize/angular-sanitize.js', + '<%%= yeoman.app %>/lib/angular-ui-router/release/angular-ui-router.js', + '<%%= yeoman.app %>/lib/ionic/release/js/ionic.js', + '<%%= yeoman.app %>/lib/ionic/release/js/ionic-angular.js', + '<%%= yeoman.app %>/lib/angular-mocks/angular-mocks.js', '<%%= yeoman.app %>/<%%= yeoman.scripts %>/**/*.js', 'test/mock/**/*.js', 'test/spec/**/*.js' @@ -420,10 +409,8 @@ module.exports = function (grunt) { }); - // Register tasks for all Cordova commands, but namespace - // the cordova:build since we already have a build task. + // Register tasks for all Cordova commands _.functions(cordova).forEach(function (name) { - name = (name === 'build') ? 'cordova:build' : name; grunt.registerTask(name, function () { this.args.unshift(name.replace('cordova:', '')); // Handle URL's being split up by Grunt because of `:` characters @@ -441,7 +428,7 @@ module.exports = function (grunt) { grunt.log.error(data); }); child.on('close', function (code) { - code = (name === 'cordova:build') ? true : code ? false : true; + code = code ? false : true; done(code); }); }); @@ -452,12 +439,12 @@ module.exports = function (grunt) { // over to www/. Last step is running cordova prepare so we can refresh the ripple // browser tab to see the changes. Technically ripple runs `cordova prepare` on browser // refreshes, but at this time you would need to re-run the emulator to see changes. - grunt.registerTask('ripple', ['wiredep', 'copy:all', 'ripple-emulator']); + grunt.registerTask('ripple', ['wiredep', 'newer:copy:app', 'ripple-emulator']); grunt.registerTask('ripple-emulator', function () { grunt.config.set('watch', { all: { files: _.flatten(_.pluck(grunt.config.get('watch'), 'files')), - tasks: ['copy:all', 'prepare'] + tasks: ['newer:copy:app', 'prepare'] } }); @@ -488,32 +475,60 @@ module.exports = function (grunt) { return grunt.task.run(['watch']); }); + // Wrap ionic-cli commands + grunt.registerTask('ionic', function() { + var script = path.resolve('./node_modules/ionic/bin/', 'ionic'); + var flags = process.argv.splice(3); + var child = spawn(script, this.args.concat(flags)); + child.stdout.on('data', function (data) { + grunt.log.writeln(data); + }); + child.stderr.on('data', function (data) { + grunt.log.error(data); + }); + process.on('exit', function (code) { + child.kill('SIGINT'); + process.exit(code); + }); + + return grunt.task.run(['watch']); + }); grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'connect:dist:keepalive']); + if (target === 'compress') { + return grunt.task.run(['compress', 'ionic:serve']); } grunt.task.run([ - 'clean:server', + 'clean', 'ngconstant:development', 'wiredep', 'concurrent:server', 'autoprefixer', - 'connect:livereload', - 'watch' + 'newer:copy:app', + 'newer:copy:tmp', + 'ionic:serve' ]); }); + grunt.registerTask('emulate', function() { + return grunt.task.run(['ionic:emulate:' + this.args.join()]); + }); + grunt.registerTask('run', function() { + return grunt.task.run(['ionic:run:' + this.args.join()]); + }); + grunt.registerTask('build', function() { + return grunt.task.run(['ionic:build:' + this.args.join()]); + }); grunt.registerTask('test', [ - 'clean:server', + 'clean', 'concurrent:test', 'autoprefixer', 'karma:unit:start', 'watch:karma' ]); - grunt.registerTask('build', [ - 'clean:dist', + grunt.registerTask('compress', [ + 'clean', 'ngconstant:production', 'wiredep', 'useminPrepare', @@ -525,17 +540,14 @@ module.exports = function (grunt) { 'cssmin', 'uglify', 'usemin', - 'htmlmin', - 'cordova:build' + 'htmlmin' ]); - grunt.registerTask('cordova', ['copy:all', 'cordova:build']); - grunt.registerTask('coverage', ['karma:continuous', 'connect:coverage:keepalive']); grunt.registerTask('default', [ 'newer:jshint', 'karma:continuous', - 'build' + 'compress' ]); }; diff --git a/templates/common/_bowerrc b/templates/common/_bowerrc index acec9ae..29be34c 100644 --- a/templates/common/_bowerrc +++ b/templates/common/_bowerrc @@ -1,3 +1,3 @@ { - "directory": "<%= appPath %>/bower_components" + "directory": "<%= appPath %>/lib" } diff --git a/templates/common/_package.json b/templates/common/_package.json index ad2c748..53e7c4b 100644 --- a/templates/common/_package.json +++ b/templates/common/_package.json @@ -8,6 +8,7 @@ "glob": "~4.0.5", "grunt-autoprefixer": "~0.4.0", "grunt-wiredep": "^1.7.0", + "ionic": "^1.2.7", "grunt-concurrent": "~0.4.1", "grunt-contrib-clean": "~0.5.0",<% if (compass) { %> "grunt-contrib-compass": "~0.6.0",<% } %> From b175e3d12d460626d8f4663790390acd6b770397 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 11:35:59 -0500 Subject: [PATCH 15/39] feature(generator): Pass CLI flags to cordova wrapper functions. Closes #97 and #107 --- templates/common/Gruntfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 948f2ce..7462c51 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -420,7 +420,8 @@ module.exports = function (grunt) { var done = this.async(); var exec = process.platform === 'win32' ? 'cordova.cmd' : 'cordova'; var cmd = path.resolve('./node_modules/cordova/bin', exec); - var child = spawn(cmd, this.args); + var flags = process.argv.splice(3); + var child = spawn(cmd, this.args.concat(flags)); child.stdout.on('data', function (data) { grunt.log.writeln(data); }); From 9460d2f73d44c13ef282fb7f5dfb5146238fac57 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 16:02:06 -0500 Subject: [PATCH 16/39] docs(README): Begin documentation overhaul --- README.md | 299 ++++++++++++------------------------------------------ 1 file changed, 66 insertions(+), 233 deletions(-) diff --git a/README.md b/README.md index 84fe515..fff4e53 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,28 @@ -![](http://i.imgur.com/BGrt2QK.png) - -## Ionic Framework generator [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] [![Gittip][gittip-image]][gittip-url] - -> Yeoman generator for Ionic - lets you quickly set up a hybrid mobile app project - -**Note**: This was formally packaged under `generator-ionicjs`, but has been republished as `generator-ionic`. +

+ + + +

+ +## Ionic Framework generator [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] + +> Yeoman generator for creating Ionic hybrid mobile applications using AngularJS and Cordova - lets you quickly set up a project with sensible defaults and best practices. + +## Features + +- Scaffolding projects with Yeoman +- Integrated with the [ionic-cli](https://github.com/driftyco/ionic-cli) +- Browser livereload +- Emulator livereload +- Sass stylesheets compilation +- HTML, JavaScript and CSS obfuscation and minification +- Handles AngularJS dependency injection annotations +- Icons and Splashscreens support +- Environment Specific Configuration for AngularJS +- Linting JavaScript +- Running unit tests +- Code coverage reporting with [istanbul](https://github.com/gotwarlost/istanbul) +- Bundled [ripple emulator](http://ripple.incubator.apache.org/) ## Usage Install `generator-ionic` @@ -22,251 +40,66 @@ Run `yo ionic`, optionally passing an app name: yo ionic [app-name] ``` -Follow the prompts to select from some common plugins and pick a starter template, then spin up a `connect` server with `watch` and `livereload` for developing in your browser -``` -grunt serve -``` +Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compressed` for a preview of the optimized application. + ## Upgrading Make sure you've commited (or backed up) your local changes and install the latest version of the generator via `npm install -g generator-ionic`, then go ahead and re-run `yo ionic` inside your project's directory. The handsome devil is smart enough to figure out what files he is attempting to overwrite and prompts you to choose how you would like to proceed. Select `Y` for overwriting your `Gruntfile.js` and `bower.json` to stay up-to-date with the latest workflow goodies and front-end packages. -## Workflow -The included Grunt build system provides sensible defaults to help optimize and automate several aspects of your workflow when developing hybrid-mobile apps using the Ionic Framework. - -### Managing libraries with Bower -Install a new front-end library using `bower install --save` to update your `bower.json` file. -``` -bower install --save lodash -``` -This way, when the Grunt [`bower-install`](https://github.com/stephenplusplus/grunt-bower-install#grunt-bower-install) task is run it will automatically inject your front-end dependencies inside the `bower:js` block of your `app/index.html` file. - -### Manually adding libraries -If a library you wish to include is not registered with Bower or you wish to manually manage third party libraries, simply include any CSS and JavaScript files you need **inside** your `app/index.html` [usemin](https://github.com/yeoman/grunt-usemin#blocks) `build:js` or `build:css` blocks but **outside** the `bower:js` or `bower:css` blocks (since the Grunt task overwrites the Bower blocks' contents). - -### Local browser development -Running `grunt serve` enhances your workflow by allowing you to rapidly build Ionic apps without having to constantly re-run your platform simulator. Since we spin up a `connect` server with `watch` and `livereload` tasks, you can freely edit your CSS (or SCSS/SASS files if you chose to use Compass), HTML, and JavaScript files and changes will be quickly reflected in your browser. - -### Building assets for Cordova -Once you're ready to test your application in a simulator or device, run `grunt cordova` to copy all of your `app/` assets into `www/` and build updated `platform/` files so they are ready to be emulated / run by Cordova. - -To compress and optimize your application, run `grunt build`. It will concatenate, obfuscate, and minify your JavaScript, HTML, and CSS files and copy over the resulting assets into the `www/` directory so the compressed version can be used with Cordova. - -### Cordova commands -To make our lives a bit simpler, the `cordova` library has been packaged as a part of this generator and delegated via Grunt tasks. To invoke Cordova, simply run the command you would normally have, but replace `cordova` with `grunt` and `spaces` with `:` (the way Grunt chains task arguments). - -For example, lets say you want to add iOS as a platform target for your Ionic app -``` -grunt platform:add:ios -``` -and emulate a platform target -``` -grunt emulate:ios -``` -or add a plugin by specifying either its full repository URL or namespace from the [Plugins Registry](http://plugins.cordova.io) -``` -grunt plugin:add:https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git -grunt plugin:add:org.apache.cordova.device -grunt plugin:add:org.apache.cordova.network-information -``` -## Icons and Splash Screens -Properly configuring your app icons and splash screens to work with Cordova can be a pain to set up, so we've gone ahead and including an `after_prepare` hook that manages copying these resource files to the correct location within your current platform targets. - -To get started, you must first add a platform via `grunt platform:add:ios`. Once you have a platform, the packaged `icons_and_splashscreens.js` hook will copy over all placeholder icons and splash screens generated by Cordova into a newly created top-level `resources/` directory inside of your project. Simply replace these files with your own resources (**but maintain file names and directory structure**) and let the hook's magic automatically manage copying them to the appropriate location for each Cordova platform, all without interrupting your existing workflow. +## Project Structure -To learn more about hooks, checkout out the `README.md` file inside of your `hooks/` directory. +Overview -## Environment Specific Configuration -While building your Ionic app, you may find yourself working with multiple environments such as development, staging, and production. This generator uses [grunt-ng-constant] (https://github.com/werk85/grunt-ng-constant) to set up your workflow with development and production environment configurations right out of the box. + ├── Gruntfile.js - Configuration of all Grunt tasks + ├── package.json - Dev dependencies and required Cordova plugins + ├── bower.json - Lists front-end dependencies + ├── config.xml - Global Cordova configuration + ├── .gitignore - Best practices for checking in Cordova apps + ├── resources/ - Scaffolded placeholder Icons and Splashscreens + │ ├── ios/ + │ ├── android/ + ├── app/ + │ ├── index.html - Main Ionic app entry point + │ ├── lib/ - Libraries managed by Bower + │ ├── scripts/ - Custom AngularJS Scripts + │ ├── styles/ - Stylesheets + │ ├── templates/ - HTML views + ├── platforms/ - Targeted operating systems + ├── plugins/ - Native plugins + ├── hooks/ - Cordova lifecycle hooks + ├── merges/ - Platform specific overrides + ├── coverage/ - Istanbul reports + ├── test/ - Unit tests + │ ├── spec/ + ├── www/ - Used by Cordova and ionic-cli + -### Adding Constants -To set up your environment specific constants, modify the respective targets of the `ngconstant` task located towards the top of your Gruntfile. -``` - ngconstant: { - options: { - space: ' ', - wrap: '"use strict";\n\n {%= __ngModule %}', - name: 'config', - dest: '<%= yeoman.app %>/scripts/config.js' - }, - development: { - constants: { - ENV: { - name: 'development', - apiEndpoint: 'http://dev.your-site.com:10000/' - } - } - }, - production: { - constants: { - ENV: { - name: 'production', - apiEndpoint: 'http://api.your-site.com/' - } - } - } - }, -``` +## Workflow Commands -Running `grunt serve` will cause the `development` target constants to be used. When you build your application for production using `grunt build` or `grunt serve:dist`, the `production` constants will be used. Other targets, such as staging, can be added, but you will need to customize your Gruntfile accordingly. Note that if you change the `name` property of the task options, you will need to update your `app.js` module dependencies as well. +### `grunt serve[:compress]` -### Using Inside Angular -A `config.js` file is created by `grunt-ng-constant` depending on which task target is executed. This config file exposes a `config` module, that is listed as a dependency inside `app/scripts/app.js`. Out of the box, your constants will be namespaced under `ENV`, but this can be changed by modifying the `ngconstant` targets. It is important to note that whatever namespace value is chosen is what will need to be used for Dependency Injection inside your Angular functions. +### `grunt platform:add:` -The following example shows how to pre-process all outgoing HTTP request URLs with an environment specific API endpoint by creating a simple Angular `$http` interceptor. +### `grunt plugin:add:` -``` -// Custom Interceptor for replacing outgoing URLs -.factory('httpEnvInterceptor', function (ENV) { - return { - 'request': function(config) { - if (!_.contains(config.url, 'html')) { - config.url = ENV.apiEndpoint + config.url; - } - return config; - } - } -}) - -.config(function($httpProvider) { - // Pre-process outgoing request URLs - $httpProvider.interceptors.push('httpEnvInterceptor'); -}) -``` +### `grunt emulate:` -## Initial Walkthrough -To help you hit the ground running, let's walk through an example workflow together. We're assuming you've followed the [usage](https://github.com/diegonetto/generator-ionic#usage) directions and are inside your app's directory. +### `grunt compress` -We'll start by running our app in a browser so we can make a few changes. -``` -grunt serve -``` -Play around with livereload by changing some of the styles in `app/styles/main.css` or HTML in one of the files in `app/templates/`. When you're ready, lets go ahead and build the assets for Cordova to consume and also spot check that we didn't bork any code during the build process. We can do that with another handy Grunt task that runs the build process and then launches a `connect` server for use to preview the app with our built assets. -``` -grunt serve:dist -``` -If everything looks good the next step is to add a platform target and then emulate our app. In order for us to launch the iOS simulator from the command line, we'll have to install the `ios-sim` package. (If you forget to do this, Cordova will kindly remind you). -``` -npm install -g ios-sim -grunt platform:add:ios -grunt emulate:ios -``` -You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. +### `grunt serve:dist` -## Android Walkthrough -Research & Contribution by @ltfschoen (Luke Schoen) - -- Install Generator Ionic -``` -npm cache clear -npm install -g generator-ionic -mkdir my-ionic-project && cd $_ -yo ionic -``` -- Execute the following command in Terminal program to run a web server on your localhost. This will automatically open a tab in your default web browser at the following address and load your app http://127.0.0.1:9000/ -``` -grunt serve -``` -- Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) -- On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip -- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary in order to allow you to use the 'android' command and avoid encountering the following error: -``` -[Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] -``` -- Execute the following command in the Terminal program to edit your Bash Profile document: -``` -touch ~/.bash_profile; open ~/.bash_profile -``` -- Copy and Paste the following at the top of the file (without removing existing data within the file). Replace all instances of adt-bundle-mac-x86_64-20140702 that are shown below with the filename of the ZIP file that you downloaded. Save and close the file. -``` -export PATH=/user/local/bin:$PATH -export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools -export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools -``` -- Execute the updated Bash Profile with the following command in the Terminal program to update the PATH: -``` -source ~/.bash_profile -``` -- Execute the following command in Terminal program to install Apache Ant using Homebrew -``` -brew install ant -``` -- Note: The above step may be necessary to avoid encountering the following error: -``` -Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. -``` -- Execute the following command in Terminal program to open the Android Package Manager (APM): -``` -android -``` -- In the APM, expand Android 4.4.2 (API 19). Click checkboxes to install "SDK Platform" and "ARM EABI v7A System Image". Click "Install Packages..." -- Go to the Android SDK Manager menu in the top left of your screen. Click the "Tools" dropdown menu. Click "Manage AVDs...". This opens the AVD (Android Virtual Device) Manager. Click to select the device listed (i.e. default is AVD_for_Nexus Android 4.4.2). Click the "Repair..." Button on the right panel. Click the "Refresh" Button at the bottom right. Close the window. -- Execute the following command in Terminal program to install the Android Debug Bridge: -``` -brew install android-platform-tools -``` -- Note: The above steps may be necessary to avoid encountering the following errors: -``` -Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools. -Error executing "adb devices": /bin/sh: adb: command not found -emulator: ERROR: This AVD's configuration is missing a kernel file!! -``` -- Add the Android Platform with the following commands in Terminal program. No warnings or errors should be encountered. Note that it may take a while to load your app in the Android emulator. -``` -grunt platform:add:android -grunt build -grunt emulate:android -``` - -## Testing Your App -To lessen the pain of testing your application, this generator configures your project with a handful of libraries that will hopefully make testing your application, dare I say, more enjoyable. - -![Comic](http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/100000/10000/6000/600/116640/116640.strip.gif) - -### Unit Tests -The foundation of our testing solution is built using [Karma](http://karma-runner.github.io/) which was created by the AngularJS team and is all around awesome. Inside of your generated `karma.conf.js` file you will find some basic configuration settings. Notice that we're using [Mocha](http://visionmedia.github.io/mocha/) to structure our tests and pulling in [Chai](http://chaijs.com/), a slick assertion library. You can easily drop Chai and replace Mocha with [Jasmine](http://jasmine.github.io/) depending on your preference. - -Your generated `Gruntfile.js` also contains a `karma` task that provides further configuration. Any properties specified via this task will override the values inside `karma.conf.js` when run via `grunt`. If you look closely at this task, you'll notice that we're using [PhantomJS](http://phantomjs.org/) for both Karma targets, but you can easily update the `karma:unit` target to run tests inside of real browsers. - -Ok, now that you have some context (and links to read up on the bundled testing libraries), go ahead and run `grunt test` and open up one of the included unit tests - `test/spec/controllers.js`. In your editor of choice, change this line - `scope.pets.should.have.length(4);` to any number other than four and watch what happens. Since your test files are being watched for changes, Grunt knows to go ahead and re-run your test suite, which in this cause should have errored out with a failure message being displayed in your terminal. - -Undo your modification and ensure that all tests are passing before continuing on. - -**Note** Depending on which starter template you picked, your tests may start off failing. - -### End2End Tests -Coming soon! - -### Code Coverage -So you've finished writing your tests, why not showoff just how watertight your application has become? Using [Istanbul](http://gotwarlost.github.io/istanbul/) - which was built at Yahoo - we can generate visually engaging code coverage reports that do just that! - -Our beloved generator has done all the hard work for you, so go ahead and see these coverage reports in action by running `grunt coverage`. - -If this is your first time using Istanbul, take a look around. It will help you spot gaps in your unit tests and lets face it, the more visual gratification we can get during our testing stage, the greater the likelihood of us sitting down and writing these tests to begin with! - -## Wrapping it up -If you made it this far then congratulations! You're now up and running with the gorgeous Ionic Framework powered by an intelligent workflow and sophisticated build system - all facilitated by the addition of just a few commands! - -## Ripple Emulator (Experimental) -**Be Advised**: [Ripple](http://ripple.incubator.apache.org/) is under active development so expect support for some plugins to be missing or broken. - -Add a platform target then run `grunt ripple` to launch the emulator in your browser. -``` -grunt platform:add:ios -grunt ripple -``` +### `grunt jshint` -Now go edit a file and then refresh your browser to see your changes. (Currently experimenting with livereload for Ripple) +### `grunt karma:continuous` -**Note**: If you get errors beginning with `Error: static() root path required`, don't fret. Ripple defaults the UI to Android so just switch to an iOS device and you'll be good to go. +### `grunt coverage` -![Ripple](http://i.imgur.com/LA4Hip1l.png) +### `grunt ripple` +## Documentation -## Special Thanks To -* The pioneers behind [Yeoman](http://yeoman.io/) for building an intelligent workflow management solution. -* The [AngularJS Generator](https://github.com/yeoman/generator-angular) and [Ionic Seed Project](https://github.com/driftyco/ionic-angular-cordova-seed) projects for inspiration. -* The visionaries at [Drifty](http://drifty.com) for creating the [Ionic Framework](http://ionicframework.com/). +For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md) ## Contribute @@ -285,7 +118,7 @@ For testing & debugging the generator please refer to the Yeoman Generator [test ## License -[MIT License](http://en.wikipedia.org/wiki/MIT_License) +[MIT License](http://opensource.org/licenses/mit-license.php) [travis-image]: http://img.shields.io/travis/diegonetto/generator-ionic.svg?style=flat [travis-url]: https://travis-ci.org/diegonetto/generator-ionic From d2e809149b5548c4522cdbfe9ab5b3bc4f382241 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 18:41:38 -0500 Subject: [PATCH 17/39] docs(readme): Add description for each command. --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fff4e53..4e58721 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ - Scaffolding projects with Yeoman - Integrated with the [ionic-cli](https://github.com/driftyco/ionic-cli) -- Browser livereload -- Emulator livereload +- Browser LiveReload +- Emulator LiveReload - Sass stylesheets compilation - HTML, JavaScript and CSS obfuscation and minification - Handles AngularJS dependency injection annotations @@ -40,7 +40,7 @@ Run `yo ionic`, optionally passing an app name: yo ionic [app-name] ``` -Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compressed` for a preview of the optimized application. +Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compress` for a preview of the optimized application. ## Upgrading Make sure you've commited (or backed up) your local changes and install the latest version of the generator via `npm install -g generator-ionic`, then go ahead and re-run `yo ionic` inside your project's directory. @@ -72,31 +72,68 @@ Overview ├── coverage/ - Istanbul reports ├── test/ - Unit tests │ ├── spec/ - ├── www/ - Used by Cordova and ionic-cli + ├── www/ - Copied from app/ to be used by Cordova ## Workflow Commands ### `grunt serve[:compress]` +Run a local development server with built in filesystem watching support integrated with LiveReload so you can develop your Ionic app in a browser. Since this command uses the `ionic-cli` under the hood, you can specify any command line flags / options shown [here](https://github.com/driftyco/ionic-cli#testing-in-a-browser). + + $ grunt serve --consolelogs + $ grunt serve:compress + ### `grunt platform:add:` +Add a supported Cordova platform as a build target for this project. + + $ grunt platform:add:ios + $ grunt platform:add:android + ### `grunt plugin:add:` -### `grunt emulate:` +Install a native Cordova plugin either by [registry name](http://plugins.cordova.io/) or repository URL. + + $ grunt plugin add:https://github.com/driftyco/ionic-plugins-keyboard.git + $ grunt plugin:add:org.apache.cordova.device + $ grunt plugin:add:org.apache.cordova.network-information + +### `grunt [emulate|run]:` + +Either `emulate` your Ionic app inside a simulator or `run` it on a connected device, optionally enabling LiveReload support to supercharge your development speed and enhance productivity. __Note:__ Any changes to native plugins will still require a full rebuild. This command also uses the `ionic-cli` under the hood, so these [additional flags](https://github.com/driftyco/ionic-cli/blob/master/README.md#live-reload-app-during-development-beta) can be specified. + + $ grunt emulate:ios --livereload + $ grunt emulate:ios --lc + $ grunt emulate:android --consolelogs + + $ grunt run:ios + $ grunt run:android ### `grunt compress` -### `grunt serve:dist` +Run your Ionic application files located in `app/` through the concatenation, obfuscation, and minification pipelines and write the optimized assets to the `www/` directory, which allows them to be consumed by either the `cordova` or `ionic` command line tools for packaging. + +### `grunt serve:compress` + +This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application. ### `grunt jshint` -### `grunt karma:continuous` +While running `grunt serve` or `grunt emulate`, the build system will be watching your filesystem for changes and linting your JavaScript files on the fly. However, you can invoke JSHint manually by using this command to spot check your Ionic app for linting errors. + +### `grunt karma` + +Launches the configured `karma` test running framework using PhantomJS. ### `grunt coverage` +Generates a static site containing code coverage reports for your unit tests using [Istanbul](http://gotwarlost.github.io/istanbul/). + ### `grunt ripple` +Launch the bundled [Ripple](http://ripple.incubator.apache.org/) emulator by first adding a platform via `grunt platform:add:` and then running this command. + ## Documentation For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md) From 71d76dd3529b483cc465dd6d50ec81f0dc256d01 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 19:29:15 -0500 Subject: [PATCH 18/39] docs(readme): Clean up some descriptions --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e58721..31f052a 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Add a supported Cordova platform as a build target for this project. Install a native Cordova plugin either by [registry name](http://plugins.cordova.io/) or repository URL. - $ grunt plugin add:https://github.com/driftyco/ionic-plugins-keyboard.git + $ grunt plugin:add:https://github.com/driftyco/ionic-plugins-keyboard.git $ grunt plugin:add:org.apache.cordova.device $ grunt plugin:add:org.apache.cordova.network-information @@ -105,6 +105,7 @@ Either `emulate` your Ionic app inside a simulator or `run` it on a connected de $ grunt emulate:ios --livereload $ grunt emulate:ios --lc + $ grunt emulate:ios --target=iPad -lc $ grunt emulate:android --consolelogs $ grunt run:ios @@ -116,7 +117,14 @@ Run your Ionic application files located in `app/` through the concatenation, ob ### `grunt serve:compress` -This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application. +This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application in a browser. + +### `grunt build:` + +Build your Ionic application for the targeted platform. + + $ grunt build:ios --device --release + $ grunt build:android --debug ### `grunt jshint` From edae7337a51bb9d2648351c17dbcc5ffe34b4502 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 20:27:03 -0500 Subject: [PATCH 19/39] bug(generator): Fix JSHint errors. Closes #113 --- templates/common/root/.jshintignore | 1 + templates/common/root/.jshintrc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 templates/common/root/.jshintignore diff --git a/templates/common/root/.jshintignore b/templates/common/root/.jshintignore new file mode 100644 index 0000000..c67cf8c --- /dev/null +++ b/templates/common/root/.jshintignore @@ -0,0 +1 @@ +app/scripts/config.js diff --git a/templates/common/root/.jshintrc b/templates/common/root/.jshintrc index 40377ba..5d260e4 100644 --- a/templates/common/root/.jshintrc +++ b/templates/common/root/.jshintrc @@ -19,6 +19,8 @@ "trailing": true, "smarttabs": true, "globals": { - "angular": false + "angular": false, + "cordova": false, + "StatusBar": false } } From d1e9d50bb099fac4f3f529f240a02fb75a354e3e Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 20:27:52 -0500 Subject: [PATCH 20/39] bug(generator): Fix issue when running emulate/run before serve --- templates/common/Gruntfile.js | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 7462c51..c5f4b39 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -3,7 +3,7 @@ var _ = require('lodash'); var path = require('path'); -var cordova = require('cordova'); +var cordovaCli = require('cordova'); var spawn = require('child_process').spawn; module.exports = function (grunt) { @@ -410,7 +410,7 @@ module.exports = function (grunt) { }); // Register tasks for all Cordova commands - _.functions(cordova).forEach(function (name) { + _.functions(cordovaCli).forEach(function (name) { grunt.registerTask(name, function () { this.args.unshift(name.replace('cordova:', '')); // Handle URL's being split up by Grunt because of `:` characters @@ -494,40 +494,42 @@ module.exports = function (grunt) { return grunt.task.run(['watch']); }); + + grunt.registerTask('test', [ + 'clean', + 'concurrent:test', + 'autoprefixer', + 'karma:unit:start', + 'watch:karma' + ]); grunt.registerTask('serve', function (target) { if (target === 'compress') { return grunt.task.run(['compress', 'ionic:serve']); } - grunt.task.run([ - 'clean', - 'ngconstant:development', - 'wiredep', - 'concurrent:server', - 'autoprefixer', - 'newer:copy:app', - 'newer:copy:tmp', - 'ionic:serve' - ]); + grunt.task.run(['init', 'ionic:serve']); }); grunt.registerTask('emulate', function() { - return grunt.task.run(['ionic:emulate:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:emulate:' + this.args.join()]); }); grunt.registerTask('run', function() { - return grunt.task.run(['ionic:run:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:run:' + this.args.join()]); }); grunt.registerTask('build', function() { - return grunt.task.run(['ionic:build:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:build:' + this.args.join()]); }); - grunt.registerTask('test', [ + grunt.registerTask('init', [ 'clean', - 'concurrent:test', + 'ngconstant:development', + 'wiredep', + 'concurrent:server', 'autoprefixer', - 'karma:unit:start', - 'watch:karma' + 'newer:copy:app', + 'newer:copy:tmp' ]); + grunt.registerTask('compress', [ 'clean', 'ngconstant:production', From c599a1ef92e8567100e37b1cb9db85b9219a3291 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 00:43:54 -0500 Subject: [PATCH 21/39] feature(generator): Add support for Plugin management hooks. Closes #72 --- app/index.js | 3 +-- templates/common/_gitignore | 2 +- .../after_platform_add/install_plugins.js | 19 +++++++++++++++++++ .../after_plugin_add/register_plugins.js | 17 +++++++++++++++++ .../after_plugin_rm/deregister_plugins.js | 15 +++++++++++++++ .../before_platform_add/init_directories.js | 19 +++++++++++++++++++ 6 files changed, 72 insertions(+), 3 deletions(-) create mode 100755 templates/hooks/after_platform_add/install_plugins.js create mode 100755 templates/hooks/after_plugin_add/register_plugins.js create mode 100755 templates/hooks/after_plugin_rm/deregister_plugins.js create mode 100755 templates/hooks/before_platform_add/init_directories.js diff --git a/app/index.js b/app/index.js index df36776..8d09774 100644 --- a/app/index.js +++ b/app/index.js @@ -161,8 +161,7 @@ IonicGenerator.prototype.packageFiles = function packageFiles() { }; IonicGenerator.prototype.cordovaHooks = function cordovaHooks() { - var iconsAndSplash = 'hooks/after_prepare/icons_and_splashscreens.js'; - this.template(iconsAndSplash); + this.directory('hooks', 'hooks', true); }; IonicGenerator.prototype.hookPerms = function hookPerms() { diff --git a/templates/common/_gitignore b/templates/common/_gitignore index cc8f3fa..ab62996 100644 --- a/templates/common/_gitignore +++ b/templates/common/_gitignore @@ -2,7 +2,7 @@ node_modules www .tmp .sass-cache -<%= appPath %>/bower_components +<%= appPath %>/lib coverage platforms plugins diff --git a/templates/hooks/after_platform_add/install_plugins.js b/templates/hooks/after_platform_add/install_plugins.js new file mode 100755 index 0000000..37ea854 --- /dev/null +++ b/templates/hooks/after_platform_add/install_plugins.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +/** + * Install all plugins listed in package.json + */ +var exec = require('child_process').exec; +var path = require('path'); +var sys = require('sys'); + +var packageJSON = require('../../package.json'); +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(script + ' plugin add ' + plugin, function (error, stdout, stderr) { + sys.puts(stdout); + }); +}); diff --git a/templates/hooks/after_plugin_add/register_plugins.js b/templates/hooks/after_plugin_add/register_plugins.js new file mode 100755 index 0000000..dc1042b --- /dev/null +++ b/templates/hooks/after_plugin_add/register_plugins.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +/** + * Push plugins to cordovaPlugins array after_plugin_add + */ +var fs = require('fs'); +var _ = require('lodash'); +var packageJSON = require('../../package.json'); + +packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; +_.each(process.env.CORDOVA_PLUGINS.split(','), function (plugin) { + if (! _.contains(packageJSON.cordovaPlugins, plugin)) { + packageJSON.cordovaPlugins.push(plugin); + } +}); + +fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2)); diff --git a/templates/hooks/after_plugin_rm/deregister_plugins.js b/templates/hooks/after_plugin_rm/deregister_plugins.js new file mode 100755 index 0000000..14ca171 --- /dev/null +++ b/templates/hooks/after_plugin_rm/deregister_plugins.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node + +/** + * Remove plugins from cordovaPlugins array after_plugin_rm + */ +var fs = require('fs'); +var _ = require('lodash'); +var packageJSON = require('../../package.json'); + +packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; +_.each(process.env.CORDOVA_PLUGINS.split(','), function (plugin) { + _.remove(packageJSON.cordovaPlugins, function (p) { return p === plugin; }); +}); + +fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2)); diff --git a/templates/hooks/before_platform_add/init_directories.js b/templates/hooks/before_platform_add/init_directories.js new file mode 100755 index 0000000..1d8a26a --- /dev/null +++ b/templates/hooks/before_platform_add/init_directories.js @@ -0,0 +1,19 @@ +#!/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 mkdirp = require('mkdirp'); +var path = require('path'); + +var platformsDir = path.resolve(__dirname, '../../platforms'); +var pluginsDir = path.resolve(__dirname, '../../plugins'); + +mkdirp(platformsDir, function (err) { + if (err) { console.error(err); } +}); + +mkdirp(pluginsDir, function (err) { + if (err) { console.error(err); } +}); From f6f9e0fcd472ef7bbb6fef3038064e2f0d91b8f8 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 11:20:23 -0500 Subject: [PATCH 22/39] feat(generator): Add ionic-cli support. Closes #112 --- templates/common/Gruntfile.js | 150 ++++++++++++++++++--------------- templates/common/_bowerrc | 2 +- templates/common/_package.json | 1 + 3 files changed, 83 insertions(+), 70 deletions(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 5d3b848..948f2ce 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -59,37 +59,27 @@ module.exports = function (grunt) { watch: { bower: { files: ['bower.json'], - tasks: ['wiredep'] + tasks: ['wiredep', 'newer:copy:app'] + }, + html: { + files: ['<%%= yeoman.app %>/**/*.html'], + tasks: ['newer:copy:app'] }, js: { files: ['<%%= yeoman.app %>/<%%= yeoman.scripts %>/**/*.js'], - tasks: ['newer:jshint:all'], - options: { - livereload: true - } + tasks: ['newer:copy:app', 'newer:jshint:all'] },<% if (compass) { %> compass: { files: ['<%%= yeoman.app %>/<%%= yeoman.styles %>/**/*.{scss,sass}'], - tasks: ['compass:server', 'autoprefixer'] + tasks: ['compass:server', 'autoprefixer', 'newer:copy:tmp'] },<% } else { %> styles: { files: ['<%%= yeoman.app %>/<%%= yeoman.styles %>/**/*.css'], - tasks: ['newer:copy:styles', 'autoprefixer'] + tasks: ['newer:copy:styles', 'autoprefixer', 'newer:copy:tmp'] },<% } %> gruntfile: { files: ['Gruntfile.js'], - tasks: ['ngconstant:development'] - }, - livereload: { - options: { - livereload: '<%%= connect.options.livereload %>' - }, - files: [ - '<%%= yeoman.app %>/*.html', - '<%%= yeoman.app %>/templates/**/*.html', - '.tmp/<%%= yeoman.styles %>/**/*.css', - '<%%= yeoman.app %>/<%%= yeoman.images %>/**/*.{png,jpg,jpeg,gif,webp,svg}' - ] + tasks: ['ngconstant:development', 'newer:copy:app'] } }, @@ -98,17 +88,7 @@ module.exports = function (grunt) { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. - hostname: 'localhost', - livereload: 35729 - }, - livereload: { - options: { - open: true, - base: [ - '.tmp', - '<%%= yeoman.app %>' - ] - } + hostname: 'localhost' }, dist: { options: { @@ -179,7 +159,7 @@ module.exports = function (grunt) { }<% if (compass) { %>, sass: { src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], - ignorePath: /(\.\.\/){1,2}bower_components\// + ignorePath: /(\.\.\/){1,2}lib\// }<% } %> }, @@ -189,13 +169,13 @@ module.exports = function (grunt) { options: { sassDir: '<%%= yeoman.app %>/<%%= yeoman.styles %>', cssDir: '.tmp/<%%= yeoman.styles %>', - generatedImagesDir: '.tmp/img/generated', - imagesDir: '<%%= yeoman.app %>/img', + generatedImagesDir: '.tmp/<%%= yeoman.images %>/generated', + imagesDir: '<%%= yeoman.app %>/<%%= yeoman.images %>', javascriptsDir: '<%%= yeoman.app %>/<%%= yeoman.scripts %>', fontsDir: '<%%= yeoman.app %>/<%%= yeoman.styles %>/fonts', - importPath: '<%%= yeoman.app %>/bower_components', - httpImagesPath: '/img', - httpGeneratedImagesPath: '/img/generated', + importPath: '<%%= yeoman.app %>/lib', + httpImagesPath: '/<%%= yeoman.images %>', + httpGeneratedImagesPath: '/<%%= yeoman.images %>/generated', httpFontsPath: '/<%%= yeoman.styles %>/fonts', relativeAssets: false, assetCacheBuster: false, @@ -203,7 +183,7 @@ module.exports = function (grunt) { }, dist: { options: { - generatedImagesDir: '<%%= yeoman.dist %>/img/generated' + generatedImagesDir: 'www/<%%= yeoman.images %>/generated' } }, server: { @@ -275,7 +255,7 @@ module.exports = function (grunt) { cwd: '<%%= yeoman.app %>', dest: 'www', src: [ - 'images/**/*.{png,jpg,jpeg,gif,webp,svg}', + '<%%= yeoman.images %>/**/*.{png,jpg,jpeg,gif,webp,svg}', '*.html', 'templates/**/*.html', 'fonts/*' @@ -295,7 +275,7 @@ module.exports = function (grunt) { }, fonts: { expand: true, - cwd: 'app/bower_components/ionic/release/fonts/', + cwd: 'app/lib/ionic/release/fonts/', dest: '<%%= yeoman.app %>/fonts/', src: '*' }, @@ -305,11 +285,20 @@ module.exports = function (grunt) { dest: '.tmp/<%%= yeoman.styles %>/', src: '{,*/}*.css' }, - all: { + app: { + expand: true, + cwd: '<%%= yeoman.app %>', + dest: 'www/', + src: [ + '**/*', + '!**/*.(scss,sass,css)', + ] + }, + tmp: { expand: true, - cwd: '<%%= yeoman.app %>/', - src: '**', - dest: 'www/' + cwd: '.tmp', + dest: 'www/', + src: '**/*' } }, @@ -367,13 +356,13 @@ module.exports = function (grunt) { basePath: '', frameworks: ['mocha', 'chai'], files: [ - '<%%= yeoman.app %>/bower_components/angular/angular.js', - '<%%= yeoman.app %>/bower_components/angular-animate/angular-animate.js', - '<%%= yeoman.app %>/bower_components/angular-sanitize/angular-sanitize.js', - '<%%= yeoman.app %>/bower_components/angular-ui-router/release/angular-ui-router.js', - '<%%= yeoman.app %>/bower_components/ionic/release/js/ionic.js', - '<%%= yeoman.app %>/bower_components/ionic/release/js/ionic-angular.js', - '<%%= yeoman.app %>/bower_components/angular-mocks/angular-mocks.js', + '<%%= yeoman.app %>/lib/angular/angular.js', + '<%%= yeoman.app %>/lib/angular-animate/angular-animate.js', + '<%%= yeoman.app %>/lib/angular-sanitize/angular-sanitize.js', + '<%%= yeoman.app %>/lib/angular-ui-router/release/angular-ui-router.js', + '<%%= yeoman.app %>/lib/ionic/release/js/ionic.js', + '<%%= yeoman.app %>/lib/ionic/release/js/ionic-angular.js', + '<%%= yeoman.app %>/lib/angular-mocks/angular-mocks.js', '<%%= yeoman.app %>/<%%= yeoman.scripts %>/**/*.js', 'test/mock/**/*.js', 'test/spec/**/*.js' @@ -420,10 +409,8 @@ module.exports = function (grunt) { }); - // Register tasks for all Cordova commands, but namespace - // the cordova:build since we already have a build task. + // Register tasks for all Cordova commands _.functions(cordova).forEach(function (name) { - name = (name === 'build') ? 'cordova:build' : name; grunt.registerTask(name, function () { this.args.unshift(name.replace('cordova:', '')); // Handle URL's being split up by Grunt because of `:` characters @@ -441,7 +428,7 @@ module.exports = function (grunt) { grunt.log.error(data); }); child.on('close', function (code) { - code = (name === 'cordova:build') ? true : code ? false : true; + code = code ? false : true; done(code); }); }); @@ -452,12 +439,12 @@ module.exports = function (grunt) { // over to www/. Last step is running cordova prepare so we can refresh the ripple // browser tab to see the changes. Technically ripple runs `cordova prepare` on browser // refreshes, but at this time you would need to re-run the emulator to see changes. - grunt.registerTask('ripple', ['wiredep', 'copy:all', 'ripple-emulator']); + grunt.registerTask('ripple', ['wiredep', 'newer:copy:app', 'ripple-emulator']); grunt.registerTask('ripple-emulator', function () { grunt.config.set('watch', { all: { files: _.flatten(_.pluck(grunt.config.get('watch'), 'files')), - tasks: ['copy:all', 'prepare'] + tasks: ['newer:copy:app', 'prepare'] } }); @@ -488,32 +475,60 @@ module.exports = function (grunt) { return grunt.task.run(['watch']); }); + // Wrap ionic-cli commands + grunt.registerTask('ionic', function() { + var script = path.resolve('./node_modules/ionic/bin/', 'ionic'); + var flags = process.argv.splice(3); + var child = spawn(script, this.args.concat(flags)); + child.stdout.on('data', function (data) { + grunt.log.writeln(data); + }); + child.stderr.on('data', function (data) { + grunt.log.error(data); + }); + process.on('exit', function (code) { + child.kill('SIGINT'); + process.exit(code); + }); + + return grunt.task.run(['watch']); + }); grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'connect:dist:keepalive']); + if (target === 'compress') { + return grunt.task.run(['compress', 'ionic:serve']); } grunt.task.run([ - 'clean:server', + 'clean', 'ngconstant:development', 'wiredep', 'concurrent:server', 'autoprefixer', - 'connect:livereload', - 'watch' + 'newer:copy:app', + 'newer:copy:tmp', + 'ionic:serve' ]); }); + grunt.registerTask('emulate', function() { + return grunt.task.run(['ionic:emulate:' + this.args.join()]); + }); + grunt.registerTask('run', function() { + return grunt.task.run(['ionic:run:' + this.args.join()]); + }); + grunt.registerTask('build', function() { + return grunt.task.run(['ionic:build:' + this.args.join()]); + }); grunt.registerTask('test', [ - 'clean:server', + 'clean', 'concurrent:test', 'autoprefixer', 'karma:unit:start', 'watch:karma' ]); - grunt.registerTask('build', [ - 'clean:dist', + grunt.registerTask('compress', [ + 'clean', 'ngconstant:production', 'wiredep', 'useminPrepare', @@ -525,17 +540,14 @@ module.exports = function (grunt) { 'cssmin', 'uglify', 'usemin', - 'htmlmin', - 'cordova:build' + 'htmlmin' ]); - grunt.registerTask('cordova', ['copy:all', 'cordova:build']); - grunt.registerTask('coverage', ['karma:continuous', 'connect:coverage:keepalive']); grunt.registerTask('default', [ 'newer:jshint', 'karma:continuous', - 'build' + 'compress' ]); }; diff --git a/templates/common/_bowerrc b/templates/common/_bowerrc index acec9ae..29be34c 100644 --- a/templates/common/_bowerrc +++ b/templates/common/_bowerrc @@ -1,3 +1,3 @@ { - "directory": "<%= appPath %>/bower_components" + "directory": "<%= appPath %>/lib" } diff --git a/templates/common/_package.json b/templates/common/_package.json index ad2c748..53e7c4b 100644 --- a/templates/common/_package.json +++ b/templates/common/_package.json @@ -8,6 +8,7 @@ "glob": "~4.0.5", "grunt-autoprefixer": "~0.4.0", "grunt-wiredep": "^1.7.0", + "ionic": "^1.2.7", "grunt-concurrent": "~0.4.1", "grunt-contrib-clean": "~0.5.0",<% if (compass) { %> "grunt-contrib-compass": "~0.6.0",<% } %> From b2821f49923915f91752df26cd68e3e22320c0eb Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 11:35:59 -0500 Subject: [PATCH 23/39] feat(generator): Pass CLI flags to cordova wrapper functions. Closes #97 and #107 --- templates/common/Gruntfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 948f2ce..7462c51 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -420,7 +420,8 @@ module.exports = function (grunt) { var done = this.async(); var exec = process.platform === 'win32' ? 'cordova.cmd' : 'cordova'; var cmd = path.resolve('./node_modules/cordova/bin', exec); - var child = spawn(cmd, this.args); + var flags = process.argv.splice(3); + var child = spawn(cmd, this.args.concat(flags)); child.stdout.on('data', function (data) { grunt.log.writeln(data); }); From e8701b52d2629d6899aa1d49d5d93580b71430ae Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:30:36 +1000 Subject: [PATCH 24/39] Updated Readme with Android Walkthrough --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/README.md b/README.md index 45ae7c6..50645d6 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,70 @@ grunt emulate:ios ``` You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. +## Android Walkthrough (Research & Contribution by Luke Schoen @ltfschoen) + +- Install Generator Ionic +``` +npm cache clear +npm install -g generator-ionic +mkdir my-ionic-project && cd $_ +yo ionic +``` +- Run web server on your localhost: +``` +grunt serve +``` +- Download the latest [Android SDK](https://developer.android.com/sdk/index.html#download) +- On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip +- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: +``` +[Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] +``` +- Execute the following command in Terminal program to edit your Bash Profile document: +``` +touch ~/.bash_profile; open ~/.bash_profile +``` +- Copy and Paste the following at the top of the file (without removing existing data). Replace all instances below of adt-bundle-mac-x86_64-20140702 with the filename of the ZIP file that you downloaded. Save and close the file. +``` +export PATH=/user/local/bin:$PATH +export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools +export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools +``` +- Execute the updated Bash Profile with the following command in Terminal program to update the PATH: +``` +source ~/.bash_profile +``` +- Execute the following command in Terminal program to install Apache Ant using Homebrew +``` +brew install ant +``` +- Note: This step may be necessary to avoid encountering the following error: +``` +Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. +``` +- Execute the following command in Terminal program to open the Android Package Manager (APM): +``` +android +``` +- In the APM, expand Android 4.4.2 (API 19). Click checkboxes to install "SDK Platform" and "ARM EABI v7A System Image". Click "Install Packages..." +- Go to the Android SDK Manager menu in the top left of your screen. Click the "Tools" dropdown menu. Click "Manage AVDs...". This opens the AVD (Android Virtual Device) Manager. Click to select the device listed (i.e. default is AVD_for_Nexus Android 4.4.2). Click the "Repair..." Button on the right panel. Click the "Refresh" Button at the bottom right. Close the window. +- Execute the following command in Terminal program to install the Android Debug Bridge: +``` +brew install android-platform-tools +``` +- Note: The above steps may be necessary to avoid encountering the following errors: +``` +Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools. +Error executing "adb devices": /bin/sh: adb: command not found +emulator: ERROR: This AVD's configuration is missing a kernel file!! +``` +- Add the Android Platform with the following commands in Terminal program. No warnings or errors should be encountered. Note that it may take a while to load your app in the Android emulator. +``` +grunt platform:add:android +grunt build +grunt emulate:android +``` + ## Testing Your App To lessen the pain of testing your application, this generator configures your project with a handful of libraries that will hopefully make testing your application, dare I say, more enjoyable. From d50a41b5231b4d86d9dcc871c557c1c5dca0acb6 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:32:28 +1000 Subject: [PATCH 25/39] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50645d6..1253ecc 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,8 @@ grunt emulate:ios ``` You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. -## Android Walkthrough (Research & Contribution by Luke Schoen @ltfschoen) +## Android Walkthrough +Research & Contribution by @ltfschoen (Luke Schoen) - Install Generator Ionic ``` From 5564a3431cae5c5147cf06aa24d84c5fe90e9b30 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:38:28 +1000 Subject: [PATCH 26/39] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1253ecc..191c715 100644 --- a/README.md +++ b/README.md @@ -163,11 +163,11 @@ npm install -g generator-ionic mkdir my-ionic-project && cd $_ yo ionic ``` -- Run web server on your localhost: +- Execute the following command in Terminal program to run a web server on your localhost. This will automatically open a tab in your default web browser at the following address and load your app http://127.0.0.1:9000/ ``` grunt serve ``` -- Download the latest [Android SDK](https://developer.android.com/sdk/index.html#download) +- Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) - On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip - Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: ``` From fae7b4f1f0604da1c2ebce66600f4ea44cfad0ad Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Mon, 8 Sep 2014 21:41:30 +1000 Subject: [PATCH 27/39] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 191c715..84fe515 100644 --- a/README.md +++ b/README.md @@ -169,21 +169,21 @@ grunt serve ``` - Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) - On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip -- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary so you may use the 'android' command and avoid encountering the following error: +- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary in order to allow you to use the 'android' command and avoid encountering the following error: ``` [Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] ``` -- Execute the following command in Terminal program to edit your Bash Profile document: +- Execute the following command in the Terminal program to edit your Bash Profile document: ``` touch ~/.bash_profile; open ~/.bash_profile ``` -- Copy and Paste the following at the top of the file (without removing existing data). Replace all instances below of adt-bundle-mac-x86_64-20140702 with the filename of the ZIP file that you downloaded. Save and close the file. +- Copy and Paste the following at the top of the file (without removing existing data within the file). Replace all instances of adt-bundle-mac-x86_64-20140702 that are shown below with the filename of the ZIP file that you downloaded. Save and close the file. ``` export PATH=/user/local/bin:$PATH export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools ``` -- Execute the updated Bash Profile with the following command in Terminal program to update the PATH: +- Execute the updated Bash Profile with the following command in the Terminal program to update the PATH: ``` source ~/.bash_profile ``` @@ -191,7 +191,7 @@ source ~/.bash_profile ``` brew install ant ``` -- Note: This step may be necessary to avoid encountering the following error: +- Note: The above step may be necessary to avoid encountering the following error: ``` Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. ``` From 1e5736ccc92e53bce6da78f207941f4796a49fe5 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 16:02:06 -0500 Subject: [PATCH 28/39] docs(README): Begin documentation overhaul --- README.md | 299 ++++++++++++------------------------------------------ 1 file changed, 66 insertions(+), 233 deletions(-) diff --git a/README.md b/README.md index 84fe515..fff4e53 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,28 @@ -![](http://i.imgur.com/BGrt2QK.png) - -## Ionic Framework generator [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] [![Gittip][gittip-image]][gittip-url] - -> Yeoman generator for Ionic - lets you quickly set up a hybrid mobile app project - -**Note**: This was formally packaged under `generator-ionicjs`, but has been republished as `generator-ionic`. +

+ + + +

+ +## Ionic Framework generator [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] + +> Yeoman generator for creating Ionic hybrid mobile applications using AngularJS and Cordova - lets you quickly set up a project with sensible defaults and best practices. + +## Features + +- Scaffolding projects with Yeoman +- Integrated with the [ionic-cli](https://github.com/driftyco/ionic-cli) +- Browser livereload +- Emulator livereload +- Sass stylesheets compilation +- HTML, JavaScript and CSS obfuscation and minification +- Handles AngularJS dependency injection annotations +- Icons and Splashscreens support +- Environment Specific Configuration for AngularJS +- Linting JavaScript +- Running unit tests +- Code coverage reporting with [istanbul](https://github.com/gotwarlost/istanbul) +- Bundled [ripple emulator](http://ripple.incubator.apache.org/) ## Usage Install `generator-ionic` @@ -22,251 +40,66 @@ Run `yo ionic`, optionally passing an app name: yo ionic [app-name] ``` -Follow the prompts to select from some common plugins and pick a starter template, then spin up a `connect` server with `watch` and `livereload` for developing in your browser -``` -grunt serve -``` +Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compressed` for a preview of the optimized application. + ## Upgrading Make sure you've commited (or backed up) your local changes and install the latest version of the generator via `npm install -g generator-ionic`, then go ahead and re-run `yo ionic` inside your project's directory. The handsome devil is smart enough to figure out what files he is attempting to overwrite and prompts you to choose how you would like to proceed. Select `Y` for overwriting your `Gruntfile.js` and `bower.json` to stay up-to-date with the latest workflow goodies and front-end packages. -## Workflow -The included Grunt build system provides sensible defaults to help optimize and automate several aspects of your workflow when developing hybrid-mobile apps using the Ionic Framework. - -### Managing libraries with Bower -Install a new front-end library using `bower install --save` to update your `bower.json` file. -``` -bower install --save lodash -``` -This way, when the Grunt [`bower-install`](https://github.com/stephenplusplus/grunt-bower-install#grunt-bower-install) task is run it will automatically inject your front-end dependencies inside the `bower:js` block of your `app/index.html` file. - -### Manually adding libraries -If a library you wish to include is not registered with Bower or you wish to manually manage third party libraries, simply include any CSS and JavaScript files you need **inside** your `app/index.html` [usemin](https://github.com/yeoman/grunt-usemin#blocks) `build:js` or `build:css` blocks but **outside** the `bower:js` or `bower:css` blocks (since the Grunt task overwrites the Bower blocks' contents). - -### Local browser development -Running `grunt serve` enhances your workflow by allowing you to rapidly build Ionic apps without having to constantly re-run your platform simulator. Since we spin up a `connect` server with `watch` and `livereload` tasks, you can freely edit your CSS (or SCSS/SASS files if you chose to use Compass), HTML, and JavaScript files and changes will be quickly reflected in your browser. - -### Building assets for Cordova -Once you're ready to test your application in a simulator or device, run `grunt cordova` to copy all of your `app/` assets into `www/` and build updated `platform/` files so they are ready to be emulated / run by Cordova. - -To compress and optimize your application, run `grunt build`. It will concatenate, obfuscate, and minify your JavaScript, HTML, and CSS files and copy over the resulting assets into the `www/` directory so the compressed version can be used with Cordova. - -### Cordova commands -To make our lives a bit simpler, the `cordova` library has been packaged as a part of this generator and delegated via Grunt tasks. To invoke Cordova, simply run the command you would normally have, but replace `cordova` with `grunt` and `spaces` with `:` (the way Grunt chains task arguments). - -For example, lets say you want to add iOS as a platform target for your Ionic app -``` -grunt platform:add:ios -``` -and emulate a platform target -``` -grunt emulate:ios -``` -or add a plugin by specifying either its full repository URL or namespace from the [Plugins Registry](http://plugins.cordova.io) -``` -grunt plugin:add:https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git -grunt plugin:add:org.apache.cordova.device -grunt plugin:add:org.apache.cordova.network-information -``` -## Icons and Splash Screens -Properly configuring your app icons and splash screens to work with Cordova can be a pain to set up, so we've gone ahead and including an `after_prepare` hook that manages copying these resource files to the correct location within your current platform targets. - -To get started, you must first add a platform via `grunt platform:add:ios`. Once you have a platform, the packaged `icons_and_splashscreens.js` hook will copy over all placeholder icons and splash screens generated by Cordova into a newly created top-level `resources/` directory inside of your project. Simply replace these files with your own resources (**but maintain file names and directory structure**) and let the hook's magic automatically manage copying them to the appropriate location for each Cordova platform, all without interrupting your existing workflow. +## Project Structure -To learn more about hooks, checkout out the `README.md` file inside of your `hooks/` directory. +Overview -## Environment Specific Configuration -While building your Ionic app, you may find yourself working with multiple environments such as development, staging, and production. This generator uses [grunt-ng-constant] (https://github.com/werk85/grunt-ng-constant) to set up your workflow with development and production environment configurations right out of the box. + ├── Gruntfile.js - Configuration of all Grunt tasks + ├── package.json - Dev dependencies and required Cordova plugins + ├── bower.json - Lists front-end dependencies + ├── config.xml - Global Cordova configuration + ├── .gitignore - Best practices for checking in Cordova apps + ├── resources/ - Scaffolded placeholder Icons and Splashscreens + │ ├── ios/ + │ ├── android/ + ├── app/ + │ ├── index.html - Main Ionic app entry point + │ ├── lib/ - Libraries managed by Bower + │ ├── scripts/ - Custom AngularJS Scripts + │ ├── styles/ - Stylesheets + │ ├── templates/ - HTML views + ├── platforms/ - Targeted operating systems + ├── plugins/ - Native plugins + ├── hooks/ - Cordova lifecycle hooks + ├── merges/ - Platform specific overrides + ├── coverage/ - Istanbul reports + ├── test/ - Unit tests + │ ├── spec/ + ├── www/ - Used by Cordova and ionic-cli + -### Adding Constants -To set up your environment specific constants, modify the respective targets of the `ngconstant` task located towards the top of your Gruntfile. -``` - ngconstant: { - options: { - space: ' ', - wrap: '"use strict";\n\n {%= __ngModule %}', - name: 'config', - dest: '<%= yeoman.app %>/scripts/config.js' - }, - development: { - constants: { - ENV: { - name: 'development', - apiEndpoint: 'http://dev.your-site.com:10000/' - } - } - }, - production: { - constants: { - ENV: { - name: 'production', - apiEndpoint: 'http://api.your-site.com/' - } - } - } - }, -``` +## Workflow Commands -Running `grunt serve` will cause the `development` target constants to be used. When you build your application for production using `grunt build` or `grunt serve:dist`, the `production` constants will be used. Other targets, such as staging, can be added, but you will need to customize your Gruntfile accordingly. Note that if you change the `name` property of the task options, you will need to update your `app.js` module dependencies as well. +### `grunt serve[:compress]` -### Using Inside Angular -A `config.js` file is created by `grunt-ng-constant` depending on which task target is executed. This config file exposes a `config` module, that is listed as a dependency inside `app/scripts/app.js`. Out of the box, your constants will be namespaced under `ENV`, but this can be changed by modifying the `ngconstant` targets. It is important to note that whatever namespace value is chosen is what will need to be used for Dependency Injection inside your Angular functions. +### `grunt platform:add:` -The following example shows how to pre-process all outgoing HTTP request URLs with an environment specific API endpoint by creating a simple Angular `$http` interceptor. +### `grunt plugin:add:` -``` -// Custom Interceptor for replacing outgoing URLs -.factory('httpEnvInterceptor', function (ENV) { - return { - 'request': function(config) { - if (!_.contains(config.url, 'html')) { - config.url = ENV.apiEndpoint + config.url; - } - return config; - } - } -}) - -.config(function($httpProvider) { - // Pre-process outgoing request URLs - $httpProvider.interceptors.push('httpEnvInterceptor'); -}) -``` +### `grunt emulate:` -## Initial Walkthrough -To help you hit the ground running, let's walk through an example workflow together. We're assuming you've followed the [usage](https://github.com/diegonetto/generator-ionic#usage) directions and are inside your app's directory. +### `grunt compress` -We'll start by running our app in a browser so we can make a few changes. -``` -grunt serve -``` -Play around with livereload by changing some of the styles in `app/styles/main.css` or HTML in one of the files in `app/templates/`. When you're ready, lets go ahead and build the assets for Cordova to consume and also spot check that we didn't bork any code during the build process. We can do that with another handy Grunt task that runs the build process and then launches a `connect` server for use to preview the app with our built assets. -``` -grunt serve:dist -``` -If everything looks good the next step is to add a platform target and then emulate our app. In order for us to launch the iOS simulator from the command line, we'll have to install the `ios-sim` package. (If you forget to do this, Cordova will kindly remind you). -``` -npm install -g ios-sim -grunt platform:add:ios -grunt emulate:ios -``` -You may have realized that when the Grunt build process is run, it triggers the Cordova build system as well, so you end up with a beautifully packaged mobile app in a single command. +### `grunt serve:dist` -## Android Walkthrough -Research & Contribution by @ltfschoen (Luke Schoen) - -- Install Generator Ionic -``` -npm cache clear -npm install -g generator-ionic -mkdir my-ionic-project && cd $_ -yo ionic -``` -- Execute the following command in Terminal program to run a web server on your localhost. This will automatically open a tab in your default web browser at the following address and load your app http://127.0.0.1:9000/ -``` -grunt serve -``` -- Now we want to emulate your app on an Android Virtual Device (AVD). Start by downloading the latest [Android SDK](https://developer.android.com/sdk/index.html#download) -- On a Mac OS, extract downloaded ZIP file to an installation directory (i.e. /Applications/adt-bundle-mac-x86_64-20140702/). Note that the folder should match the name of the downloaded ZIP file adt-bundle-mac-x86_64-20140702.zip -- Update the Bash Profile document to include PATH environment variables to the Android SDK platform-tools and tools directory so the 'android' command may be executed regardless of your present working directory in the Terminal program. Note: This step may be necessary in order to allow you to use the 'android' command and avoid encountering the following error: -``` -[Error: The command android failed. Make sure you have the latest Android SDK installed, and the android command (inside the tools/ folder) added to your path. Output: /bin/sh: android: command not found ] -``` -- Execute the following command in the Terminal program to edit your Bash Profile document: -``` -touch ~/.bash_profile; open ~/.bash_profile -``` -- Copy and Paste the following at the top of the file (without removing existing data within the file). Replace all instances of adt-bundle-mac-x86_64-20140702 that are shown below with the filename of the ZIP file that you downloaded. Save and close the file. -``` -export PATH=/user/local/bin:$PATH -export PATH=$PATH:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools -export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools:/Applications/adt-bundle-mac-x86_64-20140702/sdk/tools -``` -- Execute the updated Bash Profile with the following command in the Terminal program to update the PATH: -``` -source ~/.bash_profile -``` -- Execute the following command in Terminal program to install Apache Ant using Homebrew -``` -brew install ant -``` -- Note: The above step may be necessary to avoid encountering the following error: -``` -Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. -``` -- Execute the following command in Terminal program to open the Android Package Manager (APM): -``` -android -``` -- In the APM, expand Android 4.4.2 (API 19). Click checkboxes to install "SDK Platform" and "ARM EABI v7A System Image". Click "Install Packages..." -- Go to the Android SDK Manager menu in the top left of your screen. Click the "Tools" dropdown menu. Click "Manage AVDs...". This opens the AVD (Android Virtual Device) Manager. Click to select the device listed (i.e. default is AVD_for_Nexus Android 4.4.2). Click the "Repair..." Button on the right panel. Click the "Refresh" Button at the bottom right. Close the window. -- Execute the following command in Terminal program to install the Android Debug Bridge: -``` -brew install android-platform-tools -``` -- Note: The above steps may be necessary to avoid encountering the following errors: -``` -Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools. -Error executing "adb devices": /bin/sh: adb: command not found -emulator: ERROR: This AVD's configuration is missing a kernel file!! -``` -- Add the Android Platform with the following commands in Terminal program. No warnings or errors should be encountered. Note that it may take a while to load your app in the Android emulator. -``` -grunt platform:add:android -grunt build -grunt emulate:android -``` - -## Testing Your App -To lessen the pain of testing your application, this generator configures your project with a handful of libraries that will hopefully make testing your application, dare I say, more enjoyable. - -![Comic](http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/100000/10000/6000/600/116640/116640.strip.gif) - -### Unit Tests -The foundation of our testing solution is built using [Karma](http://karma-runner.github.io/) which was created by the AngularJS team and is all around awesome. Inside of your generated `karma.conf.js` file you will find some basic configuration settings. Notice that we're using [Mocha](http://visionmedia.github.io/mocha/) to structure our tests and pulling in [Chai](http://chaijs.com/), a slick assertion library. You can easily drop Chai and replace Mocha with [Jasmine](http://jasmine.github.io/) depending on your preference. - -Your generated `Gruntfile.js` also contains a `karma` task that provides further configuration. Any properties specified via this task will override the values inside `karma.conf.js` when run via `grunt`. If you look closely at this task, you'll notice that we're using [PhantomJS](http://phantomjs.org/) for both Karma targets, but you can easily update the `karma:unit` target to run tests inside of real browsers. - -Ok, now that you have some context (and links to read up on the bundled testing libraries), go ahead and run `grunt test` and open up one of the included unit tests - `test/spec/controllers.js`. In your editor of choice, change this line - `scope.pets.should.have.length(4);` to any number other than four and watch what happens. Since your test files are being watched for changes, Grunt knows to go ahead and re-run your test suite, which in this cause should have errored out with a failure message being displayed in your terminal. - -Undo your modification and ensure that all tests are passing before continuing on. - -**Note** Depending on which starter template you picked, your tests may start off failing. - -### End2End Tests -Coming soon! - -### Code Coverage -So you've finished writing your tests, why not showoff just how watertight your application has become? Using [Istanbul](http://gotwarlost.github.io/istanbul/) - which was built at Yahoo - we can generate visually engaging code coverage reports that do just that! - -Our beloved generator has done all the hard work for you, so go ahead and see these coverage reports in action by running `grunt coverage`. - -If this is your first time using Istanbul, take a look around. It will help you spot gaps in your unit tests and lets face it, the more visual gratification we can get during our testing stage, the greater the likelihood of us sitting down and writing these tests to begin with! - -## Wrapping it up -If you made it this far then congratulations! You're now up and running with the gorgeous Ionic Framework powered by an intelligent workflow and sophisticated build system - all facilitated by the addition of just a few commands! - -## Ripple Emulator (Experimental) -**Be Advised**: [Ripple](http://ripple.incubator.apache.org/) is under active development so expect support for some plugins to be missing or broken. - -Add a platform target then run `grunt ripple` to launch the emulator in your browser. -``` -grunt platform:add:ios -grunt ripple -``` +### `grunt jshint` -Now go edit a file and then refresh your browser to see your changes. (Currently experimenting with livereload for Ripple) +### `grunt karma:continuous` -**Note**: If you get errors beginning with `Error: static() root path required`, don't fret. Ripple defaults the UI to Android so just switch to an iOS device and you'll be good to go. +### `grunt coverage` -![Ripple](http://i.imgur.com/LA4Hip1l.png) +### `grunt ripple` +## Documentation -## Special Thanks To -* The pioneers behind [Yeoman](http://yeoman.io/) for building an intelligent workflow management solution. -* The [AngularJS Generator](https://github.com/yeoman/generator-angular) and [Ionic Seed Project](https://github.com/driftyco/ionic-angular-cordova-seed) projects for inspiration. -* The visionaries at [Drifty](http://drifty.com) for creating the [Ionic Framework](http://ionicframework.com/). +For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md) ## Contribute @@ -285,7 +118,7 @@ For testing & debugging the generator please refer to the Yeoman Generator [test ## License -[MIT License](http://en.wikipedia.org/wiki/MIT_License) +[MIT License](http://opensource.org/licenses/mit-license.php) [travis-image]: http://img.shields.io/travis/diegonetto/generator-ionic.svg?style=flat [travis-url]: https://travis-ci.org/diegonetto/generator-ionic From 7cd1b05485de63daff005171e1cbca1cd7e83402 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 18:41:38 -0500 Subject: [PATCH 29/39] docs(readme): Add description for each command. --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fff4e53..4e58721 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ - Scaffolding projects with Yeoman - Integrated with the [ionic-cli](https://github.com/driftyco/ionic-cli) -- Browser livereload -- Emulator livereload +- Browser LiveReload +- Emulator LiveReload - Sass stylesheets compilation - HTML, JavaScript and CSS obfuscation and minification - Handles AngularJS dependency injection annotations @@ -40,7 +40,7 @@ Run `yo ionic`, optionally passing an app name: yo ionic [app-name] ``` -Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compressed` for a preview of the optimized application. +Run `grunt` for building / compressing your Ionic app, `grunt serve` for a browser preview, and `grunt serve:compress` for a preview of the optimized application. ## Upgrading Make sure you've commited (or backed up) your local changes and install the latest version of the generator via `npm install -g generator-ionic`, then go ahead and re-run `yo ionic` inside your project's directory. @@ -72,31 +72,68 @@ Overview ├── coverage/ - Istanbul reports ├── test/ - Unit tests │ ├── spec/ - ├── www/ - Used by Cordova and ionic-cli + ├── www/ - Copied from app/ to be used by Cordova ## Workflow Commands ### `grunt serve[:compress]` +Run a local development server with built in filesystem watching support integrated with LiveReload so you can develop your Ionic app in a browser. Since this command uses the `ionic-cli` under the hood, you can specify any command line flags / options shown [here](https://github.com/driftyco/ionic-cli#testing-in-a-browser). + + $ grunt serve --consolelogs + $ grunt serve:compress + ### `grunt platform:add:` +Add a supported Cordova platform as a build target for this project. + + $ grunt platform:add:ios + $ grunt platform:add:android + ### `grunt plugin:add:` -### `grunt emulate:` +Install a native Cordova plugin either by [registry name](http://plugins.cordova.io/) or repository URL. + + $ grunt plugin add:https://github.com/driftyco/ionic-plugins-keyboard.git + $ grunt plugin:add:org.apache.cordova.device + $ grunt plugin:add:org.apache.cordova.network-information + +### `grunt [emulate|run]:` + +Either `emulate` your Ionic app inside a simulator or `run` it on a connected device, optionally enabling LiveReload support to supercharge your development speed and enhance productivity. __Note:__ Any changes to native plugins will still require a full rebuild. This command also uses the `ionic-cli` under the hood, so these [additional flags](https://github.com/driftyco/ionic-cli/blob/master/README.md#live-reload-app-during-development-beta) can be specified. + + $ grunt emulate:ios --livereload + $ grunt emulate:ios --lc + $ grunt emulate:android --consolelogs + + $ grunt run:ios + $ grunt run:android ### `grunt compress` -### `grunt serve:dist` +Run your Ionic application files located in `app/` through the concatenation, obfuscation, and minification pipelines and write the optimized assets to the `www/` directory, which allows them to be consumed by either the `cordova` or `ionic` command line tools for packaging. + +### `grunt serve:compress` + +This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application. ### `grunt jshint` -### `grunt karma:continuous` +While running `grunt serve` or `grunt emulate`, the build system will be watching your filesystem for changes and linting your JavaScript files on the fly. However, you can invoke JSHint manually by using this command to spot check your Ionic app for linting errors. + +### `grunt karma` + +Launches the configured `karma` test running framework using PhantomJS. ### `grunt coverage` +Generates a static site containing code coverage reports for your unit tests using [Istanbul](http://gotwarlost.github.io/istanbul/). + ### `grunt ripple` +Launch the bundled [Ripple](http://ripple.incubator.apache.org/) emulator by first adding a platform via `grunt platform:add:` and then running this command. + ## Documentation For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md) From 108ba36c9fea1c1113930f6edd65a1c7d97f70a8 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 19:29:15 -0500 Subject: [PATCH 30/39] docs(readme): Clean up some descriptions --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e58721..31f052a 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Add a supported Cordova platform as a build target for this project. Install a native Cordova plugin either by [registry name](http://plugins.cordova.io/) or repository URL. - $ grunt plugin add:https://github.com/driftyco/ionic-plugins-keyboard.git + $ grunt plugin:add:https://github.com/driftyco/ionic-plugins-keyboard.git $ grunt plugin:add:org.apache.cordova.device $ grunt plugin:add:org.apache.cordova.network-information @@ -105,6 +105,7 @@ Either `emulate` your Ionic app inside a simulator or `run` it on a connected de $ grunt emulate:ios --livereload $ grunt emulate:ios --lc + $ grunt emulate:ios --target=iPad -lc $ grunt emulate:android --consolelogs $ grunt run:ios @@ -116,7 +117,14 @@ Run your Ionic application files located in `app/` through the concatenation, ob ### `grunt serve:compress` -This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application. +This runs `grunt compress` to optimize your Ionic app assets and then immediately launches a local development server so that you can preview the compressed application in a browser. + +### `grunt build:` + +Build your Ionic application for the targeted platform. + + $ grunt build:ios --device --release + $ grunt build:android --debug ### `grunt jshint` From d9ed14e65d0b4ca9cf0b70d291e3dd5a41aa9cd9 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 20:27:03 -0500 Subject: [PATCH 31/39] fix(generator): Fix JSHint errors. Closes #113 --- templates/common/root/.jshintignore | 1 + templates/common/root/.jshintrc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 templates/common/root/.jshintignore diff --git a/templates/common/root/.jshintignore b/templates/common/root/.jshintignore new file mode 100644 index 0000000..c67cf8c --- /dev/null +++ b/templates/common/root/.jshintignore @@ -0,0 +1 @@ +app/scripts/config.js diff --git a/templates/common/root/.jshintrc b/templates/common/root/.jshintrc index 40377ba..5d260e4 100644 --- a/templates/common/root/.jshintrc +++ b/templates/common/root/.jshintrc @@ -19,6 +19,8 @@ "trailing": true, "smarttabs": true, "globals": { - "angular": false + "angular": false, + "cordova": false, + "StatusBar": false } } From 56c40741ac5ae06a2a76da6357e95538b4f6bd36 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Sun, 5 Oct 2014 20:27:52 -0500 Subject: [PATCH 32/39] fix(generator): Fix issue when running emulate/run before serve --- templates/common/Gruntfile.js | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/templates/common/Gruntfile.js b/templates/common/Gruntfile.js index 7462c51..c5f4b39 100644 --- a/templates/common/Gruntfile.js +++ b/templates/common/Gruntfile.js @@ -3,7 +3,7 @@ var _ = require('lodash'); var path = require('path'); -var cordova = require('cordova'); +var cordovaCli = require('cordova'); var spawn = require('child_process').spawn; module.exports = function (grunt) { @@ -410,7 +410,7 @@ module.exports = function (grunt) { }); // Register tasks for all Cordova commands - _.functions(cordova).forEach(function (name) { + _.functions(cordovaCli).forEach(function (name) { grunt.registerTask(name, function () { this.args.unshift(name.replace('cordova:', '')); // Handle URL's being split up by Grunt because of `:` characters @@ -494,40 +494,42 @@ module.exports = function (grunt) { return grunt.task.run(['watch']); }); + + grunt.registerTask('test', [ + 'clean', + 'concurrent:test', + 'autoprefixer', + 'karma:unit:start', + 'watch:karma' + ]); grunt.registerTask('serve', function (target) { if (target === 'compress') { return grunt.task.run(['compress', 'ionic:serve']); } - grunt.task.run([ - 'clean', - 'ngconstant:development', - 'wiredep', - 'concurrent:server', - 'autoprefixer', - 'newer:copy:app', - 'newer:copy:tmp', - 'ionic:serve' - ]); + grunt.task.run(['init', 'ionic:serve']); }); grunt.registerTask('emulate', function() { - return grunt.task.run(['ionic:emulate:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:emulate:' + this.args.join()]); }); grunt.registerTask('run', function() { - return grunt.task.run(['ionic:run:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:run:' + this.args.join()]); }); grunt.registerTask('build', function() { - return grunt.task.run(['ionic:build:' + this.args.join()]); + return grunt.task.run(['init', 'ionic:build:' + this.args.join()]); }); - grunt.registerTask('test', [ + grunt.registerTask('init', [ 'clean', - 'concurrent:test', + 'ngconstant:development', + 'wiredep', + 'concurrent:server', 'autoprefixer', - 'karma:unit:start', - 'watch:karma' + 'newer:copy:app', + 'newer:copy:tmp' ]); + grunt.registerTask('compress', [ 'clean', 'ngconstant:production', From 0498bc1bd815339ce4a38ddbaa69fa3c3c5a04de Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 00:43:54 -0500 Subject: [PATCH 33/39] feat(generator): Add support for Plugin management hooks. Closes #72 --- app/index.js | 3 +-- templates/common/_gitignore | 2 +- .../after_platform_add/install_plugins.js | 19 +++++++++++++++++++ .../after_plugin_add/register_plugins.js | 17 +++++++++++++++++ .../after_plugin_rm/deregister_plugins.js | 15 +++++++++++++++ .../before_platform_add/init_directories.js | 19 +++++++++++++++++++ 6 files changed, 72 insertions(+), 3 deletions(-) create mode 100755 templates/hooks/after_platform_add/install_plugins.js create mode 100755 templates/hooks/after_plugin_add/register_plugins.js create mode 100755 templates/hooks/after_plugin_rm/deregister_plugins.js create mode 100755 templates/hooks/before_platform_add/init_directories.js diff --git a/app/index.js b/app/index.js index df36776..8d09774 100644 --- a/app/index.js +++ b/app/index.js @@ -161,8 +161,7 @@ IonicGenerator.prototype.packageFiles = function packageFiles() { }; IonicGenerator.prototype.cordovaHooks = function cordovaHooks() { - var iconsAndSplash = 'hooks/after_prepare/icons_and_splashscreens.js'; - this.template(iconsAndSplash); + this.directory('hooks', 'hooks', true); }; IonicGenerator.prototype.hookPerms = function hookPerms() { diff --git a/templates/common/_gitignore b/templates/common/_gitignore index cc8f3fa..ab62996 100644 --- a/templates/common/_gitignore +++ b/templates/common/_gitignore @@ -2,7 +2,7 @@ node_modules www .tmp .sass-cache -<%= appPath %>/bower_components +<%= appPath %>/lib coverage platforms plugins diff --git a/templates/hooks/after_platform_add/install_plugins.js b/templates/hooks/after_platform_add/install_plugins.js new file mode 100755 index 0000000..37ea854 --- /dev/null +++ b/templates/hooks/after_platform_add/install_plugins.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +/** + * Install all plugins listed in package.json + */ +var exec = require('child_process').exec; +var path = require('path'); +var sys = require('sys'); + +var packageJSON = require('../../package.json'); +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(script + ' plugin add ' + plugin, function (error, stdout, stderr) { + sys.puts(stdout); + }); +}); diff --git a/templates/hooks/after_plugin_add/register_plugins.js b/templates/hooks/after_plugin_add/register_plugins.js new file mode 100755 index 0000000..dc1042b --- /dev/null +++ b/templates/hooks/after_plugin_add/register_plugins.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +/** + * Push plugins to cordovaPlugins array after_plugin_add + */ +var fs = require('fs'); +var _ = require('lodash'); +var packageJSON = require('../../package.json'); + +packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; +_.each(process.env.CORDOVA_PLUGINS.split(','), function (plugin) { + if (! _.contains(packageJSON.cordovaPlugins, plugin)) { + packageJSON.cordovaPlugins.push(plugin); + } +}); + +fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2)); diff --git a/templates/hooks/after_plugin_rm/deregister_plugins.js b/templates/hooks/after_plugin_rm/deregister_plugins.js new file mode 100755 index 0000000..14ca171 --- /dev/null +++ b/templates/hooks/after_plugin_rm/deregister_plugins.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node + +/** + * Remove plugins from cordovaPlugins array after_plugin_rm + */ +var fs = require('fs'); +var _ = require('lodash'); +var packageJSON = require('../../package.json'); + +packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; +_.each(process.env.CORDOVA_PLUGINS.split(','), function (plugin) { + _.remove(packageJSON.cordovaPlugins, function (p) { return p === plugin; }); +}); + +fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2)); diff --git a/templates/hooks/before_platform_add/init_directories.js b/templates/hooks/before_platform_add/init_directories.js new file mode 100755 index 0000000..1d8a26a --- /dev/null +++ b/templates/hooks/before_platform_add/init_directories.js @@ -0,0 +1,19 @@ +#!/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 mkdirp = require('mkdirp'); +var path = require('path'); + +var platformsDir = path.resolve(__dirname, '../../platforms'); +var pluginsDir = path.resolve(__dirname, '../../plugins'); + +mkdirp(platformsDir, function (err) { + if (err) { console.error(err); } +}); + +mkdirp(pluginsDir, function (err) { + if (err) { console.error(err); } +}); From 2774b39c13806c12d15d3836975baaaadc577b55 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 01:34:24 -0500 Subject: [PATCH 34/39] fix(plugins): Add default plugins to be installed by new hooks --- templates/common/_package.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/common/_package.json b/templates/common/_package.json index 53e7c4b..0d384ce 100644 --- a/templates/common/_package.json +++ b/templates/common/_package.json @@ -46,5 +46,10 @@ }, "scripts": { "test": "grunt test" - } + }, + "cordovaPlugins": [ + "https://github.com/driftyco/ionic-plugins-keyboard.git", + "org.apache.cordova.statusbar", + "org.apache.cordova.console" + ] } From 60e1cf4bff2f2d37783d098f5ad9962d04b8e7c4 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 01:37:44 -0500 Subject: [PATCH 35/39] feat(ionic): Update to Beta 13 --- templates/common/_bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/common/_bower.json b/templates/common/_bower.json index cd724f8..1b39d6b 100644 --- a/templates/common/_bower.json +++ b/templates/common/_bower.json @@ -2,7 +2,7 @@ "name": "<%= appName %>", "version": "0.0.0", "dependencies": { - "ionic": "v1.0.0-beta.11" + "ionic": "v1.0.0-beta.13" }, "devDependencies": { "angular-mocks": "~1.2.17", From d90f0d921cf67c6fdb4572ef95db7f1122985a6a Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 01:39:00 -0500 Subject: [PATCH 36/39] 0.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5830bf0..765cc9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-ionic", - "version": "0.5.4", + "version": "0.6.0", "description": "A generator for the Ionic Framework", "keywords": [ "yeoman-generator", From b291939bd6e39a7b3fee465e3aa701a50f08041e Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 02:00:14 -0500 Subject: [PATCH 37/39] docs(CHANGELOG): Update for 0.6.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f313492..53afde4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ + +## 0.6.0 (2014-10-06) + + +#### Bug Fixes + +* **generator:** + * Fix issue when running emulate/run before serve ([56c40741](http://github.com/diegonetto/generator-ionic/commit/56c40741ac5ae06a2a76da6357e95538b4f6bd36)) + * Fix JSHint errors. ([d9ed14e6](http://github.com/diegonetto/generator-ionic/commit/d9ed14e65d0b4ca9cf0b70d291e3dd5a41aa9cd9), closes [#113](http://github.com/diegonetto/generator-ionic/issues/113)) +* **package.json:** Remove warnings as mentioned in #99 ([4ef83b34](http://github.com/diegonetto/generator-ionic/commit/4ef83b3408305e7e24db1f49b7246a830dd43099)) +* **plugins:** Add default plugins to be installed by new hooks ([2774b39c](http://github.com/diegonetto/generator-ionic/commit/2774b39c13806c12d15d3836975baaaadc577b55)) + + +#### Features + +* **generator:** + * Add support for Plugin management hooks. ([0498bc1b](http://github.com/diegonetto/generator-ionic/commit/0498bc1bd815339ce4a38ddbaa69fa3c3c5a04de), closes [#72](http://github.com/diegonetto/generator-ionic/issues/72)) + * Pass CLI flags to cordova wrapper functions. and #107 ([b2821f49](http://github.com/diegonetto/generator-ionic/commit/b2821f49923915f91752df26cd68e3e22320c0eb), closes [#97](http://github.com/diegonetto/generator-ionic/issues/97)) + * Add ionic-cli support. ([f6f9e0fc](http://github.com/diegonetto/generator-ionic/commit/f6f9e0fcd472ef7bbb6fef3038064e2f0d91b8f8), closes [#112](http://github.com/diegonetto/generator-ionic/issues/112)) +* **ionic:** Update to Beta 13 ([60e1cf4b](http://github.com/diegonetto/generator-ionic/commit/60e1cf4bff2f2d37783d098f5ad9962d04b8e7c4)) + + ### 0.5.4 (2014-09-07) From 003b4d000ef65a2d98d5876774d1a79ede813883 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 02:14:26 -0500 Subject: [PATCH 38/39] docs(readme): Plugin management --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 31f052a..7a4eb0a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ - HTML, JavaScript and CSS obfuscation and minification - Handles AngularJS dependency injection annotations - Icons and Splashscreens support +- Cordova plugin management hooks - Environment Specific Configuration for AngularJS - Linting JavaScript - Running unit tests @@ -144,7 +145,7 @@ Launch the bundled [Ripple](http://ripple.incubator.apache.org/) emulator by fir ## Documentation -For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md) +For a Getting Started guide, FAQ, and helpful tips, please see the [documentation](docs/README.md). ## Contribute From c0184a7acdb60b21e95f7bf1e6cb69faeec2c8d6 Mon Sep 17 00:00:00 2001 From: Diego Netto Date: Mon, 6 Oct 2014 06:16:07 -0500 Subject: [PATCH 39/39] docs(docs): Add docs directory --- docs/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..1d31b8a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,3 @@ +# Ionic Generator documentation + +FAQ and Guides coming soon.