diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 00000000..1f984984 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,5 @@ +{ + "directory": "vendor", + "json": "bower.json" +} + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..dcf48bb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.sw* +*~ +build/ +bin/ +node_modules/ +vendor/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e69de29b diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..9c33c2f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - "0.10" + +before_script: + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - npm install --quiet -g grunt-cli karma bower + - bower install + +script: grunt + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..2f93d86e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,125 @@ +# 0.3.1 (2013-09-13) + +## Features + +* Page titles are now set via state objects ([33de8097](git@github.com:joshdmiller/ng-boilerplate/commit/33de8097)) +* Append pkg.version to JS and CSS ([90e1b71f](git@github.com:joshdmiller/ng-boilerplate/commit/90e1b71f)) +* Vendor CSS is copied and concatenated with the app's CSS ([dda8792c](git@github.com:joshdmiller/ng-boilerplate/commit/dda8792c)) +* Vendor assets are copied to the build too ([29502bff](git@github.com:joshdmiller/ng-boilerplate/commit/29502bff)) +* Treat JS in src/assets as assets (i.e. don't do anything with it) ([99b50751](git@github.com:joshdmiller/ng-boilerplate/commit/99b50751)) +* Added PhantomJS support ([89acf5f6](git@github.com:joshdmiller/ng-boilerplate/commit/89acf5f6)) +* Files for use only in testing are now configurable ([a04e663b](git@github.com:joshdmiller/ng-boilerplate/commit/a04e663b)) + +## Bug fixes + +* CopyPasteException in index.html comments ([3a0596a7](git@github.com:joshdmiller/ng-boilerplate/commit/3a0596a7)) +* Fixed typos in the README ([5ae95393](git@github.com:joshdmiller/ng-boilerplate/commit/5ae95393)), ([8c362208](git@github.com:joshdmiller/ng-boilerplate/commit/8c362208)), and ([6b617282](git@github.com:joshdmiller/ng-boilerplate/commit/6b617282)) +* Vendor files were added to build twice ([09277b74](git@github.com:joshdmiller/ng-boilerplate/commit/09277b74)) +* IE7 Font Awesome stylesheet pointed nowhere ([515673b1](git@github.com:joshdmiller/ng-boilerplate/commit/515673b1)) + +# 0.3.0 (2013-06-25) + +## Features +### build + +* split build into build+compile ([97fb290d](https://github.com/joshdmiller/ng-boilerplate/commits/97fb290d)) +* Moved config to separate file ([ff5d8b58](https://github.com/joshdmiller/ng-boilerplate/commits/ff5d8b58)) +* Added grunt-bump to ease releasing ([27312de1](https://github.com/joshdmiller/ng-boilerplate/commits/27312de1)) +* Added changelog generation ([328d25d2](https://github.com/joshdmiller/ng-boilerplate/commits/328d25d2)) +* karma config managed automatically ([3384b6fd](https://github.com/joshdmiller/ng-boilerplate/commits/3384b6fd)) +* CoffeeScript support ([0f308f2f](https://github.com/joshdmiller/ng-boilerplate/commits/0f308f2f)) + +### * + +* switched to ui-router for state mgmt ([7bec0378](https://github.com/joshdmiller/ng-boilerplate/commits/7bec0378)) + +## Bug fixes +### build + +* Karma no longer hangs the watch (([f66cfcc6])(https://github.com/joshdmiller/ng-boilerplate/commits/f66cfcc6)) + + + +# 0.2.0 (2013-05-10) + +## Features +### build + +* live reload added through grunt-watch ([653df741](https://github.com/joshdmiller/ng-boilerplate/commits/653df741)) + +* Add grunt ng-min for annotation ([9c529ccb](https://github.com/joshdmiller/ng-boilerplate/commits/9c529ccb)) + +### * + +* far better Bower integration ([864c2656](https://github.com/joshdmiller/ng-boilerplate/commits/864c2656)) + +* included AngularUI `utils` to use uiRoute ([df08e4be](https://github.com/joshdmiller/ng-boilerplate/commits/df08e4be)) + + + + + + +# 0.1.0 (2013-03-11) + +## Features +### * + +* Initial application structure ([7c149227](https://github.com/joshdmiller/ng-boilerplate/commits/7c149227)) + +* improved navigation styling and added home page tpl ([e1a655e0](https://github.com/joshdmiller/ng-boilerplate/commits/e1a655e0)) + +### app + +* added current route indication to menu with appropriate unit test ([14d35da8](https://github.com/joshdmiller/ng-boilerplate/commits/14d35da8)) + +### index + +* improved navbar style and added additional links ([a7c4504c](https://github.com/joshdmiller/ng-boilerplate/commits/a7c4504c)) + +### about + +* Added an about page with some descriptive content ([290704ab](https://github.com/joshdmiller/ng-boilerplate/commits/290704ab)) + +* Added placeholders demo to about page ([89a06e9f](https://github.com/joshdmiller/ng-boilerplate/commits/89a06e9f)) + +### titleService + +* dynamic title support) ([3db6ec2b](https://github.com/joshdmiller/ng-boilerplate/commits/3db6ec2b)) + +* suffix is now customizable ([9f8b4c73](https://github.com/joshdmiller/ng-boilerplate/commits/9f8b4c73)) + +### activeIfCurrentDirective + +* created directory to test for current route ([0ac1f4b4](https://github.com/joshdmiller/ng-boilerplate/commits/0ac1f4b4)) + +### home + +* replaced placeholder text with mrktg copy ([dcaf7237](https://github.com/joshdmiller/ng-boilerplate/commits/dcaf7237)) + +* added google +1 button ([98d3312b](https://github.com/joshdmiller/ng-boilerplate/commits/98d3312b)) + + + +## Bug fixes +### build + +* Removed unnecessary step from delta:unittest ([5ffbfd78](https://github.com/joshdmiller/ng-boilerplate/commits/5ffbfd78)) + +* delta tasks that concat must also uglify ([926983f8](https://github.com/joshdmiller/ng-boilerplate/commits/926983f8)) + +### test-config + +* Change browser-name case, add browser list ([682b1ea4](https://github.com/joshdmiller/ng-boilerplate/commits/682b1ea4)) + +### home + +* corrected typo in tweet button URL ([b9920eea](https://github.com/joshdmiller/ng-boilerplate/commits/b9920eea)) + +### testacular + +* fixed typo in browser docstring ([11a60fa7](https://github.com/joshdmiller/ng-boilerplate/commits/11a60fa7)) + + + + diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..51a73705 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,678 @@ +module.exports = function ( grunt ) { + + /** + * Load required Grunt tasks. These are installed based on the versions listed + * in `package.json` when you do `npm install` in this directory. + */ + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-coffee'); + grunt.loadNpmTasks('grunt-conventional-changelog'); + grunt.loadNpmTasks('grunt-bump'); + grunt.loadNpmTasks('grunt-coffeelint'); + grunt.loadNpmTasks('grunt-recess'); + grunt.loadNpmTasks('grunt-karma'); + grunt.loadNpmTasks('grunt-ngmin'); + grunt.loadNpmTasks('grunt-html2js'); + grunt.loadNpmTasks('grunt-gjslint'); + + /** + * Load in our build configuration file. + */ + var userConfig = require( './build.config.js' ); + + /** + * This is the configuration object Grunt uses to give each plugin its + * instructions. + */ + var taskConfig = { + /** + * We read in our `package.json` file so we can access the package name and + * version. It's already there, so we don't repeat ourselves here. + */ + pkg: grunt.file.readJSON("package.json"), + + /** + * The banner is the comment that is placed at the top of our compiled + * source files. It is first processed as a Grunt template, where the `<%=` + * pairs are evaluated based on this very configuration object. + */ + meta: { + banner: + '/**\n' + + ' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + + ' * <%= pkg.homepage %>\n' + + ' *\n' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + + ' * Licensed <%= pkg.licenses.type %> <<%= pkg.licenses.url %>>\n' + + ' */\n' + }, + + gjslint: { + options: { + flags: [ + '--disable 220', //ignore error code 220 from gjslint + '--max_line_length 120' + ], + reporter: { + name: 'console' + } + }, + all: { + src: '<%= app_files.js %>' + } + }, + + /** + * Creates a changelog on a new version. + */ + changelog: { + options: { + dest: 'CHANGELOG.md', + template: 'changelog.tpl' + } + }, + + /** + * Increments the version number, etc. + */ + bump: { + options: { + files: [ + "package.json", + "bower.json" + ], + commit: false, + commitMessage: 'chore(release): v%VERSION%', + commitFiles: [ + "package.json", + "client/bower.json" + ], + createTag: false, + tagName: 'v%VERSION%', + tagMessage: 'Version %VERSION%', + push: false, + pushTo: 'origin' + } + }, + + /** + * The directories to delete when `grunt clean` is executed. + */ + clean: [ + '<%= build_dir %>', + '<%= compile_dir %>' + ], + + /** + * The `copy` task just copies files from A to B. We use it here to copy + * our project assets (images, fonts, etc.) and javascripts into + * `build_dir`, and then to copy the assets to `compile_dir`. + */ + copy: { + build_app_assets: { + files: [ + { + src: [ '**' ], + dest: '<%= build_dir %>/assets/', + cwd: 'src/assets', + expand: true + } + ] + }, + build_vendor_assets: { + files: [ + { + src: [ '<%= vendor_files.assets %>' ], + dest: '<%= build_dir %>/assets/', + cwd: '.', + expand: true, + flatten: true + } + ] + }, + build_vendor_fonts: { + files: [ + { + src: [ '<%= vendor_files.fonts %>' ], + dest: '<%= build_dir %>/fonts/', + cwd: '.', + expand: true, + flatten: true + } + ] + }, + build_appjs: { + files: [ + { + src: [ '<%= app_files.js %>' ], + dest: '<%= build_dir %>/', + cwd: '.', + expand: true + } + ] + }, + build_vendorjs: { + files: [ + { + src: [ '<%= vendor_files.js %>' ], + dest: '<%= build_dir %>/', + cwd: '.', + expand: true + } + ] + }, + compile_assets: { + files: [ + { + src: [ '**' ], + dest: '<%= compile_dir %>/assets', + cwd: '<%= build_dir %>/assets', + expand: true + } + ] + }, + compile_fonts: { + files: [ + { + src: [ '**' ], + dest: '<%= compile_dir %>/fonts', + cwd: '<%= build_dir %>/fonts', + expand: true + } + ] + } + }, + + /** + * `grunt concat` concatenates multiple source files into a single file. + */ + concat: { + /** + * The `build_css` target concatenates compiled CSS and vendor CSS + * together. + */ + build_css: { + src: [ + '<%= vendor_files.css %>', + '<%= recess.build.dest %>' + ], + dest: '<%= recess.build.dest %>' + }, + /** + * The `compile_js` target is the concatenation of our application source + * code and all specified vendor source code into a single file. + */ + compile_js: { + options: { + banner: '<%= meta.banner %>' + }, + src: [ + '<%= vendor_files.js %>', + 'module.prefix', + '<%= build_dir %>/src/**/*.js', + '<%= html2js.app.dest %>', + '<%= html2js.common.dest %>', + 'module.suffix' + ], + dest: '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js' + } + }, + + /** + * `grunt coffee` compiles the CoffeeScript sources. To work well with the + * rest of the build, we have a separate compilation task for sources and + * specs so they can go to different places. For example, we need the + * sources to live with the rest of the copied JavaScript so we can include + * it in the final build, but we don't want to include our specs there. + */ + coffee: { + source: { + options: { + bare: true + }, + expand: true, + cwd: '.', + src: [ '<%= app_files.coffee %>' ], + dest: '<%= build_dir %>', + ext: '.js' + } + }, + + /** + * `ng-min` annotates the sources before minifying. That is, it allows us + * to code without the array syntax. + */ + ngmin: { + compile: { + files: [ + { + src: [ '<%= app_files.js %>' ], + cwd: '<%= build_dir %>', + dest: '<%= build_dir %>', + expand: true + } + ] + } + }, + + /** + * Minify the sources! + */ + uglify: { + compile: { + options: { + banner: '<%= meta.banner %>' + }, + files: { + '<%= concat.compile_js.dest %>': '<%= concat.compile_js.dest %>' + } + } + }, + + /** + * `recess` handles our LESS compilation and uglification automatically. + * Only our `main.less` file is included in compilation; all other files + * must be imported from this file. + */ + recess: { + build: { + src: [ '<%= app_files.less %>' ], + dest: '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css', + options: { + compile: true, + compress: false, + noUnderscores: false, + noIDs: false, + zeroUnits: false + } + }, + compile: { + src: [ '<%= recess.build.dest %>' ], + dest: '<%= recess.build.dest %>', + options: { + compile: true, + compress: true, + noUnderscores: false, + noIDs: false, + zeroUnits: false + } + } + }, + + /** + * `jshint` defines the rules of our linter as well as which files we + * should check. This file, all javascript sources, and all our unit tests + * are linted based on the policies listed in `options`. But we can also + * specify exclusionary patterns by prefixing them with an exclamation + * point (!); this is useful when code comes from a third party but is + * nonetheless inside `src/`. + */ + jshint: { + src: [ + '<%= app_files.js %>' + ], + test: [ + '<%= app_files.jsunit %>' + ], + gruntfile: [ + 'Gruntfile.js' + ], + options: { + curly: true, + immed: true, + newcap: true, + noarg: true, + sub: true, + boss: true, + eqnull: true + }, + globals: {} + }, + + /** + * `coffeelint` does the same as `jshint`, but for CoffeeScript. + * CoffeeScript is not the default in ngBoilerplate, so we're just using + * the defaults here. + */ + coffeelint: { + src: { + files: { + src: [ '<%= app_files.coffee %>' ] + } + }, + test: { + files: { + src: [ '<%= app_files.coffeeunit %>' ] + } + } + }, + + /** + * HTML2JS is a Grunt plugin that takes all of your template files and + * places them into JavaScript files as strings that are added to + * AngularJS's template cache. This means that the templates too become + * part of the initial payload as one JavaScript file. Neat! + */ + html2js: { + /** + * These are the templates from `src/app`. + */ + app: { + options: { + base: 'src/app' + }, + src: [ '<%= app_files.atpl %>' ], + dest: '<%= build_dir %>/templates-app.js' + }, + + /** + * These are the templates from `src/common`. + */ + common: { + options: { + base: 'src/common' + }, + src: [ '<%= app_files.ctpl %>' ], + dest: '<%= build_dir %>/templates-common.js' + } + }, + + /** + * The Karma configurations. + */ + karma: { + options: { + configFile: '<%= build_dir %>/karma-unit.js' + }, + unit: { + runnerPort: 9101, + background: true + }, + continuous: { + singleRun: true + } + }, + + /** + * The `index` task compiles the `index.html` file as a Grunt template. CSS + * and JS files co-exist here but they get split apart later. + */ + index: { + + /** + * During development, we don't want to have wait for compilation, + * concatenation, minification, etc. So to avoid these steps, we simply + * add all script files directly to the `
` of `index.html`. The + * `src` property contains the list of included files. + */ + build: { + dir: '<%= build_dir %>', + src: [ + '<%= vendor_files.js %>', + '<%= build_dir %>/src/**/*.js', + '<%= html2js.common.dest %>', + '<%= html2js.app.dest %>', + '<%= recess.build.dest %>' + ] + }, + + /** + * When it is time to have a completely compiled application, we can + * alter the above to include only a single JavaScript and a single CSS + * file. Now we're back! + */ + compile: { + dir: '<%= compile_dir %>', + src: [ + '<%= concat.compile_js.dest %>', + '<%= vendor_files.css %>', + '<%= recess.compile.dest %>' + ] + } + }, + + /** + * This task compiles the karma template so that changes to its file array + * don't have to be managed manually. + */ + karmaconfig: { + unit: { + dir: '<%= build_dir %>', + src: [ + '<%= vendor_files.js %>', + '<%= html2js.app.dest %>', + '<%= html2js.common.dest %>', + '<%= test_files.js %>' + ] + } + }, + + /** + * And for rapid development, we have a watch set up that checks to see if + * any of the files listed below change, and then to execute the listed + * tasks when they do. This just saves us from having to type "grunt" into + * the command-line every time we want to see what we're working on; we can + * instead just leave "grunt watch" running in a background terminal. Set it + * and forget it, as Ron Popeil used to tell us. + * + * But we don't need the same thing to happen for all the files. + */ + delta: { + /** + * By default, we want the Live Reload to work for all tasks; this is + * overridden in some tasks (like this file) where browser resources are + * unaffected. It runs by default on port 35729, which your browser + * plugin should auto-detect. + */ + options: { + livereload: true + }, + + /** + * When the Gruntfile changes, we just want to lint it. In fact, when + * your Gruntfile changes, it will automatically be reloaded! + */ + gruntfile: { + files: 'Gruntfile.js', + tasks: [ 'jshint:gruntfile' ], + options: { + livereload: false + } + }, + + /** + * When our JavaScript source files change, we want to run lint them and + * run our unit tests. + */ + jssrc: { + files: [ + '<%= app_files.js %>' + ], + tasks: [ 'jshint:src', 'karma:unit:run', 'copy:build_appjs' ] + }, + + /** + * When our CoffeeScript source files change, we want to run lint them and + * run our unit tests. + */ + coffeesrc: { + files: [ + '<%= app_files.coffee %>' + ], + tasks: [ 'coffeelint:src', 'coffee:source', 'karma:unit:run', 'copy:build_appjs' ] + }, + + /** + * When assets are changed, copy them. Note that this will *not* copy new + * files, so this is probably not very useful. + */ + assets: { + files: [ + 'src/assets/**/*' + ], + tasks: [ 'copy:build_assets' ] + }, + + /** + * When index.html changes, we need to compile it. + */ + html: { + files: [ '<%= app_files.html %>' ], + tasks: [ 'index:build' ] + }, + + /** + * When our templates change, we only rewrite the template cache. + */ + tpls: { + files: [ + '<%= app_files.atpl %>', + '<%= app_files.ctpl %>' + ], + tasks: [ 'html2js' ] + }, + + /** + * When the CSS files change, we need to compile and minify them. + */ + less: { + files: [ 'src/**/*.less' ], + tasks: [ 'recess:build' ] + }, + + /** + * When a JavaScript unit test file changes, we only want to lint it and + * run the unit tests. We don't want to do any live reloading. + */ + jsunit: { + files: [ + '<%= app_files.jsunit %>' + ], + tasks: [ 'jshint:test', 'karma:unit:run' ], + options: { + livereload: false + } + }, + + /** + * When a CoffeeScript unit test file changes, we only want to lint it and + * run the unit tests. We don't want to do any live reloading. + */ + coffeeunit: { + files: [ + '<%= app_files.coffeeunit %>' + ], + tasks: [ 'coffeelint:test', 'karma:unit:run' ], + options: { + livereload: false + } + } + } + }; + + grunt.initConfig( grunt.util._.extend( taskConfig, userConfig ) ); + + /** + * In order to make it safe to just compile or copy *only* what was changed, + * we need to ensure we are starting from a clean, fresh build. So we rename + * the `watch` task to `delta` (that's why the configuration var above is + * `delta`) and then add a new task called `watch` that does a clean build + * before watching for changes. + */ + grunt.renameTask( 'watch', 'delta' ); + grunt.registerTask( 'watch', [ 'build', 'karma:unit', 'delta' ] ); + + /** + * The default task is to build and compile. + */ + grunt.registerTask( 'default', [ 'build', 'compile' ] ); + + /** + * The `build` task gets your app ready to run for development and testing. + */ + grunt.registerTask( 'build', [ + 'clean', 'html2js', 'gjslint', 'jshint', 'coffeelint', 'coffee', 'recess:build', + 'concat:build_css', 'copy:build_app_assets', 'copy:build_vendor_assets', 'copy:build_vendor_fonts', + 'copy:build_appjs', 'copy:build_vendorjs', 'index:build', 'karmaconfig', + 'karma:continuous' + ]); + + /** + * The `compile` task gets your app ready for deployment by concatenating and + * minifying your code. + */ + grunt.registerTask( 'compile', [ + 'recess:compile', 'copy:compile_assets', 'copy:compile_fonts', 'ngmin', 'concat:compile_js', 'uglify', 'index:compile' + ]); + + /** + * A utility function to get all app JavaScript sources. + */ + function filterForJS ( files ) { + return files.filter( function ( file ) { + return file.match( /\.js$/ ); + }); + } + + /** + * A utility function to get all app CSS sources. + */ + function filterForCSS ( files ) { + return files.filter( function ( file ) { + return file.match( /\.css$/ ); + }); + } + + /** + * The index.html template includes the stylesheet and javascript sources + * based on dynamic names calculated in this Gruntfile. This task assembles + * the list into variables for the template to use and then runs the + * compilation. + */ + grunt.registerMultiTask( 'index', 'Process index.html template', function () { + var dirRE = new RegExp( '^('+grunt.config('build_dir')+'|'+grunt.config('compile_dir')+')\/', 'g' ); + var jsFiles = filterForJS( this.filesSrc ).map( function ( file ) { + return file.replace( dirRE, '' ); + }); + var cssFiles = filterForCSS( this.filesSrc ).map( function ( file ) { + return file.replace( dirRE, '' ); + }); + + grunt.file.copy('src/index.html', this.data.dir + '/index.html', { + process: function ( contents, path ) { + return grunt.template.process( contents, { + data: { + scripts: jsFiles, + styles: cssFiles, + version: grunt.config( 'pkg.version' ) + } + }); + } + }); + }); + + /** + * In order to avoid having to specify manually the files needed for karma to + * run, we use grunt to manage the list for us. The `karma/*` files are + * compiled as grunt templates for use by Karma. Yay! + */ + grunt.registerMultiTask( 'karmaconfig', 'Process karma config templates', function () { + var jsFiles = filterForJS( this.filesSrc ); + + grunt.file.copy( 'karma/karma-unit.tpl.js', grunt.config( 'build_dir' ) + '/karma-unit.js', { + process: function ( contents, path ) { + return grunt.template.process( contents, { + data: { + scripts: jsFiles + } + }); + } + }); + }); + +}; diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8f9a7f4a --- /dev/null +++ b/LICENSE @@ -0,0 +1,4 @@ +Copyright (c) 2013 LMN Solutions, LLC, All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..aa63fd43 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +## Quick Start + +Install Node.js and then: + +```sh +$ git clone git://github.com/ROGUE-JCTD/MapLoom +$ cd MapLoom +$ sudo npm -g install grunt-cli karma bower +$ npm install +$ bower install +$ grunt watch +``` + +Finally, open `file:///path/to/MapLoom/build/index.html` in your browser. diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..b741657e --- /dev/null +++ b/bower.json @@ -0,0 +1,21 @@ +{ + "name": "MapLoom", + "version": "0.0.1", + "devDependencies": { + "bootstrap": "3.0.0", + "angular": "1.2.0-rc.2", + "angular-mocks": "1.2.0-rc.2", + "angular-bootstrap": "0.6.0", + "angular-ui-router": "0.2.0", + "jquery": "~2.0.3" + }, + "dependencies": { + "bootstrap": "3.0.0", + "angular": "1.2.0-rc.2", + "angular-mocks": "1.2.0-rc.2", + "angular-bootstrap": "0.6.0", + "angular-ui-router": "0.2.0", + "jquery": "~2.0.3", + "openlayers": "./openlayers" + } +} diff --git a/build.config.js b/build.config.js new file mode 100644 index 00000000..caab57de --- /dev/null +++ b/build.config.js @@ -0,0 +1,83 @@ +/** + * This file/module contains all configuration for the build process. + */ +module.exports = { + /** + * The `build_dir` folder is where our projects are compiled during + * development and the `compile_dir` folder is where our app resides once it's + * completely built. + */ + build_dir: 'build', + compile_dir: 'bin', + + /** + * This is a collection of file patterns that refer to our app code (the + * stuff in `src/`). These file paths are used in the configuration of + * build tasks. `js` is all project javascript, less tests. `ctpl` contains + * our reusable components' (`src/common`) template HTML files, while + * `atpl` contains the same, but for our app's code. `html` is just our + * main HTML file, `less` is our main stylesheet, and `unit` contains our + * app's unit tests. + */ + app_files: { + js: [ 'src/**/*.js', '!src/**/*.spec.js', '!src/assets/**/*.js' ], + jsunit: [ 'src/**/*.spec.js' ], + + coffee: [ 'src/**/*.coffee', '!src/**/*.spec.coffee' ], + coffeeunit: [ 'src/**/*.spec.coffee' ], + + atpl: [ 'src/app/**/*.tpl.html' ], + ctpl: [ 'src/common/**/*.tpl.html' ], + + html: [ 'src/index.html' ], + less: 'src/less/main.less' + }, + + /** + * This is a collection of files used during testing only. + */ + test_files: { + js: [ + 'vendor/angular-mocks/angular-mocks.js' + ] + }, + + /** + * This is the same as `app_files`, except it contains patterns that + * reference vendor code (`vendor/`) that we need to place into the build + * process somewhere. While the `app_files` property ensures all + * standardized files are collected for compilation, it is the user's job + * to ensure non-standardized (i.e. vendor-related) files are handled + * appropriately in `vendor_files.js`. + * + * The `vendor_files.js` property holds files to be automatically + * concatenated and minified with our project source files. + * + * The `vendor_files.css` property holds any CSS files to be automatically + * included in our app. + * + * The `vendor_files.assets` property holds any assets to be copied along + * with our app's assets. This structure is flattened, so it is not + * recommended that you use wildcards. + */ + vendor_files: { + js: [ + 'vendor/jquery/jquery.min.js', + 'vendor/angular/angular.js', + 'vendor/angular-bootstrap/ui-bootstrap-tpls.min.js', + 'vendor/placeholders/angular-placeholders-0.0.1-SNAPSHOT.min.js', + 'vendor/angular-ui-router/release/angular-ui-router.js', + 'vendor/angular-ui-utils/modules/route/route.js', + 'vendor/bootstrap/dist/js/bootstrap.js', + 'vendor/openlayers/ol.js' + ], + css: [ + 'vendor/openlayers/ol.css' + ], + assets: [ + ], + fonts: [ + 'vendor/bootstrap/fonts/*' + ] + }, +}; diff --git a/changelog.tpl b/changelog.tpl new file mode 100644 index 00000000..c0274e4a --- /dev/null +++ b/changelog.tpl @@ -0,0 +1,23 @@ + +# <%= version%> (<%= today%>) + +<% if (_(changelog.feat).size() > 0) { %> ## Features +<% _(changelog.feat).forEach(function(changes, scope) { %> +- **<%= scope%>:** + <% changes.forEach(function(change) { %> - <%= change.msg%> (<%= helpers.commitLink(change.sha1) %>) + <% }); %> +<% }); %> <% } %> + +<% if (_(changelog.fix).size() > 0) { %> ## Fixes +<% _(changelog.fix).forEach(function(changes, scope) { %> +- **<%= scope%>:** + <% changes.forEach(function(change) { %> - <%= change.msg%> (<%= helpers.commitLink(change.sha1) %>) + <% }); %> +<% }); %> <% } %> + +<% if (_(changelog.breaking).size() > 0) { %> ## Breaking Changes +<% _(changelog.breaking).forEach(function(changes, scope) { %> +- **<%= scope%>:** + <% changes.forEach(function(change) { %> <%= change.msg%> + <% }); %> +<% }); %> <% } %> diff --git a/gjslint.py b/gjslint.py new file mode 100755 index 00000000..cbabf3c4 --- /dev/null +++ b/gjslint.py @@ -0,0 +1,9 @@ +#!/usr/bin/python +# EASY-INSTALL-ENTRY-SCRIPT: 'closure-linter==2.3.11','console_scripts','gjslint' +__requires__ = 'closure-linter==2.3.11' +import sys +from pkg_resources import load_entry_point + +sys.exit( + load_entry_point('closure-linter==2.3.11', 'console_scripts', 'gjslint')() +) diff --git a/karma/karma-unit.tpl.js b/karma/karma-unit.tpl.js new file mode 100644 index 00000000..e1e423d7 --- /dev/null +++ b/karma/karma-unit.tpl.js @@ -0,0 +1,62 @@ +module.exports = function ( karma ) { + karma.configure({ + /** + * From where to look for files, starting with the location of this file. + */ + basePath: '../', + + /** + * This is the list of file patterns to load into the browser during testing. + */ + files: [ + <% scripts.forEach( function ( file ) { %>'<%= file %>', + <% }); %> + 'src/**/*.js', + 'src/**/*.coffee', + ], + exclude: [ + 'src/assets/**/*.js' + ], + frameworks: [ 'jasmine' ], + plugins: [ 'karma-jasmine', 'karma-firefox-launcher', 'karma-chrome-launcher', 'karma-phantomjs-launcher', 'karma-coffee-preprocessor' ], + preprocessors: { + '**/*.coffee': 'coffee', + }, + + /** + * How to report, by default. + */ + reporters: 'dots', + + /** + * On which port should the browser connect, on which port is the test runner + * operating, and what is the URL path for the browser to use. + */ + port: 9018, + runnerPort: 9100, + urlRoot: '/', + + /** + * Disable file watching by default. + */ + autoWatch: false, + + /** + * The list of browsers to launch to test on. This includes only "Firefox" by + * default, but other browser names include: + * Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS + * + * Note that you can also use the executable name of the browser, like "chromium" + * or "firefox", but that these vary based on your operating system. + * + * You may also leave this blank and manually navigate your browser to + * http://localhost:9018/ when you're running tests. The window/tab can be left + * open and the tests will automatically occur there during the build. This has + * the aesthetic advantage of not launching a browser every time you save. + */ + browsers: [ + 'Chrome' + ] + }); +}; + diff --git a/module.prefix b/module.prefix new file mode 100644 index 00000000..c52d9b72 --- /dev/null +++ b/module.prefix @@ -0,0 +1 @@ +(function ( window, angular, undefined ) { diff --git a/module.suffix b/module.suffix new file mode 100644 index 00000000..f6354bac --- /dev/null +++ b/module.suffix @@ -0,0 +1 @@ +})( window, window.angular ); diff --git a/openlayers/ol.css b/openlayers/ol.css new file mode 100644 index 00000000..45c2cb8e --- /dev/null +++ b/openlayers/ol.css @@ -0,0 +1 @@ +.ol-attribution{position:absolute;text-align:right;color:#eee;bottom:0;right:0;background:rgba(0,60,136,0.3);font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;padding:6px}.ol-attribution a{color:white;text-decoration:none}.ol-attribution ul{margin:0;padding:0;font-size:10px;line-height:12px}.ol-attribution li{display:inline;list-style:none;line-height:inherit}.ol-attribution li:not(:last-child):after{content:"\002003"}.ol-dragbox{position:absolute;border:2px solid red}.ol-full-screen{background:rgba(255,255,255,0.4);border-radius:4px;padding:2px;position:absolute;right:8px;top:8px}@media print{.ol-full-screen{display:none}}.ol-full-screen a{background:rgba(0,60,136,0.5);color:white;display:block;font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;font-size:18px;font-weight:bold;height:22px;line-height:19px;margin:1px;padding:0;text-align:center;text-decoration:none;width:22px}a.ol-full-screen-false:after{content:"\002194"}a.ol-full-screen-true:after{content:"\0000d7"}.ol-full-screen div{border-radius:2px}.ol-full-screen div a{border-radius:2px}.ol-full-screen a:hover{background:rgba(0,60,136,0.7)}.ol-logo{bottom:0;left:0;padding:2px;position:absolute}.ol-logo ul{margin:0}.ol-logo ul li{display:inline;list-style:none}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:rgba(0,60,136,0.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;text-align:center;margin:1px;padding:0 2px}.ol-unsupported{display:none}.ol-viewport .ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ol-zoom{position:absolute;top:8px;left:8px;background:rgba(255,255,255,0.4);border-radius:4px;padding:2px}@media print{.ol-zoom{display:none}}.ol-zoom a{display:block;margin:1px;padding:0;color:white;font-size:18px;font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;text-align:center;height:22px;width:22px;line-height:19px;background:rgba(0,60,136,0.5)}.ol-touch .ol-zoom a{font-size:20px;height:30px;width:30px;line-height:26px}.ol-zoom a:hover{background:rgba(0,60,136,0.7)}.ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom-in:before{content:"+"}.ol-zoom-out{border-radius:0 0 2px 2px}.ol-zoom-out:before{content:"\002212"}.ol-zoomslider{position:absolute;top:67px;left:8px;background:rgba(255,255,255,0.4);border-radius:4px;width:28px;height:200px;outline:none;overflow:hidden;padding:0;margin:0}.ol-zoomslider-thumb{position:absolute;display:block;padding:0;margin:2px;background:rgba(0,60,136,0.5);border-radius:2px;outline:none;overflow:hidden;height:20px;width:24px}.ol-zoom-extent{position:absolute;background:rgba(255,255,255,0.4);border-radius:4px;left:8px;padding:2px;top:65px}@media print{.ol-zoom-extent{display:none}}.ol-zoom-extent a{display:block;margin:1px;padding:0;color:white;font-size:16px;font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;text-align:center;height:22px;width:22px;background-color:rgba(0,60,136,0.5);border-radius:2px}.ol-touch .ol-zoom-extent a{font-size:20px;height:30px;width:30px;line-height:26px}.ol-zoom-extent a:hover{background-color:rgba(0,60,136,0.7)}.ol-zoom-extent a:after{content:"E"} \ No newline at end of file diff --git a/openlayers/ol.js b/openlayers/ol.js new file mode 100644 index 00000000..92d31fa1 --- /dev/null +++ b/openlayers/ol.js @@ -0,0 +1,508 @@ +(function(){function k(a){return function(){return this[a]}}function ba(a){return function(){return a}}var m,ca=ca||{},p=this;function da(){}function fa(a){a.va=function(){return a.Vd?a.Vd:a.Vd=new a}} +function ga(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; +else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function s(a){return void 0!==a}function ia(a){return"array"==ga(a)}function ja(a){var b=ga(a);return"array"==b||"object"==b&&"number"==typeof a.length}function u(a){return"string"==typeof a}function ka(a){return"number"==typeof a}function la(a){return"function"==ga(a)}function ma(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function x(a){return a[na]||(a[na]=++oa)} +var na="closure_uid_"+(1E9*Math.random()>>>0),oa=0;function pa(a,b,c){return a.call.apply(a.bind,arguments)}function qa(a,b,c){if(!a)throw Error();if(2{{notification.text}}
+ + +