Permalink
Browse files

Initial commit new workflow + unit tests

  • Loading branch information...
1 parent 91eb0c0 commit 5c40ebb5c5a1c22855bdeefc35b3364089a5a959 @wieringen committed Jan 20, 2015
View
@@ -1,6 +1,7 @@
.DS_Store
.ftppass
dist/
+docs/technical/generated/
node_modules/
*.sublime-project
*.sublime-workspace
View
@@ -2,4 +2,15 @@ language: node_js
node_js:
- 0.10
before_script:
- - npm install -g grunt-cli
+ - export CHROME_BIN=chromium-browser
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+ - npm install -g grunt-cli
+env:
+ global:
+ - secure: h/UQzq/D5P/fmZRCTNdJt5LrKjCNSEKY+nTfgnzXk3yt5bIvVVxkOLsWo8dmb7JWKHhS/UJrwzmrFNCNh2DH8Zm/ffkW505Z4tH3f6tZjEoQ0nSVyuumsJ7I7rEQ0Y7e2nGE+2X8FY54JIe+hM2mUdA87OLV8XL8pcYpQDO/I7s=
+ - secure: GJCmrqpUEkbAJ8/BfWvh8bGhGH8By1lOCTyArzBNph6EcW1x48fkVrnPYHt4JIEbDFtZbsUCeDoUut44m0pnqEb1JOEyDKDHZIWka+5i2qH4omod5zXkV9spXJ9RiM9gNlIlzQhc6A7u4uMC3pvgo8rvRONxN/I7Pf13tyDhgHQ=
+script:
+- grunt ci
+after_script:
+- cat ./dist/reports/coverage/**/lcov.info | ./node_modules/coveralls/bin/coveralls.js
View
@@ -1,185 +1,185 @@
module.exports = ( grunt ) ->
+ grunt.loadNpmTasks "grunt-contrib-clean"
+ grunt.loadNpmTasks "grunt-contrib-compress"
+ grunt.loadNpmTasks "grunt-contrib-copy"
+ grunt.loadNpmTasks "grunt-contrib-jshint"
+ grunt.loadNpmTasks "grunt-contrib-uglify"
+ grunt.loadNpmTasks "grunt-contrib-yuidoc"
+ grunt.loadNpmTasks "grunt-ftp-deploy"
+ grunt.loadNpmTasks "grunt-karma"
+ grunt.loadNpmTasks "grunt-processhtml"
+
grunt.initConfig
- pkg : grunt.file.readJSON "package.json"
+ pkg: grunt.file.readJSON "package.json"
# Banner we want to show above the minified js files.
#
- banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
+ banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n ' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n *\\n " : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> <<%= pkg.author.email %>>;\n' +
' * Licensed under the <%= _.pluck(pkg.licenses, "type").join(", ") %> license */\n\n'
- # Remove old build.
- #
- clean :
- dist :
+ # Validate javascript files with jsHint.
+ #
+ jshint:
+ options:
+ jshintrc: ".jshintrc"
+ all: [
+ "lib/jquery.<%= pkg.name %>.js"
+ ]
- src : ["dist"]
- # Copy the images and the index to the dist location.
+ # Run unit tests.
#
- copy :
+ karma:
+ dev:
+ configFile: "test/conf/karma-dev.js"
+ ci:
+ configFile: "test/conf/karma-ci.js"
+
- docs :
+ # Remove old build.
+ #
+ clean:
+ dist:
+ src: "dist/"
- files : [
- { expand: true, cwd: "docs", src: "**/*", dest: "dist/docs", dot: true}
+ # Copy the images and the index to the dist location.
+ #
+ copy:
+ docs:
+ files: [
+ { expand: true, cwd: "docs", src: ["**/*", "!technical/**"], dest: "dist/docs", dot: true }
{ expand: true, cwd: "node_modules/baijs", src: "css/**/*", dest: "dist/docs" }
{ expand: true, cwd: "node_modules/baijs", src: "js/**/*", dest: "dist/docs" }
{ expand: true, cwd: "lib", src: "**/*", dest: "dist/docs/js" }
]
- examples :
-
- files : [
- { expand: true, cwd: "examples", src: "**/*", dest: "dist/examples" }
+ examples:
+ files: [
+ { expand: true, cwd: "examples", src: "**/*", dest: "dist/examples" }
{ expand: true, cwd: "lib", src: "jquery.<%= pkg.name %>*", dest: "dist/examples/simple" }
]
- # Validate javascript files with jsHint.
+ # Generate technical documentation from code.
#
- jshint :
-
- options :
-
- jshintrc : ".jshintrc"
-
- all : [
- "lib/jquery.<%= pkg.name %>.js"
- "lib/<%= pkg.name %>.js"
- ]
+ yuidoc:
+ compile:
+ name: '<%= pkg.name %>'
+ description: '<%= pkg.description %>'
+ version: '<%= pkg.version %>'
+ url: '<%= pkg.homepage %>'
+ options:
+ paths: 'lib/'
+ themedir: 'docs/technical/theme',
+ outdir: 'docs/technical/generated'
# Minify the javascript.
#
- uglify :
-
- lib :
-
- options :
-
- banner : "<%= banner %>"
- beautify : false
-
- files :
+ uglify:
+ dist:
+ options:
+ banner: "<%= banner %>"
+ beautify: false
+ files: [
+ { src: "lib/jquery.<%= pkg.name %>.js", dest: "lib/jquery.<%= pkg.name %>.min.js" }
+ ]
- "lib/jquery.<%= pkg.name %>.min.js" : ["lib/jquery.<%= pkg.name %>.js"]
- # Replace image file paths in css and correct css path in the index.
+ # Set paths and version.
#
- replace :
-
- dist :
-
- src : [
- "dist/docs/index.html"
- "dist/examples/**/*.html"
- ]
- overwrite : true
- replacements : [
- {
- from : /@@bnr@@/ig
- to : "<%= pkg.version %>"
- }
- {
- from : /..\/node_modules\/baijs\//ig
- to : ""
- }
- {
- from : /..\/..\/lib\//ig
- to : ""
- }
- {
- from : /..\/lib\//ig
- to : "js/"
- }
-
+ processhtml:
+ options:
+ process: true
+ strip: true
+ environment: "dist"
+ data:
+ version: "<%= pkg.version %>"
+ html:
+ files: [
+ { expand: true, src: "dist/docs/index.html" }
+ { expand: true, src: "dist/examples/**/*.html" }
]
# Make a zipfile from the dist and examples.
#
- compress :
-
- docs :
-
- options :
-
+ compress:
+ docs:
+ options:
archive: "dist/<%= pkg.name %>-<%= pkg.version %>-docs.zip"
-
- expand : true
- cwd : "dist/docs"
- src : ["**/*"]
- dest : "."
+ expand: true
+ cwd: "dist/docs"
+ src: "**/*"
+ dest: "."
examples :
-
options :
-
archive: "dist/<%= pkg.name %>-<%= pkg.version %>.zip"
-
expand : true
- cwd : "dist/examples"
- src : ["**/*"]
- dest : "."
+ cwd: "dist/examples"
+ src: "**/*"
+ dest: "."
+
# Deploy plugin to baijs.com
#
- "ftp-deploy" :
-
- docs :
-
- auth :
-
- host : "ftp.baijs.nl"
- port : 21
- authKey : "<%= pkg.name %>"
-
- src : "dist/docs"
- dest : "/"
-
- examples :
-
- auth :
-
- host : "ftp.baijs.nl"
- port : 21
- authKey : "<%= pkg.name %>"
-
- src : "dist/"
- dest : "/"
- exclusions: ["docs", "<%= pkg.name %>-<%= pkg.version %>-docs.zip"]
-
- # Load all the task modules we need.
- #
- grunt.loadNpmTasks "grunt-contrib-copy"
- grunt.loadNpmTasks "grunt-contrib-clean"
- grunt.loadNpmTasks "grunt-contrib-uglify"
- grunt.loadNpmTasks "grunt-text-replace"
- grunt.loadNpmTasks "grunt-contrib-compress"
- grunt.loadNpmTasks "grunt-ftp-deploy"
- grunt.loadNpmTasks "grunt-contrib-jshint"
+ "ftp-deploy":
+ docs:
+ auth:
+ host: "ftp.baijs.nl"
+ port: 21
+ authKey: "<%= pkg.name %>"
+ src: "dist/docs"
+ dest: "/"
+
+ examples:
+ auth:
+ host: "ftp.baijs.nl"
+ port: 21
+ authKey: "<%= pkg.name %>"
+ src: "dist/"
+ dest: "/"
+ exclusions: [
+ "docs"
+ "<%= pkg.name %>-<%= pkg.version %>-docs.zip"
+ ]
- # Dist build
- #
grunt.registerTask(
- "default"
+ "common"
[
"jshint"
- "clean:dist"
"copy:docs"
- "uglify:lib"
+ "yuidoc"
+ "uglify:dist"
"copy:examples"
- "replace:dist"
+ "processhtml"
"compress:docs"
"compress:examples"
]
)
- # Upload dist to baijs.nl
- #
+ grunt.registerTask(
+ "default"
+ [
+ "clean:dist"
+ "karma:dev"
+ "common"
+ ]
+ )
+
+ grunt.registerTask(
+ "ci"
+ [
+ "clean:dist"
+ "karma:ci"
+ "common"
+ ]
+ )
+
grunt.registerTask(
"ftp"
[
View
@@ -1,4 +1,4 @@
-[tinycircleslider](http://baijs.com/tinycircleslider) [![Build Status](https://secure.travis-ci.org/wieringen/tinycircleslider.png?branch=master)](http://travis-ci.org/wieringen/tinycircleslider)
+[tinycircleslider](http://baijs.com/tinycircleslider) [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url]
==================================================
What you need to build your own version of tinycircleslider
@@ -48,4 +48,10 @@ Questions?
If you have any questions, please feel free to email [me](mailto:wieringen@gmail.com).
+[travis-image]: https://travis-ci.org/wieringen/tinycircleslider.svg?branch=master
+[travis-url]: https://travis-ci.org/wieringen/tinycircleslider
+
+[coveralls-image]: https://img.shields.io/coveralls/wieringen/tinycircleslider/master.svg
+[coveralls-url]: https://coveralls.io/r/wieringen/tinycircleslider?branch=master
+
Oops, something went wrong.

0 comments on commit 5c40ebb

Please sign in to comment.