Skip to content

Commit

Permalink
feat(v2): New v2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch authored and tlancina committed Mar 28, 2016
1 parent f9f6b57 commit 666ae35
Show file tree
Hide file tree
Showing 38 changed files with 1,979 additions and 438 deletions.
16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@

* Added security command for managing Security Profiles.
* Added package command for Ionic Package.
* Added winston as default logger - may break event listeners.
* Added ENV variable CONNECT_LIVE_RELOAD_PORT for users to expose the live reload server on a port.
* Speed up CLI by lazy-loading ionic-app-lib modules.
* Update hooks - use `util` instead of deprecated `sys`.
* Update hooks to run sequentially instead of asychronously.
* Added additional tests for CLI, stats, and running commands.

### 1.6.5

* Updating app-lib dependency

### 1.6.4

* Updating app-lib dependency
* Updating app-lib dependency.

### 1.6.3

Expand All @@ -47,7 +53,7 @@

* Added `io init` command to initialize your project with ionic.io.
* Added config command to centralize ionic.io services configuration.
* Added `--deploy` flag to upload command.
* Added `--deploy` flag to upload command.

### 1.6.1

Expand Down Expand Up @@ -75,7 +81,7 @@
* Fix(platform): Remove console.log command from ionic-cordova-lib, bump to 5.1.5 to have that change.
* Update ionic-cordova-lib to 5.1.4 for fix with cordova lib run propagating errors to callers.
* Fix for serve - directory root is using path.join instead of path.resolve.
* Add build platform to the cordova command.
* Add build platform to the cordova command.
* Bump version of ionic-cordova-lib.

### 1.5.5
Expand Down Expand Up @@ -138,7 +144,7 @@
* Fix for a bug when serve wont start console logs with `--consolelogs` argument.
* Added flag `--platform` for serve command that opens the browser with those platform specific styles (android/ios).

### 1.4.1
### 1.4.1

* Corrected a bug with ionic state restore command - it now properly passes the app directory to be fixed.
* Corrected landscape and portrait sizes for the resources command.
Expand All @@ -164,7 +170,7 @@

* Fix for Ionic default hooks permissions

### 1.3.20
### 1.3.20

* Adding in a command with ionic start to provide an ionic io app ID. `ionic start --io-app-id <someid>`

Expand Down
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ __Command-line flags/options:__
[--no-cordova|-w] .... Do not create an app targeted for Cordova
[--sass|-s] ........... Setup the project to use Sass CSS precompiling
[--list|-l] .......... List starter templates available

[--io-app-id] ......... The Ionic.io app ID to use

## Adding a platform target
Expand Down Expand Up @@ -448,7 +448,7 @@ Set `IONIC_EMAIL` and `IONIC_PASSWORD` as variables to have the CLI read these i

## Upload your Ionic app

Use the `ionic upload` command to take your current application you are developing and upload it to the Ionic.io servers.
Use the `ionic upload` command to take your current application you are developing and upload it to the Ionic.io servers.

Now you can use [the ionic view app](http://view.ionic.io/) to view that application or have others view the application.

Expand All @@ -467,7 +467,7 @@ You can then view that App ID from the View app or the application listing on io

### Adding a note with your upload

To add a note to your build, pass the `--note` option as follows:
To add a note to your build, pass the `--note` option as follows:

`ionic upload --note "This version of the application fixes the menu selections"`.

Expand All @@ -490,9 +490,9 @@ To get help with a doc you may not remember, just type the name close enough: `i

# Ionic Hooks

Ionic provides some default hooks for you to use in your Cordova application. In versions prior to 1.3.18, these hooks were automatically installed via the `ionic platform` command.
Ionic provides some default hooks for you to use in your Cordova application. In versions prior to 1.3.18, these hooks were automatically installed via the `ionic platform` command.

In 1.3.18, the hooks were automatically removed due to some errors users were having with Crosswalk and other plugins with variables.
In 1.3.18, the hooks were automatically removed due to some errors users were having with Crosswalk and other plugins with variables.

If you were a user who would still like to use those hooks, you can re-install these hooks with the `ionic hooks add` command.

Expand Down Expand Up @@ -541,7 +541,7 @@ Your package.json file might look something like the following:

## ionic state save

The `ionic state save` command does some lookup in your platforms and plugins to save the current state of your cordova application.
The `ionic state save` command does some lookup in your platforms and plugins to save the current state of your cordova application.

First it looks in your platforms folder to see which platforms are installed, and saves the name and version in your `package.json` file under the `cordovaPlatforms` attribute.

Expand All @@ -568,20 +568,18 @@ The `ionic state reset` method will first remove your platforms and plugins fold
This command can be helpful for you to reinstall your plugins and platforms to get a fresh start.


# ionic.project file
# Ionic CLI 2.0

## Ionic Generators

First class support has come to the Ionic CLI to scaffold and generate Ionic and Angular 2 components. To use this feature, first install the V2 Ionic CLI: `npm install ionic@alpha` and start an app.

Once in the app folder, use the `generate` command (alias: `g`).

The ionic.project is a configuration for an ionic project that stores the following:
Usage:
* `ionic generate page About` - Generate a page named About with HTML, JavaScript, and Sass named `about`.
* `ionic g tabs MyTabPage` - Generate a page named MyTabPage, queries for the amount of tabs, and creates pages for those tabs.

* `app_id` - the associated app ID in ionic.io.
* `browsers` - the installed browsers (CrossWalk).
* `createDocumentRoot` - boolean setting stating to create the designated.document root upon serve (for CI, using `app` folder, and compiling)
* `defaultBrowser` - the browser they prefer to use with `ionic serve`. Chrome, Firefox, etc.
* `documentRoot` - the associated document root with HTML/JS/CSS files.
* `gulpDependantTasks` - gulp tasks that are run before `ionic serve` launches. Think of `gulp build`, `gulp sass`, etc.
* `gulpStartupTasks` - gulp tasks that are run and kept alive during `ionic serve`.
* `imagePaths` - paths relative to document root that specify the release feature to compress images.
* `proxies` - designated proxies to use during `ionic serve`.
* `name` - the name of the application.
* `sass` - the setting to watch sass during `ionic serve`.
* `watchPatterns` - the patterns to watch and live reload during `ionic.serve`.
List:

View all generators: `ionic g --list`.
194 changes: 97 additions & 97 deletions e2e/e2e.spec.js
Original file line number Diff line number Diff line change
@@ -1,111 +1,111 @@
var fs = require('fs'),
helpers = require('./helpers'),
path = require('path'),
Q = require('q'),
shell = require('shelljs');
// var fs = require('fs'),
// helpers = require('./helpers'),
// path = require('path'),
// Q = require('q'),
// shell = require('shelljs');

var IonicCli = require('../lib/cli');
var IonicAppLib = require('ionic-app-lib');
// var IonicCli = require('../lib/cli');
// var IonicAppLib = require('ionic-app-lib');

var tmpDir = helpers.tmpDir('create_test');
var appName = 'TestIonic';
var appId = 'org.ionic.testing';
var project = path.join(tmpDir, appName);
var optimist = require('optimist');
var start = IonicAppLib.start;
var utils = IonicAppLib.utils;
var optimistSpy;
// var tmpDir = helpers.tmpDir('create_test');
// var appName = 'TestIonic';
// var appId = 'org.ionic.testing';
// var project = path.join(tmpDir, appName);
// var optimist = require('optimist');
// var start = IonicAppLib.start;
// var utils = IonicAppLib.utils;
// var optimistSpy;


describe('end-to-end', function() {
beforeEach(function() {
jasmine.getEnv().defaultTimeoutInterval = 150000;
// if (optimistSpy) {
// optimistSpy.reset();
// }
optimistSpy = spyOn(optimist, 'boolean');
optimist.boolean.reset();
// xdescribe('end-to-end', function() {
// beforeEach(function() {
// jasmine.getEnv().defaultTimeoutInterval = 150000;
// // if (optimistSpy) {
// // optimistSpy.reset();
// // }
// optimistSpy = spyOn(optimist, 'boolean');
// optimist.boolean.reset();

//Mock out call to get the app directory, return our project
spyOn(utils, 'getProjectDirectory').andReturn(project);
// //Mock out call to get the app directory, return our project
// spyOn(utils, 'getProjectDirectory').andReturn(project);

//Disable console.log statements
// spyOn(IonicAppLib.events, 'on');
// spyOn(process.stdout, 'write');
spyOn(IonicAppLib.multibar, 'newBar').andReturn({tick: function(){}});
// //Disable console.log statements
// // spyOn(IonicAppLib.events, 'on');
// // spyOn(process.stdout, 'write');
// spyOn(IonicAppLib.multibar, 'newBar').andReturn({tick: function(){}});


shell.rm('-rf', project);
shell.mkdir('-p', tmpDir);
});
afterEach(function() {
process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
// shell.rm('-rf', tmpDir);
});
// shell.rm('-rf', project);
// shell.mkdir('-p', tmpDir);
// });
// afterEach(function() {
// process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
// // shell.rm('-rf', tmpDir);
// });

describe('#start e2e', function() {
it('should call start with default template and folder name', function(done) {
console.log('default template');
var args = { _: ['start', 'test'], verbose: true};
//Mock out args from the commands.
// optimistSpy.andReturn({argv: args});
optimistSpy.andCallFake(function(){
return {argv: args};
});
// describe('#start e2e', function() {
// it('should call start with default template and folder name', function(done) {
// console.log('default template');
// var args = { _: ['start', 'test'], verbose: true};
// //Mock out args from the commands.
// // optimistSpy.andReturn({argv: args});
// optimistSpy.andCallFake(function(){
// return {argv: args};
// });

Q()
.then(function() {
return IonicCli.run(args);
}).then(function(){
expect(path.join(project, 'www', 'index.html')).toExist();
expect(path.join(project, 'www', 'templates', 'tabs.html')).toExist();
})
.catch(function(error) {
expect('this').toBe('not this');
})
.fin(done);
});
// Q()
// .then(function() {
// return IonicCli.run(args);
// }).then(function(){
// expect(path.join(project, 'www', 'index.html')).toExist();
// expect(path.join(project, 'www', 'templates', 'tabs.html')).toExist();
// })
// .catch(function(error) {
// expect('this').toBe('not this');
// })
// .fin(done);
// });

it('should call start with sidemenu template and folder name', function(done) {
console.log('sidemenu template');
var args = { _: ['start', 'test', 'sidemenu'], verbose: true};
//Mock out args from the commands.
// optimistSpy.andReturn({argv: args});
optimistSpy.andCallFake(function(){
return {argv: args};
});
// it('should call start with sidemenu template and folder name', function(done) {
// console.log('sidemenu template');
// var args = { _: ['start', 'test', 'sidemenu'], verbose: true};
// //Mock out args from the commands.
// // optimistSpy.andReturn({argv: args});
// optimistSpy.andCallFake(function(){
// return {argv: args};
// });

Q()
.then(function() {
return IonicCli.run(args);
}).then(function(){
expect(path.join(project, 'www', 'index.html')).toExist();
expect(path.join(project, 'www', 'templates', 'menu.html')).toExist();
})
.catch(function(error) {
expect('this').toBe('not this');
})
.fin(done);
});
// Q()
// .then(function() {
// return IonicCli.run(args);
// }).then(function(){
// expect(path.join(project, 'www', 'index.html')).toExist();
// expect(path.join(project, 'www', 'templates', 'menu.html')).toExist();
// })
// .catch(function(error) {
// expect('this').toBe('not this');
// })
// .fin(done);
// });

it('should call start with blank template and folder name', function(done) {
var args = { _: ['start', 'test', 'blank'], verbose: true};
//Mock out args from the commands.
optimistSpy.andCallFake(function(){
return {argv: args};
});
// it('should call start with blank template and folder name', function(done) {
// var args = { _: ['start', 'test', 'blank'], verbose: true};
// //Mock out args from the commands.
// optimistSpy.andCallFake(function(){
// return {argv: args};
// });

Q()
.then(function() {
return IonicCli.run(args);
}).then(function(){
expect(path.join(project, 'www', 'index.html')).toExist();
expect(path.join(project, 'www', 'js', 'app.js')).toExist();
})
.catch(function(error) {
expect('this').toBe('not this');
})
.fin(done);
});
});
});
// Q()
// .then(function() {
// return IonicCli.run(args);
// }).then(function(){
// expect(path.join(project, 'www', 'index.html')).toExist();
// expect(path.join(project, 'www', 'js', 'app.js')).toExist();
// })
// .catch(function(error) {
// expect('this').toBe('not this');
// })
// .fin(done);
// });
// });
// });
Loading

0 comments on commit 666ae35

Please sign in to comment.