Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Replacing make with grunt for builds.
Browse files Browse the repository at this point in the history
Make does not work on Windows, Grunt works cross-platform.
Fixes #71.
Closes #71.
  • Loading branch information
JamesMGreene committed Aug 24, 2013
1 parent 6560660 commit 067f56b
Show file tree
Hide file tree
Showing 22 changed files with 271 additions and 178 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
@@ -1,3 +1,5 @@
language: node_js language: node_js
node_js: node_js:
- 0.8 - "0.10"
before_script:
- npm install -g grunt-cli
17 changes: 13 additions & 4 deletions CONTRIBUTING.md
@@ -1,16 +1,25 @@
Contributing 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. 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 ### Cloning


$ git clone https://github.com/zeroclipboard/ZeroClipboard.git $ git clone https://github.com/zeroclipboard/ZeroClipboard.git
$ cd ZeroClipboard/ $ cd ZeroClipboard/
$ make $ npm install -g grunt-cli
$ npm install
$ grunt


### Tests


$ make test ### Developing

$ npm install
$ grunt


### Testing

$ grunt test
128 changes: 128 additions & 0 deletions Gruntfile.js
@@ -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']);

};
3 changes: 1 addition & 2 deletions LICENSE
@@ -1,9 +1,8 @@
The MIT License (MIT) 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: 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 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. 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.

62 changes: 0 additions & 62 deletions Makefile

This file was deleted.

23 changes: 15 additions & 8 deletions ZeroClipboard.js
@@ -1,11 +1,12 @@
/*! /*!
* zeroclipboard * ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface. * 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, . * Copyright (c) 2013 Jon Rohan, James M. Greene
* Released under the MIT license * Licensed MIT
* http://zeroclipboard.github.io/ZeroClipboard/ * http://zeroclipboard.github.io/ZeroClipboard/
* v1.2.0-beta.4 * v1.2.0-beta.4 (2013-08-23)
*/(function() { */
(function() {
"use strict"; "use strict";
var _camelizeCssPropName = function() { var _camelizeCssPropName = function() {
var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) { var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
Expand Down Expand Up @@ -158,7 +159,7 @@
var _noCache = function(path) { var _noCache = function(path) {
var client = ZeroClipboard.prototype._singleton; var client = ZeroClipboard.prototype._singleton;
if (client.options.useNoCache) { if (client.options.useNoCache) {
return (path.indexOf("?") >= 0 ? "&nocache=" : "?nocache=") + (new Date).getTime(); return (path.indexOf("?") >= 0 ? "&nocache=" : "?nocache=") + new Date().getTime();
} else { } else {
return ""; return "";
} }
Expand Down Expand Up @@ -373,19 +374,24 @@
} }
this.htmlBridge.setAttribute("data-clipboard-ready", true); this.htmlBridge.setAttribute("data-clipboard-ready", true);
break; break;

case "mouseover": case "mouseover":
_addClass(element, this.options.hoverClass); _addClass(element, this.options.hoverClass);
break; break;

case "mouseout": case "mouseout":
_removeClass(element, this.options.hoverClass); _removeClass(element, this.options.hoverClass);
this.resetBridge(); this.resetBridge();
break; break;

case "mousedown": case "mousedown":
_addClass(element, this.options.activeClass); _addClass(element, this.options.activeClass);
break; break;

case "mouseup": case "mouseup":
_removeClass(element, this.options.activeClass); _removeClass(element, this.options.activeClass);
break; break;

case "datarequested": case "datarequested":
var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId); var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
if (targetEl) { if (targetEl) {
Expand All @@ -397,6 +403,7 @@
} }
performCallbackAsync = false; performCallbackAsync = false;
break; break;

case "complete": case "complete":
this.options.text = null; this.options.text = null;
break; break;
Expand Down
15 changes: 8 additions & 7 deletions ZeroClipboard.min.js

Large diffs are not rendered by default.

Binary file modified ZeroClipboard.swf
Binary file not shown.
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,4 +2,4 @@
"name": "zeroclipboard", "name": "zeroclipboard",
"version": "1.2.0-beta.4", "version": "1.2.0-beta.4",
"main": ["./ZeroClipboard.js", "./ZeroClipboard.swf"] "main": ["./ZeroClipboard.js", "./ZeroClipboard.swf"]
} }
32 changes: 22 additions & 10 deletions package.json
@@ -1,16 +1,21 @@
{ {
"name": "zeroclipboard", "name": "zeroclipboard",
"title": "ZeroClipboard",
"version": "1.2.0-beta.4", "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": [ "keywords": [
"flash", "flash",
"clipboard", "clipboard",
"copy", "copy",
"paste" "paste"
], ],
"homepage": "http://zeroclipboard.github.io/ZeroClipboard/", "homepage": "http://zeroclipboard.github.io/ZeroClipboard/",
"license": "MIT", "licenses": [
{
"type": "MIT",
"url": "https://github.com/zeroclipboard/ZeroClipboard/blob/master/LICENSE"
}
],
"contributors": [ "contributors": [
{ {
"name": "Jon Rohan", "name": "Jon Rohan",
Expand All @@ -30,19 +35,26 @@
"send": "0" "send": "0"
}, },
"devDependencies": { "devDependencies": {
"uglify-js": "1.2.3", "nodeunit": "~0.8.1",
"nodeunit": "0.7.4", "jsdom": "~0.8.3",
"jshint": "0.9.1", "jquery": "1.8.3",
"handlebars": "1.0.7", "grunt": "~0.4.1",
"jsdom": "0.3.4", "grunt-contrib-clean": "~0.5.0",
"jquery": "1.8.3" "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": { "component": {
"scripts": { "scripts": {
"zeroclipboard": "ZeroClipboard.js" "zeroclipboard": "ZeroClipboard.js"
} }
}, },
"scripts": { "scripts": {
"test": "make test" "test": "grunt travis --verbose"
} }
} }
13 changes: 0 additions & 13 deletions src/build.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/javascript/ZeroClipboard/core.js
@@ -1,4 +1,4 @@
ZeroClipboard.version = "{{version}}"; ZeroClipboard.version = "<%= version %>";
// ZeroClipboard options defaults // ZeroClipboard options defaults
var _defaults = { var _defaults = {
moviePath: "ZeroClipboard.swf", // URL to movie moviePath: "ZeroClipboard.swf", // URL to movie
Expand Down

0 comments on commit 067f56b

Please sign in to comment.