Skip to content

Commit

Permalink
chore(repo): initiallized repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Caitlin Potter committed Oct 28, 2013
0 parents commit 822a8fc
Show file tree
Hide file tree
Showing 22 changed files with 1,410 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
/build
/bower_components
/node_modules
Empty file added CHANGELOG.md
Empty file.
231 changes: 231 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,231 @@
var files = require('./angularDrop').files;
var util = require('./lib/grunt/utils');
var path = require('path');

module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-ddescribe-iit');
grunt.loadNpmTasks('grunt-merge-conflict');
grunt.loadNpmTasks('grunt-parallel');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadTasks('lib/grunt');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-ngdocs-caitp');
grunt.loadNpmTasks('grunt-gh-pages');

var DROP_VERSION = util.getVersion();
var dist = 'angular-drop-' + DROP_VERSION.full;


// global beforeEach
util.init();


grunt.initConfig({
DROP_VERSION: DROP_VERSION,

parallel: {
travis: {
tasks: [
util.parallelTask(['test:unit'], {stream: true}),
]
}
},

connect: {
devserver: {
options: {
port: 8000,
hostname: '0.0.0.0',
base: '.',
keepalive: true,
middleware: function(connect, options) {
return [
util.rewrite(),
connect.static(options.base),
connect.directory(options.base)
];
}
}
},
testserver: {
options: {
port: 8000,
hostname: '0.0.0.0',
middleware: function(connect, options) {
return [
function(req, res, next) {
// cache GET requests to speed up tests on travis
if (req.method === 'GET') {
res.setHeader('Cache-control', 'public, max-age=3600');
}

nest();
},

connect.static(options.base)
];
}
}
}
},

tests: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js'
},

autotest: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js'
},

clean: {
build: ['build'],
tmp: ['tmp']
},

jshint: {
drop: {
files: { src: files['angularDropSrc'] },
options: { jshintrc: 'src/.jshintrc' }
}
},

build: {
drop: {
dest: 'build/angular-drop.js',
src: util.wrap([files['angularDropSrc']], 'drop'),
}
},

min: {
drop: 'build/angular-drop.js'
},

/**
* TODO: Provide documentation!
* docs: {
* process: ['build/docs/*.html', 'build/docs/.htaccess']
* }
*/

"ddescribe-iit": {
files: [
'test/**/*.js',
]
},

"merge-conflict": {
files: [
'src/**/*',
'test/**/*',
'docs/**/*',
'css/**/*'
]
},

compress: {
build: {
options: {archive: 'build/' + dist + '.zip', mode: 'zip'},
src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
}
},

write: {
versionTXT: { file: 'build/version.txt', val: DROP_VERSION.full },
versionJSON: { file: 'build/version.json', val: JSON.stringify(DROP_VERSION) }
}
});

// alias tasks
grunt.registerTask('test', 'Run unit tests with Karma', ['package', 'test:unit']);
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma (jqLite only)', ['tests:jqlite']);
grunt.registerTask('test:jquery', 'Run the unit tests with Karma (jQuery only)', ['tests:jquery']);
grunt.registerTask('test:unit', 'Run jqLite and jQuery unit tests with Karma', ['tests:jqlite', 'tests:jquery']);

grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
grunt.registerTask('webserver', ['connect:devserver']);
grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'write', 'compress']);
grunt.registerTask('package-without-bower', ['clean', 'buildall', 'minall', 'collect-errors', 'write', 'compress']);
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint']);
grunt.registerTask('default', ['package']);

grunt.registerTask('enforce', 'Install commit message enforce script if it doesn\'t exist',
function() {
if (!grunt.file.exists('.git/hooks/commit-msg')) {
grunt.file.copy('misc/validate-commit-msg.js', '.git/hooks/commit-msg');
require('fs').chmodSync('.git/hooks/commit-msg', '0755');
}
});

// Test
grunt.registerTask('test', 'Run tests on singleRun karma server', function() {
// This task can be executed in 3 different environments: local, Travis-CI,
// and Jenkins-CI. We need to take settings for each one into account
if (process.env.TRAVIS) {
grunt.task.run('karma:travis');
} else {
grunt.task.run(this.args.length ? 'karma:jenkins' : 'karma:continuous');
}
});

// Shell commands
grunt.registerMultiTask('shell', 'Run shell commands', function() {
var self = this, sh = require('shelljs');
self.data.forEach(function(cmd) {
cmd = cmd.replace('%version%', grunt.file.readJSON('package.json').version);
cmd = cmd.replace('%PATCHTYPE%', grunt.option('patch') && 'patch' ||
grunt.option('major') &&
'major' || 'minor');
grunt.log.ok(cmd);
var result = sh.exec(cmd, {silent: true });
if (result.code !== 0) {
grunt.fatal(result.output);
}
});
});

// Version management
function setVersion(type, suffix) {
var file = 'package.json',
VERSION_REGEX = /([\'|\"]version[\'|\"][ ]*:[ ]*[\'|\"])([\d|.]*)(-\w+)*([\'|\"])/,
contents = grunt.file.read(file),
version;
contents = contents.replace(VERSION_REGEX, function(match, left, center) {
version = center;
if (type) {
version = require('semver').inc(version, type);
}
// semver.inc strips suffix, if it existed
if (suffix) {
version += '-' + suffix;
}
return left + version + '"';
});
grunt.log.ok('Version set to ' + version.cyan);
grunt.file.write(file, contents);
return version;
}

grunt.registerTask('version', 'Set version. If no arguments, it just takes off suffix',
function() {
setVersion(this.args[0], this.args[1]);
});

grunt.registerTask('docgen', function() {
var self = this;
if (typeof self.args[0] === 'string') {
grunt.config('pkg.version', self.args[0]);
}
grunt.task.mark().run('gh-pages');
});

return grunt;
};
51 changes: 51 additions & 0 deletions README.md
@@ -0,0 +1,51 @@
##AngularDrop

###Drag & Drop functionality in AngularJS, no jQuery required

AngularDrop provides simple building blocks for Drag & Drop functionality in AngularJS.

Drag & Drop is a fairly complex user interaction, even though it might seem trivial initially. It is further complicated in AngularJS by the concept of scopes, which can have a major impact on the content of a drag/dropped node.

I do not claim to have the answers to any or all of the questions raised by implementing drag & drop functionality in a complex application, but I am interested in finding out so that we can deliver the best experience possible to users of our apps.

With the best intentions, it is hoped that we will be able to deliver:

- Full support for mobile applications
- Cleverly handling scope-changing
- Scope events fired when elements are dragged and dropped
- Support for dragging and dropping between nested browsing contexts
- Support for dragging and dropping between different windows

This library is not simply a pair of directives, but is in fact also building blocks for creating custom directives with specialized Drag & Drop behaviour.

###Contributing

I'd be grateful for any form of contribution, whether it be the creation of demo pages, bug reports, documentation, feature requests, or above all else, patches.

Patches should follow the [Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml), and each and every new feature or bug fix should incorporate one or more meaningful tests to assist in preventing future regressions.

While you may, if you so wish, discuss this module anywhere you like, I will be most likely to respond to inquiries directed to me on IRC (particularly in #angularjs on irc.freenode.net), or on the [issue tracker](https://github.com/caitp/angular-drop/issues).

###License

The MIT License (MIT)

Copyright (c) 2013 Caitlin Potter & Contributors

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.
59 changes: 59 additions & 0 deletions angularDrop.js
@@ -0,0 +1,59 @@
angularDropFiles = {
'angularDropSrc': [
'src/utils.js',
'src/draggable.js',
'src/droppable.js',
'src/provider.js',
'src/public.js'
],

'angularDropTest': [
'test/helpers/*.js',
'test/*.js',
],

'karma': [
'bower_components/jquery/jquery.js',
'test/jquery_remove.js',
'@angularDropSrc',
'src/publish.js',
'@angularDropTest',
],

'karmaExclude': [
'test/jquery_alias.js',
],

'karmaJquery': [
'bower_components/jquery/jquery.js',
'test/jquery_alias.js',
'@angularDropSrc',
'src/publish.js',
'@angularDropTest',
],

'karmaJqueryExclude': [
'test/jquery_remove.js'
]
};

if (exports) {
exports.files = angularDropFiles;
exports.mergeFilesFor = function() {
var files = [];

Array.prototype.slice.call(arguments, 0).forEach(function(filegroup) {
angularDropFiles[filegroup].forEach(function(file) {
// replace @ref
var match = file.match(/^\@(.*)/);
if (match) {
files = files.concat(angularDropFiles[match[1]]);
} else {
files.push(file);
}
});
});

return files;
};
}
22 changes: 22 additions & 0 deletions bower.json
@@ -0,0 +1,22 @@
{
"name": "angular-drop",
"authors": [
"Caitlin Potter <snowball@defpixel.com>"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~2.0.3",
"google-code-prettify": "1.0.0",
"closure-compiler": "https://closure-compiler.googlecode.com/files/compiler-20130603.zip",
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.2/assets/ng-closure-runner.zip",
"angular": "1.2.0-rc.3",
"angular-mocks": "1.2.0-rc.3"
}
}
21 changes: 21 additions & 0 deletions docs/css/style.css
@@ -0,0 +1,21 @@
.bs-docs-social {
margin-top: 1em;
padding: 15px 0;
text-align: center;
background-color: rgba(245,245,245,0.3);
border-top: 1px solid rgba(255,255,255,0.3);
border-bottom: 1px solid rgba(221,221,221,0.3);
}
.bs-docs-social-buttons {
position: absolute;
top: 8px;
margin-left: 0;
margin-bottom: 0;
padding-left: 0;
list-style: none;
}
.bs-docs-social-buttons li {
list-style: none;
display: inline-block;
line-height: 1;
}

0 comments on commit 822a8fc

Please sign in to comment.