Permalink
Browse files

Merge pull request #263 from koenbok/version-number

Add build information and version number
  • Loading branch information...
koenbok committed Dec 14, 2015
2 parents cfb7d76 + 34f1df6 commit 4a3b67f5404a8c1c98c80a72e8c58bbda1871076
@@ -17,6 +17,9 @@ extras/Studio.framer/app.js
test/phantomjs/tests.js
test/phantomjs/tests.js.map
# Discard version changes
framer/Version.coffee
.DS_Store
.AppleDouble
.LSOverride
@@ -42,3 +45,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
@@ -8,11 +8,9 @@ all: build
bootstrap:
npm install
cd test/phantomjs; "$(bin)/bower" --config.analytics=false install
unbootstrap:
rm -Rf node_modules
rm -Rf test/phantomjs/bower
clean:
rm -rf build
@@ -41,6 +41,9 @@ Framer.Importer = (require "./Importer").Importer
Framer.Debug = (require "./Debug").Debug
Framer.Extras = require "./Extras/Extras"
# Add version info
Framer.Version = require "../build/Version"
Framer.Loop = new Framer.AnimationLoop()
Utils.domComplete(Framer.Loop.start)
@@ -0,0 +1,7 @@
# This gets automatically populated bij gulp
exports.date = <%= date %>
exports.branch = "<%= branch %>"
exports.hash = "<%= hash %>"
exports.build = <%= build %>
exports.version = "#{exports.branch}/#{exports.hash}"
@@ -1,8 +1,17 @@
_ = require("lodash")
async = require("async")
gulp = require("gulp")
phantomjs = require("gulp-mocha-phantomjs")
webpack = require("webpack")
gulpWebpack = require("gulp-webpack")
rename = require("gulp-rename")
template = require("gulp-template")
gutil = require "gulp-util"
{exec} = require("child_process")
command = (cmd, cb) ->
exec cmd, {cwd: __dirname}, (err, stdout, stderr) ->
cb(null, stdout.split('\n').join(''))
CONFIG =
module:
@@ -12,7 +21,7 @@ CONFIG =
cache: true
devtool: "sourcemap"
gulp.task "build:release", ->
gulp.task "build:release", ["version"], ->
config = _.extend CONFIG,
entry: "./framer/Framer.coffee"
@@ -35,7 +44,7 @@ gulp.task "build:release", ->
.pipe(gulpWebpack(config))
.pipe(gulp.dest("build/"))
gulp.task "build:debug", ->
gulp.task "build:debug", ["version"], ->
config = _.extend CONFIG,
entry: "./framer/Framer.coffee"
@@ -61,12 +70,12 @@ gulp.task "build:test", ->
gulp.task "test", ["build:debug", "build:test"], ->
return gulp
.src("test/phantomjs/index.html")
.pipe(phantomjs({reporter: "landing"}))
.pipe(phantomjs({reporter:"dot"}))
gulp.task "watch", ["test"], ->
gulp.watch(["./*.coffee", "framer/**", "test/tests/**"], ["test"])
gulp.watch(["./*.coffee", "framer/**", "test/tests/**", "!Version.coffee"], ["test"])
gulp.task "watcher", ->
gulp.task "watcher", ["version"], ->
config = _.extend CONFIG,
entry: "./framer/Framer.coffee"
@@ -79,6 +88,38 @@ gulp.task "watcher", ->
.pipe(gulpWebpack(config))
.pipe(gulp.dest("build/"))
gulp.task "version", (callback) ->
async.series [
(cb) -> command("git rev-parse --abbrev-ref HEAD", cb) # branch
(cb) -> command("git describe --always --dirty", cb) # hash
(cb) -> command("git rev-list --count HEAD", cb) # build
], (err, results) ->
info =
branch: results[0]
hash: results[1]
build: results[2]
date: Math.floor(Date.now() / 1000)
# If we are on the wercker platform, we need to get the branch
# name from the env variables and remove the dirty vrom version.
if process.env.WERCKER_GIT_BRANCH
info.branch = process.env.WERCKER_GIT_BRANCH
info.hash = info.hash.replace("-dirty", "")
gutil.log "Building ", gutil.colors.green("#{info.branch}/#{info.hash} @#{info.build}")
task = gulp.src("framer/Version.coffee.template")
.pipe(template(info))
.pipe(rename({
basename: "Version",
extname: ".coffee"
}))
.pipe(gulp.dest("build"))
callback(null, task)
gulp.task "build:coverage", ->
config = _.extend CONFIG,
@@ -16,25 +16,30 @@
},
"dependencies": {
"eventemitter3": "^1.1.1",
"gulp-util": "^3.0.7",
"lodash": "^3.5.0"
},
"devDependencies": {
"async": "^1.5.0",
"bower": "^1.3.12",
"coffee-coverage": "^0.7.0",
"coffee-loader": "^0.7.2",
"coffee-script": "^1.9.1",
"coverage-capture": "./test/coverage-capture",
"gulp": "^3.8.11",
"gulp-mocha-phantomjs": "^0.10.1",
"gulp-rename": "^1.2.2",
"gulp-template": "^3.1.0",
"gulp-webpack": "^1.3.1",
"husl": "^6.0.1",
"mocha-phantomjs": "^4.0.1",
"should": "^8.0.0",
"simulate": "^0.0.4",
"webpack": "^1.7.3",
"knox": "^0.9.2",
"mime": "^1.3.4",
"mustache": "^2.0.0"
"mocha-phantomjs": "^4.0.1",
"mustache": "^2.0.0",
"should": "^7.1.1",
"simulate": "^0.0.5",
"webpack": "^1.7.3",
"mocha": "^2.3.4",
"chai": "^3.4.1"
},
"keywords": [
"prototyping"

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -1,16 +1,13 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="bower/mocha/mocha.css">
<style type="text/css">
.framerContext {visibility: hidden}
</style>
</head>
<body>
<div id="mocha"></div>
<script src="bower/mocha/mocha.js"></script>
<script src="bower/chai/chai.js"></script>
<script src="bower/should/should.js"></script>
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../build/framer.debug.js"></script>
<script src="tests.js"></script>
</body>
@@ -1,11 +1,12 @@
window.chai = require("chai")
window.should = require("should")
window.console.debug = (v) ->
window.console.warn = (v) ->
mocha.setup("bdd")
mocha.setup({ui:"bdd", bail:true, reporter:"dot"})
mocha.globals(["__import__"])
assert = chai.assert
require "./tests/EventEmitterTest"
require "./tests/UtilsTest"
require "./tests/BaseClassTest"
@@ -16,10 +17,7 @@ require "./tests/ImporterTest"
require "./tests/LayerAnimationTest"
require "./tests/ContextTest"
require "./tests/ScrollComponentTest"
require "./tests/VersionTest"
require "./tests/ColorTest"
# Start mocha
if window.mochaPhantomJS
mochaPhantomJS.run()
else
mocha.run()
mocha.run()
@@ -0,0 +1,15 @@
describe "Version", ->
it "should have a branch", ->
(typeof Framer.Version.branch).should.equal "string"
Framer.Version.branch.length.should.be.above(1)
it "should have a hash", ->
(typeof Framer.Version.hash).should.equal "string"
Framer.Version.hash.length.should.be.above(5)
it "should have a build", ->
(typeof Framer.Version.build).should.equal "number"
it "should have a date", ->
(typeof Framer.Version.date).should.equal "number"
@@ -1,38 +1,25 @@
box: wercker/nodejs
box: nolimitid/node-phantom-npm3
build:
steps:
- script:
name: set up permissions
name: load git revisions
code: |
export NODE_ENV=development
chmod 777 -R .
chmod 777 -R $WERCKER_CACHE_DIR
- script:
name: install npm@2
code: |
npm cache clean
sudo npm i -g npm
- npm-install
git remote set-url origin https://github.com/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
cd $WERCKER_SOURCE_DIR
git fetch --unshallow
- npm-test
deploy:
steps:
- script:
name: set up permissions
name: load git revisions
code: |
export NODE_ENV=development
chmod 777 -R .
chmod 777 -R $WERCKER_CACHE_DIR
- script:
name: install npm@2
code: |
npm cache clean
sudo npm i -g npm
git remote set-url origin https://github.com/$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY.git
cd $WERCKER_SOURCE_DIR
git fetch --unshallow
- install-packages:
packages: zip
- script:
name: builds.framerjs.com
code: make deploy
# $WERCKER_OUTPUT_DIR
code: make deploy

0 comments on commit 4a3b67f

Please sign in to comment.