Permalink
Browse files

Replacing `make` with `grunt` for builds.

Make does not work on Windows, Grunt works cross-platform.
Fixes #71.
Closes #71.
  • Loading branch information...
1 parent 6560660 commit 067f56bd0ce72dbee4a81c0dcd7cdd05b81276de @JamesMGreene JamesMGreene committed Aug 13, 2013
View
@@ -1,3 +1,5 @@
language: node_js
node_js:
- - 0.8
+ - "0.10"
+before_script:
+ - npm install -g grunt-cli
View
@@ -1,16 +1,25 @@
Contributing
==============
-If you find an issue, a pull request is always better than a bug report. Please fork and submit your code fixes.
+If you find an issue, submitting a pull request is always better than a bug report! Please fork and submit your code fixes.
If you want to build some new features, we have a [roadmap.md](docs/roadmap.md) of features we want. You can add features you want there, or just code the feature and send a pull request.
### Cloning
$ git clone https://github.com/zeroclipboard/ZeroClipboard.git
$ cd ZeroClipboard/
- $ make
+ $ npm install -g grunt-cli
+ $ npm install
+ $ grunt
-### Tests
- $ make test
+### Developing
+
+ $ npm install
+ $ grunt
+
+
+### Testing
+
+ $ grunt test
View
@@ -0,0 +1,128 @@
+/*jshint -W106 */
+module.exports = function(grunt) {
+
+ // Metadata
+ var pkg = grunt.file.readJSON('package.json');
+
+ // Project configuration.
+ grunt.initConfig({
+ // Task configuration
+ jshint: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ Gruntfile: ['Gruntfile.js'],
+ js: ['src/javascript/ZeroClipboard/**/*.js'],
+ test: {
+ options: {
+ jshintrc: 'test/.jshintrc'
+ },
+ src: ['test/*.js']
+ }
+ },
+ clean: {
+ dist: ['ZeroClipboard.*', 'bower.json', 'LICENSE']
+ },
+ concat: {
+ options: {
+ stripBanners: true,
+ process: {
+ data: pkg
+ }
+ },
+ js: {
+ src: [
+ 'src/meta/source-banner.tmpl',
+ 'src/javascript/start.js',
+ 'src/javascript/ZeroClipboard/utils.js',
+ 'src/javascript/ZeroClipboard/client.js',
+ 'src/javascript/ZeroClipboard/core.js',
+ 'src/javascript/ZeroClipboard/dom.js',
+ 'src/javascript/ZeroClipboard/event.js',
+ 'src/javascript/end.js'
+ ],
+ dest: 'ZeroClipboard.js'
+ }
+ },
+ uglify: {
+ options: {
+ preserveComments: 'some',
+ report: 'min'
+ },
+ js: {
+ options: {
+ beautify: {
+ beautify: true,
+ // `indent_level` requires jshint -W106
+ indent_level: 2
+ },
+ mangle: false,
+ compress: false
+ },
+ src: ['ZeroClipboard.js'],
+ dest: 'ZeroClipboard.js'
+ },
+ minjs: {
+ src: ['ZeroClipboard.js'],
+ dest: 'ZeroClipboard.min.js'
+ }
+ },
+ mxmlc: {
+ options: {
+ rawConfig: '-static-link-runtime-shared-libraries=true'
+ },
+ swf: {
+ files: {
+ 'ZeroClipboard.swf': ['src/flash/ZeroClipboard.as']
+ }
+ }
+ },
+ template: {
+ options: {
+ data: pkg
+ },
+ bower: {
+ files: {
+ 'bower.json': ['src/meta/bower.json.tmpl']
+ }
+ },
+ LICENSE: {
+ files: {
+ 'LICENSE': ['src/meta/LICENSE.tmpl']
+ }
+ }
+ },
+ chmod: {
+ options: {
+ mode: '444'
+ },
+ dist: ['ZeroClipboard.*', 'bower.json', 'LICENSE']
+ },
+ nodeunit: {
+ all: ['test/*.js']
+ }
+ });
+
+ // These plugins provide necessary tasks
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-nodeunit');
+ grunt.loadNpmTasks('grunt-contrib-concat');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-mxmlc');
+ grunt.loadNpmTasks('grunt-chmod');
+ grunt.loadNpmTasks('grunt-template');
+
+
+ //
+ // Task aliases and chains
+ //
+
+ // Default task
+ grunt.registerTask('default', ['jshint', 'clean', 'concat', 'uglify', 'mxmlc', 'template', 'chmod', 'nodeunit']);
+
+ // Other tasks
+ grunt.registerTask('test', ['jshint', 'nodeunit']);
+ grunt.registerTask('travis', ['test']);
+
+};
View
@@ -1,9 +1,8 @@
The MIT License (MIT)
-Copyright (c) 2013 Jon Rohan, James M. Greene,
+Copyright (c) 2013 Jon Rohan, James M. Greene
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
View
@@ -1,62 +0,0 @@
-# set an environment variable to override this to your location. export SWF_COMPILER = /My/Location/bin/mxmlc
-SWF_COMPILER ?= /Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0/bin/mxmlc -static-link-runtime-shared-libraries=true
-
-NODE_PATH = ./node_modules
-JS_COMPILER = $(NODE_PATH)/uglify-js/bin/uglifyjs
-JS_BEAUTIFIER = $(NODE_PATH)/uglify-js/bin/uglifyjs -b -i 2 -nm -ns
-JS_TEST = $(NODE_PATH)/nodeunit/bin/nodeunit
-JS_HINT = $(NODE_PATH)/jshint/bin/hint
-
-all: \
- node_modules \
- ZeroClipboard.min.js \
- ZeroClipboard.swf \
- bower.json \
- LICENSE \
- test \
-
-node_modules: Makefile
- npm install
-
-.INTERMEDIATE ZeroClipboard.js: \
- src/javascript/start.js \
- src/javascript/ZeroClipboard/utils.js \
- src/javascript/ZeroClipboard/client.js \
- src/javascript/ZeroClipboard/core.js \
- src/javascript/ZeroClipboard/dom.js \
- src/javascript/ZeroClipboard/event.js \
- src/javascript/end.js
-
-ZeroClipboard.js:
- @rm -f $@
- cat $^ | node src/build.js | $(JS_BEAUTIFIER) > $@
- @chmod a-w $@
-
-ZeroClipboard.min.js: ZeroClipboard.js
- @rm -f $@
- $(JS_COMPILER) ./ZeroClipboard.js > $@
- @chmod a-w $@
-
-ZeroClipboard.swf: src/flash/ZeroClipboard.as
- @rm -f $@
- $(SWF_COMPILER) -output $@ $^ -source-path src/flash
- @chmod a-w $@
-
-LICENSE: Makefile
- @rm -f $@
- cat ./src/license.js | node src/build.js > $@
- @chmod a-w $@
-
-bower.json: Makefile
- @rm -f $@
- cat ./src/bower.js | node src/build.js > $@
- @chmod a-w $@
-
-test: ZeroClipboard.min.js
- $(JS_HINT) ./src/javascript/ZeroClipboard/*.js
- $(JS_TEST) ./test
-
-clean:
- rm -rf ./bower.json ./ZeroClipboard* ./LICENSE
-
-.PHONY: all test clean
View
@@ -1,11 +1,12 @@
/*!
- * zeroclipboard
- * The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface.
- * Copyright 2013 Jon Rohan, James M. Greene, .
- * Released under the MIT license
- * http://zeroclipboard.github.io/ZeroClipboard/
- * v1.2.0-beta.4
- */(function() {
+* ZeroClipboard
+* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
+* Copyright (c) 2013 Jon Rohan, James M. Greene
+* Licensed MIT
+* http://zeroclipboard.github.io/ZeroClipboard/
+* v1.2.0-beta.4 (2013-08-23)
+*/
+(function() {
"use strict";
var _camelizeCssPropName = function() {
var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
@@ -158,7 +159,7 @@
var _noCache = function(path) {
var client = ZeroClipboard.prototype._singleton;
if (client.options.useNoCache) {
- return (path.indexOf("?") >= 0 ? "&nocache=" : "?nocache=") + (new Date).getTime();
+ return (path.indexOf("?") >= 0 ? "&nocache=" : "?nocache=") + new Date().getTime();
} else {
return "";
}
@@ -373,19 +374,24 @@
}
this.htmlBridge.setAttribute("data-clipboard-ready", true);
break;
+
case "mouseover":
_addClass(element, this.options.hoverClass);
break;
+
case "mouseout":
_removeClass(element, this.options.hoverClass);
this.resetBridge();
break;
+
case "mousedown":
_addClass(element, this.options.activeClass);
break;
+
case "mouseup":
_removeClass(element, this.options.activeClass);
break;
+
case "datarequested":
var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
if (targetEl) {
@@ -397,6 +403,7 @@
}
performCallbackAsync = false;
break;
+
case "complete":
this.options.text = null;
break;
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
Binary file not shown.
View
@@ -2,4 +2,4 @@
"name": "zeroclipboard",
"version": "1.2.0-beta.4",
"main": ["./ZeroClipboard.js", "./ZeroClipboard.swf"]
-}
+}
View
@@ -1,16 +1,21 @@
{
"name": "zeroclipboard",
+ "title": "ZeroClipboard",
"version": "1.2.0-beta.4",
- "main": "./ZeroClipboard.js",
- "description": "The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface.",
+ "description": "The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.",
"keywords": [
"flash",
"clipboard",
"copy",
"paste"
],
"homepage": "http://zeroclipboard.github.io/ZeroClipboard/",
- "license": "MIT",
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/zeroclipboard/ZeroClipboard/blob/master/LICENSE"
+ }
+ ],
"contributors": [
{
"name": "Jon Rohan",
@@ -30,19 +35,26 @@
"send": "0"
},
"devDependencies": {
- "uglify-js": "1.2.3",
- "nodeunit": "0.7.4",
- "jshint": "0.9.1",
- "handlebars": "1.0.7",
- "jsdom": "0.3.4",
- "jquery": "1.8.3"
+ "nodeunit": "~0.8.1",
+ "jsdom": "~0.8.3",
+ "jquery": "1.8.3",
+ "grunt": "~0.4.1",
+ "grunt-contrib-clean": "~0.5.0",
+ "grunt-contrib-jshint": "~0.6.3",
+ "grunt-contrib-nodeunit": "~0.2.0",
+ "grunt-contrib-concat": "~0.3.0",
+ "grunt-contrib-uglify": "~0.2.2",
+ "grunt-chmod": "~1.0.3",
+ "grunt-mxmlc": "~0.2.0",
+ "grunt-template": "~0.2.0"
},
+ "main": "./ZeroClipboard.js",
"component": {
"scripts": {
"zeroclipboard": "ZeroClipboard.js"
}
},
"scripts": {
- "test": "make test"
+ "test": "grunt travis --verbose"
}
}
View
@@ -1,13 +0,0 @@
-var FILE_ENCODING = 'utf-8';
-
-var _handlebars = require('handlebars'),
- _fs = require('fs');
-
-var distContent = _fs.readFileSync('/dev/stdin', FILE_ENCODING);
-var template = _handlebars.compile(distContent);
-
-//reuse package.json data and add build date
-var data = JSON.parse( _fs.readFileSync('package.json', FILE_ENCODING) );
-data.build_date = (new Date()).toUTCString();
-
-console.log(template(data));
@@ -1,4 +1,4 @@
-ZeroClipboard.version = "{{version}}";
+ZeroClipboard.version = "<%= version %>";
// ZeroClipboard options defaults
var _defaults = {
moviePath: "ZeroClipboard.swf", // URL to movie
Oops, something went wrong.

0 comments on commit 067f56b

Please sign in to comment.