Permalink
Browse files

zomg i made a thing

  • Loading branch information...
danheberden committed May 11, 2013
0 parents commit dde9763ae58f87e25233d66a93d3923c06081a9b
@@ -0,0 +1,10 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
@@ -0,0 +1 @@
+* text=auto
@@ -0,0 +1,2 @@
+node_modules/
+temp/
@@ -0,0 +1,22 @@
+{
+ "node": true,
+ "es5": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 2,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "smarttabs": true,
+ "white": true
+}
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.8
+ - 0.10
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Dan Heberden
+
+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.
@@ -0,0 +1,13 @@
+# Yeoman RequireJS Generator
+[![Build Status](https://secure.travis-ci.org/danheberden/yeoman-generator-require.png?branch=master)](https://travis-ci.org/danheberden/yeoman-generator-require)
+
+A generator for Yeoman.
+
+## Getting started
+- Make sure you have [yo](https://github.com/yeoman/yo) installed:
+ `npm install -g yo`
+- Install the generator **locally**: `npm install yeoman-generator-require`
+- Run: `yo yeoman-generator-require`
+
+## License
+[MIT License](http://en.wikipedia.org/wiki/MIT_License)
@@ -0,0 +1,91 @@
+'use strict';
+var util = require('util');
+var path = require('path');
+var yeoman = require('yeoman-generator');
+
+
+var AppGenerator = module.exports = function AppGenerator(args, options, config) {
+ yeoman.generators.Base.apply(this, arguments);
+
+ this.on('end', function () {
+ this.installDependencies({ skipInstall: options['skip-install'] });
+ });
+
+ this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
+};
+
+util.inherits(AppGenerator, yeoman.generators.NamedBase);
+
+AppGenerator.prototype.askFor = function askFor() {
+ var cb = this.async();
+
+ // welcome message
+ var welcome =
+ '\n _-----_' +
+ '\n | |' +
+ '\n |' + '--(o)--'.red + '| .--------------------------.' +
+ '\n `---------´ | ' + 'Welcome to Yeoman,'.yellow.bold + ' |' +
+ '\n ' + '( '.yellow + '_' + '´U`'.yellow + '_' + ' )'.yellow + ' | ' + 'ladies and gentlemen!'.yellow.bold + ' |' +
+ '\n /___A___\\ \'__________________________\'' +
+ '\n | ~ |'.yellow +
+ '\n __' + '\'.___.\''.yellow + '__' +
+ '\n ´ ' + '` |'.red + '° ' + '´ Y'.red + ' `\n';
+
+ console.log(welcome);
+ console.log('This comes with requirejs, jquery, and grunt all ready to go');
+
+ var prompts = [{
+ name: 'appname',
+ message: 'What is the name of your app?',
+ default: this.appname
+ }, {
+ name: 'appdescription',
+ message: 'Description:',
+ default: 'An awesome requirejs app'
+ }];
+
+ this.prompt(prompts, function (err, props) {
+ if (err) {
+ return this.emit('error', err);
+ }
+
+ this.appname = props.appname;
+ this.appdescription = props.appdescription;
+
+
+ cb();
+ }.bind(this));
+};
+
+AppGenerator.prototype.gruntfile = function gruntfile() {
+ this.template('Gruntfile.js');
+};
+
+AppGenerator.prototype.packageJSON = function packageJSON() {
+ this.template('_package.json', 'package.json');
+};
+
+AppGenerator.prototype.bower = function bower() {
+ this.template('_bower.json', 'bower.json');
+};
+
+AppGenerator.prototype.git = function git() {
+ this.copy('.gitignore', '.gitignore');
+};
+
+AppGenerator.prototype.configs = function jshint() {
+ this.copy('jshintrc', '.jshintrc');
+ this.copy('editorconfig', '.editorconfig');
+}
+
+AppGenerator.prototype.docs = function docs() {
+ this.copy('CONTRIBUTING.md', 'CONTRIBUTING.md');
+ this.template('README.md', 'README.md');
+};
+
+AppGenerator.prototype.app = function app() {
+ this.directory('app', 'app');
+ this.directory('test', 'test');
+ // this.directory('libs', 'libs');
+ this.template('index.htm', 'index.htm');
+};
@@ -0,0 +1,2 @@
+node_modules/
+temp/
@@ -0,0 +1,31 @@
+# Contributing
+
+## Important notes
+Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory!
+
+### Code style
+Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**
+
+### PhantomJS
+While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.
+
+## Modifying the code
+First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.
+
+Test that Grunt's CLI is installed by running `grunt --version`. If the command isn't found, run `npm install -g grunt-cli`. For more information about installing Grunt, see the [getting started guide](http://gruntjs.com/getting-started).
+
+1. Fork and clone the repo.
+1. Run `npm install` to install all dependencies (including Grunt).
+1. Run `grunt` to grunt this project.
+
+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 is broken.
+
+## Submitting pull requests
+
+1. Create a new branch, please don't work in your `master` 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. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
+1. Update the documentation to reflect any changes.
+1. Push to your fork and submit a pull request.
@@ -0,0 +1,127 @@
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ // Metadata.
+ pkg: grunt.file.readJSON('package.json'),
+ banner: '/*! <%%= pkg.name %> - v<%%= pkg.version %> - ' +
+ '<%%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
+ '* Copyright (c) <%%= grunt.template.today("yyyy") %> <%%= pkg.author.name %>;' +
+ ' Licensed <%%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+ // Task configuration.
+ clean: {
+ files: ['dist']
+ },
+ concat: {
+ options: {
+ banner: '<%%= banner %>',
+ stripBanners: true
+ },
+ dist: {
+ src: ['components/requirejs/require.js', '<%%= concat.dist.dest %>'],
+ dest: 'dist/require.js'
+ },
+ },
+ uglify: {
+ options: {
+ banner: '<%%= banner %>'
+ },
+ dist: {
+ src: '<%%= concat.dist.dest %>',
+ dest: 'dist/require.min.js'
+ },
+ },
+ qunit: {
+ files: ['test/**/*.html']
+ },
+ jshint: {
+ gruntfile: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ src: 'Gruntfile.js'
+ },
+ app: {
+ options: {
+ jshintrc: 'app/.jshintrc'
+ },
+ src: ['app/**/*.js']
+ },
+ test: {
+ options: {
+ jshintrc: 'test/.jshintrc'
+ },
+ src: ['test/**/*.js']
+ },
+ },
+ watch: {
+ gruntfile: {
+ files: '<%%= jshint.gruntfile.src %>',
+ tasks: ['jshint:gruntfile']
+ },
+ src: {
+ files: '<%%= jshint.src.src %>',
+ tasks: ['jshint:src', 'qunit']
+ },
+ test: {
+ files: '<%%= jshint.test.src %>',
+ tasks: ['jshint:test', 'qunit']
+ },
+ },
+ requirejs: {
+ compile: {
+ options: {
+ name: 'config',
+ mainConfigFile: 'app/config.js',
+ out: '<%%= concat.dist.dest %>',
+ optimize: 'none'
+ }
+ }
+ },
+ connect: {
+ development: {
+ options: {
+ keepalive: true,
+ }
+ },
+ production: {
+ options: {
+ keepalive: true,
+ port: 8000,
+ middleware: function(connect, options) {
+ return [
+ // rewrite requirejs to the compiled version
+ function(req, res, next) {
+ if (req.url === '/components/requirejs/require.js') {
+ req.url = '/dist/require.min.js';
+ }
+ next();
+ },
+ connect.static(options.base),
+
+ ];
+ }
+ }
+ }
+ }
+ });
+
+ // These plugins provide necessary tasks.
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-concat');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-requirejs');
+ grunt.loadNpmTasks('grunt-contrib-connect');
+
+ // Default task.
+ grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'requirejs', 'concat', 'uglify']);
+ grunt.registerTask('preview', ['connect:development']);
+ grunt.registerTask('preview-live', ['default', 'connect:production']);
+
+};
Oops, something went wrong.

0 comments on commit dde9763

Please sign in to comment.