diff --git a/lib/commands/serve.js b/lib/commands/serve.js index 51996bea..eeba1794 100644 --- a/lib/commands/serve.js +++ b/lib/commands/serve.js @@ -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 diff --git a/lib/commands/start.js b/lib/commands/start.js index 3224a956..6b05558c 100644 --- a/lib/commands/start.js +++ b/lib/commands/start.js @@ -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; diff --git a/node-tests/unit/commands/build-test.js b/node-tests/unit/commands/build-test.js index 61ff6722..45633352 100644 --- a/node-tests/unit/commands/build-test.js +++ b/node-tests/unit/commands/build-test.js @@ -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'); + }); + }); }); diff --git a/node-tests/unit/commands/serve-test.js b/node-tests/unit/commands/serve-test.js index aec3c935..53fad00d 100644 --- a/node-tests/unit/commands/serve-test.js +++ b/node-tests/unit/commands/serve-test.js @@ -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([ diff --git a/node-tests/unit/commands/start-test.js b/node-tests/unit/commands/start-test.js index d6678bc6..4d367d25 100644 --- a/node-tests/unit/commands/start-test.js +++ b/node-tests/unit/commands/start-test.js @@ -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() {