From 9c5cdde8e3d7db16b0db4cbfa88471f72f09c281 Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Fri, 22 May 2015 11:48:32 +0100 Subject: [PATCH 1/2] made about.json generation into a task --- README.md | 7 ++++--- bin/next-build-tools.js | 8 ++++++++ tasks/about.js | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 tasks/about.js diff --git a/README.md b/README.md index 652cdd08..3a04087e 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Commands: - deploy [ - app] runs haikro deployment scripts with sensible defaults for Next projects + + deploy [app] runs haikro deployment scripts with sensible defaults for Next projects configure [options] [source] [target] downloads environment variables from next-config-vars and uploads them to the current app scale [source] [target] downloads process information from next-service-registry and scales/sizes the application servers provision [app] provisions a new instance of an application server @@ -18,6 +18,7 @@ purge [options] [url] purges the given url from the Fastly cache. Requires a FASTLY_KEY environment variable set to your fastly api key deploy-vcl [options] [folder] Deploys VCL in [folder] to the specified fastly service. Requires FASTLY_KEY env var run [options] Runs the local app through the router + about Creates an __about.json file for the app deploy-static [options] [otherSources...] Deploys static to [destination] on S3 (where [destination] is a full S3 URL). Requires AWS_ACCESS and AWS_SECRET env vars * @@ -25,7 +26,7 @@ -h, --help output usage information -V, --version output the version number - + ``` ## Development diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index cbb39c39..d7aa4198 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -18,6 +18,7 @@ var nightwatch = require('../tasks/nightwatch'); var deployHashedAssets = require('../tasks/deploy-hashed-assets'); var deployStatic = require('../tasks/deploy-static'); var run = require('../tasks/run'); +var about = require('../tasks/about'); function list(val) { return val.split(','); @@ -152,6 +153,13 @@ program run(opts).catch(exit); }); +program + .command('about') + .description('Creates an __about.json file for the app') + .action(function(){ + about().catch(exit); + }); + program .command('deploy-static [otherSources...]') .description('Deploys static to [destination] on S3 (where [destination] is a full S3 URL). Requires AWS_ACCESS and AWS_SECRET env vars') diff --git a/tasks/about.js b/tasks/about.js new file mode 100644 index 00000000..64466bfd --- /dev/null +++ b/tasks/about.js @@ -0,0 +1,10 @@ +'use strict'; + +var about = require('../lib/about'); +var packageJson = require(process.cwd() + '/package.json'); +var normalizeName = require('../lib/normalize-name'); +module.exports = function() { + return about({ + name: 'ft-next-' + normalizeName(packageJson.name) + }); +}; From e3fb6a54b8873392a1daea37b226868ed7a9b260 Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Fri, 22 May 2015 11:53:18 +0100 Subject: [PATCH 2/2] reinstated verify in the build --- .travis.yml | 2 +- README.md | 7 ++----- test/deploy-vcl.test.js | 11 ++++------- test/purge.test.js | 1 + 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40404296..e08030e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: node_js -script: make test +script: make verify test node_js: - '0.12.2' before_deploy: diff --git a/README.md b/README.md index 3a04087e..f4538abf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -# next-build-tools [![Build Status](https://travis-ci.org/Financial-Times/next-build-tools.svg?branch=v2.4.2)](https://travis-ci.org/Financial-Times/next-build-tools) +# next-build-tools -``` Usage: next-build-tools [options] [command] @@ -20,14 +19,12 @@ run [options] Runs the local app through the router about Creates an __about.json file for the app deploy-static [options] [otherSources...] Deploys static to [destination] on S3 (where [destination] is a full S3 URL). Requires AWS_ACCESS and AWS_SECRET env vars - * + * Options: -h, --help output usage information -V, --version output the version number -``` - ## Development Warning the README.md is automatically generated. Run `make docs` to update. diff --git a/test/deploy-vcl.test.js b/test/deploy-vcl.test.js index 05607b35..2270877e 100644 --- a/test/deploy-vcl.test.js +++ b/test/deploy-vcl.test.js @@ -1,3 +1,4 @@ +/* global describe, it, before, after */ 'use strict'; var sinon = require('sinon'); var expect = require('chai').expect; @@ -8,10 +9,6 @@ var fastlyMock = require('./mocks/fastly.mock'); mockery.registerMock('fastly', fastlyMock); var path = require('path'); - - - - describe.only('Deploy VCL', function(){ var deployVcl; @@ -29,7 +26,7 @@ describe.only('Deploy VCL', function(){ deployVcl(path.resolve(__dirname, './fixtures/vcl')+'/', {service:fastlyMock.fakeServiceId}).then(function(){ sinon.assert.called(fastlyMock().updateVcl); done(); - }) + }); }); it('Should replace placeholders with environment vars', function(done){ @@ -44,7 +41,7 @@ describe.only('Deploy VCL', function(){ expect(vcl).to.contain(value); expect(vcl).not.to.contain('${AUTH_KEY}'); done(); - }) - }) + }); + }); }); diff --git a/test/purge.test.js b/test/purge.test.js index 7ae863c4..ea688125 100644 --- a/test/purge.test.js +++ b/test/purge.test.js @@ -1,3 +1,4 @@ +/* global describe, it */ 'use strict'; var expect = require('chai').expect;