Skip to content

Commit

Permalink
fix(serve/start): pass corber_platform. Partial fix to #509
Browse files Browse the repository at this point in the history
  • Loading branch information
alexblom committed Jul 10, 2018
1 parent 7c7342a commit 82f35c7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ module.exports = Command.extend({
this.project.targetIsCordova = true;
this.project.targetIsCordovaLivereload = true;
this.project.CORBER_PLATFORM = opts.platform;

// allows platform-specific tuning in framework build pipeline
process.env.CORBER_PLATFORM = opts.platform;

let hook = new Hook({
project: this.project
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ module.exports = Command.extend({
this.project.targetIsCordova = true;
this.project.CORBER_PLATFORM = device.platform;
this.project.targetIsCordovaLivereload = true;
// allows platform-specific tuning in framework build pipeline
process.env.CORBER_PLATFORM = opts.platform;

cdvTarget.platform = device.platform;

Expand Down
7 changes: 7 additions & 0 deletions node-tests/unit/commands/build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,11 @@ describe('Build Command', function() {
}));
});
});

it('sets process.env.CORBER_PLATFORM', function() {
let build = setupBuild();
return build.run(baseOpts).then(function() {
expect(process.env.CORBER_PLATFORM).to.equal('ios');
});
});
});
6 changes: 6 additions & 0 deletions node-tests/unit/commands/serve-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ describe('Serve Command', function() {
});
});

it('sets process.env.CORBER_PLATFORM', function() {
return serveCmd.run({platform: 'ios'}).then(function() {
expect(process.env.CORBER_PLATFORM).to.equal('ios');
});
});

it('runs tasks in the correct order', function() {
return serveCmd.run({}).then(function() {
expect(tasks).to.deep.equal([
Expand Down
6 changes: 6 additions & 0 deletions node-tests/unit/commands/start-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ describe('Start Command', function() {
expect(mockProject.project.targetIsCordovaLivereload).to.equal(true);
});
});

it('sets process.env.CORBER_PLATFORM', function() {
return start.run({build: false, platform: 'ios'}).then(function() {
expect(process.env.CORBER_PLATFORM).to.equal('ios');
});
});
});

describe('getReloadURL', function() {
Expand Down

0 comments on commit 82f35c7

Please sign in to comment.