Skip to content

Commit

Permalink
Adding build infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
bbyars committed Mar 27, 2017
1 parent 58ca593 commit 2f53478
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.2
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
node_js:
- "4.4"

env:
global:
# NPM_API_KEY
secure: "foB0MPQdnDtdURLoyc0bAEbdBqs5ST3qygcvZ9LtRKFxHzZxLdONIxnvMdwZWK4hBh1/4mfZU0RgVidQJe2crf4iC8XEa7BNlNg9QEj3AqupintaCIfcj3sxNMloFOgzbr0POAYmwjV7hcVECbO6LVZekbjGaSn847zrAFe1hY7MfWU8AE7mwD+lig9l4LpLPW4knHQSH9amKgI/PGCVBghJWoDklz4We4wBwpBIrT3BC7bYPT2O4e8jOLcS8kWbDMwE5TBm70scrqPRE+v5LVHmspPmj9gyj09IV+yiBl+ILeBnWmwus83186o24/+IPpdwax+tIwXPvdSLWHEXniC9RGo01R6Hmh3H3es0j04WGoQFLUbLLF2SufvU2wks1lGUlIHVgXGHJvraHkR4AEHmmvtn/hPHCacehUytOBG4jlWHYiFOmutbxKCciHBnxU651JqzBSqQhgo/6/9gcZuat74LMkK9DeEOPhkwpBiAmzzgcU0fIlQd/LVd+vfJXmBsMhPJSjFmynmxg4rTMCoiI8WHeiKAVx/mZyqOHP3kw9zBdYlNCO7z0dCzdSohEXvSK5LiVJOdgiqj8TnkJfM1Au0q+krN+wpfxL67Y9T+aYuzNbiHGzw5SWiZmQflBz5FszYpa2OeyxrgO8D2ZHZzMIUoealiYv9VWn2uic0="

install:
- bundle install
- npm install -g npm

script:
- npm -v
- ./build && scripts/publish
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source "https://rubygems.org"

gem "dpl"
gem "fpm"
gem "aws-sdk"
gem "mime-types"

group :development do
gem "travis"
end
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var fs = require('fs'),
thisPackage = require('./package.json'),
version = process.env.DEFACTO_GRUNT_VERSION || thisPackage.version;
version = process.env.NODE_DEFACTO_VERSION || thisPackage.version;

module.exports = function (grunt) {

Expand Down
17 changes: 17 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

IS_PUBLISHED_VERSION=`git describe --tags --exact-match 2>/dev/null`

# NODE_DEFACTO_VERSION is passed to SnapCI build from Travis
if [ -z "$NODE_DEFACTO_VERSION" ]; then
NODE_DEFACTO_VERSION=`cat package.json | grep '"version"' | sed -E -e 's/.*"version": "([^"]*)",/\1/'`
fi

# We don't set the version suffix on tagged (published) builds
if [ -n "$TRAVIS_BUILD_NUMBER" -a -z "$IS_PUBLISHED_VERSION" ]; then
NODE_DEFACTO_VERSION="NODE_DEFACTO_VERSION-beta.$TRAVIS_BUILD_NUMBER"
fi

npm install

NODE_DEFACTO_VERSION=$NODE_DEFACTO_VERSION node_modules/grunt-cli/bin/grunt "$@"
18 changes: 18 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off

REM I want to test x86 and x64 zip files, but no need to retest default grunt task
REM on x86. Appveyor doesn't give me an elegant way to explicitly define the matrix,
REM so we'll just shortcut those nodes in the matrix
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCH=x86|| set ARCH=x64
if "%MB_SKIP_x86%"=="true" (
if "%ARCH%"=="x86" (
echo "Shortcutting build, MB_SKIP_x86=true"
goto :eof
)
)

call npm install

node node_modules\grunt-cli\bin\grunt %*

:eof
16 changes: 16 additions & 0 deletions scripts/publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

PUBLISH=$1

echo "Deploying to npm (PUBLISH=$PUBLISH)..."

if [ "$PUBLISH" != "true" ]; then
# Test npm publish to detect issues before the production publish
# I've been surprised by Travis-related errors before
mv package.json package.json.orig
sed -E -e 's/"name": "node-defacto"/"name": "node-defacto-dev"/' package.json.orig > package.json
fi

dpl --provider=npm [email protected] --api-key=$NPM_API_KEY --skip-cleanup

0 comments on commit 2f53478

Please sign in to comment.