Skip to content

Commit

Permalink
fix cordova-init create project failure and platform option
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecraige committed Oct 23, 2014
1 parent 8ee51e6 commit 149dc55
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ ember generate cordova-init com.reverse.domain
```

This will generate a base cordova iOS app and store it within the `cordova/`
directory. If you would like to add other platforms, you can run the
`ember cordova` command:
directory. If you want to generate an android project instead you must pass in
the `--platform` option. That would look like this:

```sh
ember generate cordova-init com.reverse.domain --platform=android
```

If you would like to add more platforms, you can run the
`ember cordova` command after the project is initialized:

```sh
ember cordova platform add android
Expand Down
2 changes: 1 addition & 1 deletion blueprints/cordova-init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {

afterInstall: function(options) {
this.options = options.entity.options;
this.options.platform = this.options.platform || 'ios';
this.options.platform = options.platform || 'ios';

projectWithConfig(this.project, options.entity.name);

Expand Down
12 changes: 7 additions & 5 deletions lib/tasks/create-cordova-project.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict';

var cordova = require('./cordova');
var runCommand = require('../utils/run-command');
var path = require('path');

module.exports = function(project) {
var config = project.cordovaConfig;
var config = project.cordovaConfig;
var command = 'cordova create cordova ' + config.id + ' ' + config.name;

var args = ['create', 'cordova', config.id, config.name];

return cordova(args, project);
return runCommand(command, 'Creating Cordova project', {
cwd: project.root
});
};
20 changes: 8 additions & 12 deletions node-tests/unit/tasks/create-cordova-project-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ describe('Tasks - Create cordova project', function() {

it('creates the proper command', function() {
var createProject = proxyquire('../../lib/tasks/create-cordova-project', {
'./cordova': proxyquire('../../lib/tasks/cordova', {
'../utils/run-command': function(command) {
expect(command).to.eql('cordova create cordova com.poetic.test-app TestApp');
return resolveFn;
}
})
'../utils/run-command': function(command) {
expect(command).to.eql('cordova create cordova com.poetic.test-app TestApp');
return resolveFn;
}
});

return createProject(project)();
});

it('should execute in proper folder', function() {
var createProject = proxyquire('../../lib/tasks/create-cordova-project', {
'./cordova': proxyquire('../../lib/tasks/cordova', {
'../utils/run-command': function(_, _, options) {
expect(options.cwd).to.equal('project-root/cordova');
return resolveFn;
}
})
'../utils/run-command': function(_, _, options) {
expect(options.cwd).to.equal('project-root');
return resolveFn;
}
});

return createProject(project)();
Expand Down

0 comments on commit 149dc55

Please sign in to comment.