From 9a71d179ea80dce7a4b2c0a3638c163e8d075cf7 Mon Sep 17 00:00:00 2001 From: Jarrod Overson Date: Thu, 1 Nov 2012 22:03:09 -0700 Subject: [PATCH] initial commit --- .editorconfig | 9 +++++ .gitattributes | 1 + .gitignore | 4 ++ .jshintrc | 14 +++++++ .npmignore | 8 ++++ .travis.yml | 3 ++ AUTHORS | 2 + CHANGELOG | 4 ++ CONTRIBUTING.md | 73 ++++++++++++++++++++++++++++++++++++ Gruntfile.js | 35 +++++++++++++++++ LICENSE-MIT | 22 +++++++++++ README.md | 81 ++++++++++++++++++++++++++++++++++++++++ docs/jasmine-examples.md | 3 ++ docs/jasmine-options.md | 34 +++++++++++++++++ docs/jasmine-overview.md | 2 + package.json | 46 +++++++++++++++++++++++ tasks/jasmine.js | 28 ++++++++++++++ test/jasmine_test.js | 10 +++++ 18 files changed, 379 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 .npmignore create mode 100644 .travis.yml create mode 100644 AUTHORS create mode 100644 CHANGELOG create mode 100644 CONTRIBUTING.md create mode 100644 Gruntfile.js create mode 100644 LICENSE-MIT create mode 100644 README.md create mode 100644 docs/jasmine-examples.md create mode 100644 docs/jasmine-options.md create mode 100644 docs/jasmine-overview.md create mode 100644 package.json create mode 100644 tasks/jasmine.js create mode 100644 test/jasmine_test.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b722c2e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# editorconfig.org +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a1b41a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +npm-debug.log +tmp +.idea diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6b4c1a9 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,14 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "sub": true, + "undef": true, + "boss": true, + "eqnull": true, + "node": true, + "es5": true +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..e095bb9 --- /dev/null +++ b/.npmignore @@ -0,0 +1,8 @@ +.npmignore +.editorconfig +.jshintrc +.jshintignore +.gitattributes +test +docs +Gruntfile.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..baa0031 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - 0.8 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..544240d --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Jarrod Overson (http://jarrodoverson.com) +"Cowboy" Ben Alman (http://benalman.com) diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..47cc633 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,4 @@ +v0.1.0: + date: 2012-11-01 + changes: + - Work in progress, not yet officially released. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..43313a7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,73 @@ +[Grunt homepage](http://gruntjs.com/) | [Documentation table of contents](https://github.com/gruntjs/grunt/blob/devel/docs/toc.md) + +# Contributing to grunt + +There are a number of grunt projects. + +* [grunt](https://github.com/gruntjs/grunt) - the main grunt project +* [gruntjs.com](https://github.com/gruntjs/gruntjs.com) - the gruntjs.com website +* [grunt-contrib collection](https://github.com/gruntjs/grunt-contrib) - a collection of all grunt "contrib" plugins + +In addition, each individual grunt-contrib plugin is a separate repository listed on the [gruntjs org homepage](https://github.com/gruntjs). + +## Filing issues +If something isn't working like you think it should, please read the documentation first. If you'd like to chat with someone, [pop into IRC](#discussing-grunt) and ask your question there. + +The best way to ensure an issue gets addressed is to file it in the appropriate issues tracker. + +**If there's an issue with a specific grunt-contrib plugin:** +Please file an issue on that plugin's issues tracker. + +**If you'd like to contribute a new plugin:** +Please file an issue on the [grunt-contrib collection issues tracker](https://github.com/gruntjs/grunt-contrib/issues). We don't accept all plugins, but we'll certainly consider yours. + +**If there's an issue with the [website](http://gruntjs.com/):** +Please file an issue on the [gruntjs.com website issues tracker](https://github.com/gruntjs/gruntjs.com/issues). + +**If there's an issue that isn't specific to any of the above:** +Please file an issue on the [grunt issues tracker](https://github.com/gruntjs/grunt/issues). + +### Simplify the issue +Try to [reduce your code](http://www.webkit.org/quality/reduction.html) to the bare minimum required to reproduce the issue. This makes it much easier (and much faster) to isolate and fix the issue. + +### Explain the issue +If we can't reproduce the issue, we can't fix it. Please list the exact steps required to reproduce the issue. Include versions of your OS, Node.js, grunt, etc. Include relevant logs or sample code. + +## Discussing grunt +Join the [freenode](http://freenode.net/) IRC #grunt channel. We've got a bot and everything. + +_No private messages, please._ + +## Modifying grunt +First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed. + +1. Fork and clone the repo. +1. Check out the correct branch. Currently, grunt development happens in the `devel` branch. +1. Run `npm install` to install all grunt dependencies. +1. Run `npm link` to put the dev version of grunt in the system path (this is only needed for developing grunt, not for plugins or the website). +1. Run `grunt` to grunt grunt. + +Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing breaks. + +### Submitting pull requests + +1. Create a new branch, please don't work in your `master` or `devel` branch directly. +1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail. +1. Fix stuff. +1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done. +1. Update the documentation to reflect any changes. +1. Push to your fork and submit a pull request. + +### Syntax + +* Two space indents. Don't use tabs anywhere. Use `\t` if you need a tab character in a string. +* No trailing whitespace, except in markdown files where a linebreak must be forced. +* Don't go overboard with the whitespace. +* No more than [one assignment](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) per `var` statement. +* Delimit strings with single-quotes `'`, not double-quotes `"`. +* Prefer `if` and `else` to ["clever"](http://programmers.stackexchange.com/a/25281) uses of `? :` conditional or `||`, `&&` logical operators. +* Comments are great. Just put them _before_ the line of code, _not_ at the _end_ of the line. +* **When in doubt, follow the conventions you see used in the source already.** + +### Reverting back to the "official" grunt +If you've used `npm link` to put a dev version of grunt in the system path and, for some reason, need to revert back to the current official grunt release, just reinstall grunt globally with `npm install -g grunt` diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..fbf1e07 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,35 @@ +/* + * grunt-contrib-jasmine + * http://gruntjs.com/ + * + * Copyright (c) 2012 GruntJS Team + * Licensed under the MIT license. + */ + +'use strict'; + +module.exports = function(grunt) { + grunt.initConfig({ + jshint: { + all: [ + 'Gruntfile.js', + 'tasks/*.js' + ], + options: { + jshintrc: '.jshintrc' + } + }, + nodeunit: { + tasks: ['test/*_test.js'] + } + }); + + grunt.loadTasks('tasks'); + + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-nodeunit'); + grunt.loadNpmTasks('grunt-contrib-internal'); + + grunt.registerTask('test', ['jasmine', 'nodeunit']); + grunt.registerTask('default', ['test', 'build-contrib']); +}; diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..7f9d346 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2012 "Cowboy" Ben Alman, 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..88b7d68 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# grunt-contrib-jasmine [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-jasmine.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-jasmine) + +> Run jasmine specs headlessly through PhantomJS. + +_Note that this plugin has not yet been released, and only works with the latest bleeding-edge, in-development version of grunt. See the [When will I be able to use in-development feature 'X'?](https://github.com/gruntjs/grunt/blob/devel/docs/faq.md#when-will-i-be-able-to-use-in-development-feature-x) FAQ entry for more information._ + +## Getting Started +_If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide._ + +From the same directory as your project's [Gruntfile][Getting Started] and [package.json][], install this plugin with the following command: + +```bash +npm install grunt-contrib-jasmine --save-dev +``` + +Once that's done, add this line to your project's Gruntfile: + +```js +grunt.loadNpmTasks('grunt-contrib-jasmine'); +``` + +If the plugin has been installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a `devDependency`, which ensures that it will be installed whenever the `npm install` command is run. + +[grunt]: http://gruntjs.com/ +[Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md +[package.json]: https://npmjs.org/doc/json.html + + +## The jasmine task + +#### Overview + + +### Options + +#### option1 +Type: `Integer` +Default: `8080` + +descr + +#### option2 +Type: `String` +Default: `foo` + +descr + +#### option3 +Type: `String` +Default: `.` + +descr + +#### option4 +Type: `Boolean` +Default: `false` + +descr + +#### options5 +Type: `Function` +Default: + +```js +function() { +} +``` + +### Usage examples + +#### Basic Use + + +## Release History + + * 2012-10-31 - v0.1.0 - Work in progress, not yet officially released. + +-- +Task submitted by Jarrod Overson. + +*Generated on Thu Nov 01 2012 22:01:17.* diff --git a/docs/jasmine-examples.md b/docs/jasmine-examples.md new file mode 100644 index 0000000..c82985e --- /dev/null +++ b/docs/jasmine-examples.md @@ -0,0 +1,3 @@ +# Usage examples + +## Basic Use diff --git a/docs/jasmine-options.md b/docs/jasmine-options.md new file mode 100644 index 0000000..7ef5529 --- /dev/null +++ b/docs/jasmine-options.md @@ -0,0 +1,34 @@ +# Options + +## option1 +Type: `Integer` +Default: `8080` + +descr + +## option2 +Type: `String` +Default: `foo` + +descr + +## option3 +Type: `String` +Default: `.` + +descr + +## option4 +Type: `Boolean` +Default: `false` + +descr + +## options5 +Type: `Function` +Default: + +```js +function() { +} +``` diff --git a/docs/jasmine-overview.md b/docs/jasmine-overview.md new file mode 100644 index 0000000..0366ab1 --- /dev/null +++ b/docs/jasmine-overview.md @@ -0,0 +1,2 @@ +## Overview + diff --git a/package.json b/package.json new file mode 100644 index 0000000..8f97124 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "grunt-contrib-jasmine", + "description": "Run jasmine specs headlessly through PhantomJS.", + "version": "0.1.0", + "homepage": "https://github.com/gruntjs/grunt-contrib-jasmine", + "author": { + "name": "Grunt Team", + "url": "http://gruntjs.com/" + }, + "repository": { + "type": "git", + "url": "git://github.com/gruntjs/grunt-contrib-jasmine.git" + }, + "bugs": { + "url": "https://github.com/gruntjs/grunt-contrib-jasmine/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/gruntjs/grunt-contrib-jasmine/blob/master/LICENSE-MIT" + } + ], + "main": "Gruntfile.js", + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "grunt test" + }, + "dependencies": { + }, + "devDependencies": { + "grunt": "~0.4.0a", + "grunt-contrib-internal": "~0.1.0", + "grunt-contrib-jshint": "~0.1.0", + "grunt-contrib-nodeunit": "~0.1.0" + }, + "keywords": [ + "gruntplugin", + "jasmine", + "unit", + "phantomjs", + "headless", + "tests" + ] +} diff --git a/tasks/jasmine.js b/tasks/jasmine.js new file mode 100644 index 0000000..7506214 --- /dev/null +++ b/tasks/jasmine.js @@ -0,0 +1,28 @@ +/* + * grunt-contrib-jasmine + * http://gruntjs.com/ + * + * Licensed under the MIT license. + */ + +'use strict'; + +module.exports = function(grunt) { + + var path = require('path'); + + grunt.registerTask('jasmine', 'Run jasmine specs headlessly through PhantomJS.', function() { + + // Merge task-specific options with these defaults. + var options = grunt.util._.defaults(grunt.config('jasmine'), { + }); + + if (grunt.option('debug')) { + } + + // Start server. + grunt.log.writeln(''); + + }); + +}; diff --git a/test/jasmine_test.js b/test/jasmine_test.js new file mode 100644 index 0000000..547fa37 --- /dev/null +++ b/test/jasmine_test.js @@ -0,0 +1,10 @@ +'use strict'; + +var grunt = require('grunt'); + +exports.jasmine = { + request: function(test) { + test.expect(2); + + } +};