Skip to content

Commit

Permalink
feat(docs): Finalize README section on ionic.io services
Browse files Browse the repository at this point in the history
  • Loading branch information
jskrzypek committed Nov 5, 2015
1 parent 3fbc839 commit b2b06f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,17 @@ To better understand the gulp task system have a look at the docs of [gulp-mux](

![](http://ionic.io/img/iologo.png)

The gulp system also includes some basic tasks for ensuring that your ionic projects in your `dist/` are able to make use of the [ionic.io](https://apps.ionic.io/) platform. These are found in `gulp_tasks/tasks/ionic.js`. To use thre ionic.io platform features, you will need to add your project's [`app_id`, `api_key`, and `name` from ionic.io](http://docs.ionic.io/docs/io-api-keys) to your `gulp_tasks/common/constants.js` file in the entry in the `ionic` section with your current target's name.
The gulp system also includes some basic tasks for ensuring that your ionic projects in your `dist/` are able to make use of the [apps.ionic.io](https://apps.ionic.io/) platform. These are found in `gulp_tasks/tasks/ionic.js`. To use the ionic.io platform services, you will need to scaffold a mobile target (with `yo mcfly --mobile` or `yo mcfly:target --mobile`) and then create a project on [apps.ionic.io](https://apps.ionic.io/). Add your project's [`app_id`, `api_key`, and `name` from apps.ionic.io](http://docs.ionic.io/docs/io-api-keys) to your `gulp_tasks/common/constants.js` file in the entry in the `ionic` section with your current target's name. Next run

```sh
gulp ionic:platformcopy --target=<targetname>
```

to copy over the [`ionic-platform-web-client`](https://github.com/driftyco/ionic-platform-web-client) bundle into your client folder, and then uncomment the `require('./ionic.io.bundle.min.js');` in [`client/scripts/main<targetsuffix>.js:14`](https://github.com/mcfly-io/generator-mcfly/blob/master/templates/target/scripts/main.js#L14) as well as the module dependency for `'ionic.service.core'` that follows it. Finally comment out the script include of `cordova.js` in [`client/index<targetsuffix>.html:22`](https://github.com/mcfly-io/generator-mcfly/blob/master/templates/target/index.html#L22), since the `ionic.io.bundle.min.js` will automatically load the correct instance of the `cordova.js` script for you.

Currently `'ionic:deploy'` is the only entry-point task, and it runs a `'dist'` and then handles the uploading and optional deployment of a project update to the ionic deploy server. You need to specify a target with a `--target=<targetname>` and then which mode you're using (usually `prod`) with `--mode=<dev|prod>`. After that you can add the `--note` and `--deploy` flags as specified by the [`ionic deploy` cli](http://docs.ionic.io/docs/deploy-deploying-updates).

More tasks to integrate with other ionic.io services are coming soon, but in the meantime, if you write your own, feel free to make a PR to [`mcfly-io/generator-sublime`](https://github.com/mcfly-io/generator-sublime). The file to edit is [`templates/gulps/tasks/ionic.js`](https://github.com/mcfly-io/generator-sublime/tree/master/templates/gulps/tasks/ionic.js).
More tasks to integrate with other ionic.io services are coming soon, but in the meantime, if you write your own, feel free to make a PR to [`mcfly-io/generator-sublime`](https://github.com/mcfly-io/generator-sublime). The file to edit is [`templates/gulps/tasks/ionic.js`](https://github.com/mcfly-io/generator-sublime/tree/master/templates/gulps/tasks/ionic.js). You should refer to the [apps.ionic.io docs](http://docs.ionic.io/) for inspiration, and then look at [`ionic-app-lib`](https://github.com/driftyco/ionic-app-lib) (the library that powers [`ionic-cli`](https://github.com/driftyco/ionic-cli)) to see how you can hook into the ionic system under the hood.

## Browserify/Webpack and namespaces
At the heart of the generator we use `browserify` or `webpack` to bundle together the client javascript files.
Expand Down
3 changes: 2 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var path = require('path');
var yosay = require('yosay');
var Class = require('../class');
var chalk = require('chalk');

var AppGenerator = Class.extend({
constructor: function() {
Expand Down Expand Up @@ -303,7 +304,7 @@ var AppGenerator = Class.extend({
this.log('If you want to use any of the ' + chalk.cyan('https://apps.ionic.io') + ' services ');
this.log('- e.g. ionicPush for mobile push messaging or ionicDeploy for hot pushing code updates -');
this.log('you should comment out line ' + chalk.green('22') + ' in ' + chalk.blue('client/index.html') + ' and uncomment ');
this.log('line ' + chalk.green('14') + ' in ' + chalk.blue('client/scripts/main.js') + ' to require ' + chalk.yellow('ionic.io.bundle.min.js') + ', as');
this.log('line ' + chalk.green('14') + ' in ' + chalk.blue('client/scripts/main.js') + ' to require ' + chalk.yellow('ionic.io.bundle.min.js') + ', as well as');
this.log('the ' + chalk.yellow('\'ionic.service.core\'') + ' module dependency. Finally, create your app on ' + chalk.cyan('https://apps.ionic.io'));
this.log('and fill in the ' + chalk.magenta('app_id') + ' and ' + chalk.magenta('api_key') + ' in ' + chalk.blue('gulp_tasks/common/constants.js') + ' in ');
this.log(chalk.magenta('consants.ionic.app') + ', and then run \'' + chalk.yellow('gulp ionic:platformcopy --target=app') + '\'.');
Expand Down
3 changes: 2 additions & 1 deletion target/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ var TargetGenerator = Class.extend({
},

end: function() {
var chalk = this.utils.chalk;
var that = this;
var done = this.async();
return this.injectAllModules()
Expand All @@ -142,7 +143,7 @@ var TargetGenerator = Class.extend({
that.log('If you want to use any of the ' + chalk.cyan('https://apps.ionic.io') + ' services ');
that.log('- e.g. ionicPush for mobile push messaging or ionicDeploy for hot pushing code updates -');
that.log('you should comment out line ' + chalk.green('22') + ' in ' + chalk.blue('client/index' + that.suffix + '.html') + ' and uncomment ');
that.log('line ' + chalk.green('14') + ' in ' + chalk.blue('client/scripts/main' + that.suffix + '.js') + ' to require ' + chalk.yellow('ionic.io.bundle.min.js') + ', as');
that.log('line ' + chalk.green('14') + ' in ' + chalk.blue('client/scripts/main' + that.suffix + '.js') + ' to require ' + chalk.yellow('ionic.io.bundle.min.js') + ', as well as');
that.log('the ' + chalk.magenta('\'ionic.service.core\'') + ' module dependency. Finally, create your app on ' + chalk.cyan('https://apps.ionic.io'));
that.log('and fill in the ' + chalk.magenta('app_id') + ' and ' + chalk.magenta('api_key') + ' in ' + chalk.blue('gulp_tasks/common/constants.js') + ' in ');
that.log(chalk.magenta('consants.ionic.' + that.targetname) + ', and then run \'' + chalk.yellow('gulp ionic:platformcopy --target=' + that.targetname) + '\'.');
Expand Down
3 changes: 1 addition & 2 deletions templates/target/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ require('ionic-angular');<% } %>
<% if (mobile) { %>// require('./ionic.io.bundle.min');
<% } %><% if (material) { %>require('angular-material');<% } %><% if (bootstrap) { %>
require('angular-ui-bootstrap');<% } %>
require('./ionic-service-core');
var app = angular.module(namespace, [<% if (ionic) { %>'ionic',<% } %><% if (material) { %> 'ngMaterial',<% } %><% if (bootstrap) { %> 'ui.bootstrap',<% } %>
<% if (mobile) { %> 'ionic.service.core',
<% if (mobile) { %> // 'ionic.service.core',
<% } %> // inject:modules start
// inject:modules end
]);
Expand Down
2 changes: 1 addition & 1 deletion test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('generator:app', function() {
done();
}.bind(this));
});

it('references ionic.io.bundle.min.js in main.js', function(done) {
this.runGen.on('end', function() {
var clientFolder = this.runGen.generator.config.get('clientFolder');
Expand Down

0 comments on commit b2b06f6

Please sign in to comment.