diff --git a/vic-bunny/.eslintignore b/vic-bunny/.eslintignore new file mode 100644 index 0000000..5348393 --- /dev/null +++ b/vic-bunny/.eslintignore @@ -0,0 +1,8 @@ +**/node_modules/* +**/vendor/* +**/build/* +**/*.min.js +*.md +package.json +Procfile +npm-debug.log diff --git a/vic-bunny/.eslintrc b/vic-bunny/.eslintrc new file mode 100644 index 0000000..4d749b1 --- /dev/null +++ b/vic-bunny/.eslintrc @@ -0,0 +1,42 @@ +{ +"rules": { +"no-console": 0, +"indent": [ +2, +2 +], +"quotes": [ +2, +"single" +], +"linebreak-style": [ +2, +"unix" +], +"semi": [ +2, +"always" +] +}, +"env": { +"es6": true, +"node": true, +"browser": true, +"mocha": true, +"jasmine": true +}, +"globals": { +"describe": false, +"it": false, +"beforeEach": false, +"afterEach": false, +"before": false, +"after": false +}, +"ecmaFeatures": { +"modules": true, +"experimentalObjectRestSpread": true, +"impliedStrict": true +}, +"extends": "eslint:recommended" +} diff --git a/vic-bunny/.gitignore b/vic-bunny/.gitignore new file mode 100644 index 0000000..88202b0 --- /dev/null +++ b/vic-bunny/.gitignore @@ -0,0 +1,4 @@ +node_modules +build +db +*_bundle.js diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html new file mode 100644 index 0000000..2e44b72 --- /dev/null +++ b/vic-bunny/app/index.html @@ -0,0 +1,18 @@ + + + + + + + Bunny App + + + +
+ + + +
+ + + diff --git a/vic-bunny/app/js/bunny/controllers/bunny-controller.js b/vic-bunny/app/js/bunny/controllers/bunny-controller.js new file mode 100644 index 0000000..dda07be --- /dev/null +++ b/vic-bunny/app/js/bunny/controllers/bunny-controller.js @@ -0,0 +1,11 @@ +'use strict'; + +module.exports = function(app) { + app.controller('BunnyController', ['$scope', function() { + this.title = 'Vicious Bunny'; + this.height = 400; + this.width = 400; + this.description = 'Don\'t get too close or this vicious little monster will attack! This particular species can devour the average man in 13.7 seconds.'; + this.link = 'http://f.cl.ly/items/3g3J1G0w122M360w380O/3726490195_f7cc75d377_o.jpg'; + }]); +}; diff --git a/vic-bunny/app/js/bunny/controllers/index.js b/vic-bunny/app/js/bunny/controllers/index.js new file mode 100644 index 0000000..ba2eb02 --- /dev/null +++ b/vic-bunny/app/js/bunny/controllers/index.js @@ -0,0 +1,3 @@ +module.exports = function(app) { + require('./bunny-controller')(app); +}; diff --git a/vic-bunny/app/js/bunny/directives/index.js b/vic-bunny/app/js/bunny/directives/index.js new file mode 100644 index 0000000..1b8165e --- /dev/null +++ b/vic-bunny/app/js/bunny/directives/index.js @@ -0,0 +1,5 @@ +module.exports = function(app) { + require('./nobunny-directive')(app); + require('./thumbbunny-directive')(app); + require('./vicbunny-directive')(app); +}; diff --git a/vic-bunny/app/js/bunny/directives/nobunny-directive.js b/vic-bunny/app/js/bunny/directives/nobunny-directive.js new file mode 100644 index 0000000..d11d39a --- /dev/null +++ b/vic-bunny/app/js/bunny/directives/nobunny-directive.js @@ -0,0 +1,14 @@ +module.exports = function(app) { + app.directive('noBunny', function() { + return { + templateUrl: + './templates/bunny/nobunny-directive.html', + restrict: 'E', + scope: { + title: '@', + link: '@', + description: '@' + } + }; + }); +}; diff --git a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js b/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js new file mode 100644 index 0000000..5b64fa2 --- /dev/null +++ b/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js @@ -0,0 +1,16 @@ +module.exports = function(app) { + app.directive('thumbBunny', function() { + return { + templateUrl: + './templates/bunny/thumbbunny-directive.html', + restrict: 'E', + scope: { + title: '@', + link: '@', + height: '@100', + width: '@100', + description: '@' + } + }; + }); +}; diff --git a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js b/vic-bunny/app/js/bunny/directives/vicbunny-directive.js new file mode 100644 index 0000000..1fdf676 --- /dev/null +++ b/vic-bunny/app/js/bunny/directives/vicbunny-directive.js @@ -0,0 +1,16 @@ +module.exports = function(app) { + app.directive('vicBunny', function() { + return { + templateUrl: + './templates/bunny/vicbunny-directive.html', + restrict: 'E', + scope: { + title: '@', + link: '@', + height: '@', + width: '@', + description: '@' + } + }; + }); +}; diff --git a/vic-bunny/app/js/bunny/index.js b/vic-bunny/app/js/bunny/index.js new file mode 100644 index 0000000..e7d6cfa --- /dev/null +++ b/vic-bunny/app/js/bunny/index.js @@ -0,0 +1,4 @@ +module.exports = function(app) { + require('./controllers')(app); + require('./directives')(app); +}; diff --git a/vic-bunny/app/js/client.js b/vic-bunny/app/js/client.js new file mode 100644 index 0000000..5f8c0cf --- /dev/null +++ b/vic-bunny/app/js/client.js @@ -0,0 +1,4 @@ +const angular = require('angular'); +const app = angular.module('BunnyApp', []); + +require('./bunny')(app); diff --git a/vic-bunny/app/templates/bunny/nobunny-directive.html b/vic-bunny/app/templates/bunny/nobunny-directive.html new file mode 100644 index 0000000..61174fa --- /dev/null +++ b/vic-bunny/app/templates/bunny/nobunny-directive.html @@ -0,0 +1,5 @@ +
+

{{title}}

+ BEWARE VIC BUNNY! +

{{description}}

+
diff --git a/vic-bunny/app/templates/bunny/thumbbunny-directive.html b/vic-bunny/app/templates/bunny/thumbbunny-directive.html new file mode 100644 index 0000000..752be82 --- /dev/null +++ b/vic-bunny/app/templates/bunny/thumbbunny-directive.html @@ -0,0 +1,3 @@ +
+ {{title}} +
diff --git a/vic-bunny/app/templates/bunny/vicbunny-directive.html b/vic-bunny/app/templates/bunny/vicbunny-directive.html new file mode 100644 index 0000000..8ad1caf --- /dev/null +++ b/vic-bunny/app/templates/bunny/vicbunny-directive.html @@ -0,0 +1,5 @@ +
+

{{title}}

+ {{title}} +

{{description}}

+
diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js new file mode 100644 index 0000000..bc498a0 --- /dev/null +++ b/vic-bunny/gulpfile.js @@ -0,0 +1,40 @@ +'use strict'; + +const gulp = require('gulp'); +const eslint = require('gulp-eslint'); +const webpack = require('webpack-stream'); + +var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/bunny/*.js', './app/js/bunny/controllers/*.js', './app/js/bunny/directives/*.js']; + +const paths = { + js:__dirname + '/app/js/**/**/*.js', + html:__dirname + '/app/**/*.html' +}; + +gulp.task('lint', () => { + return gulp.src(files) + .pipe(eslint()) + .pipe(eslint.format()); +}); + +gulp.task('copy', () => { + return gulp.src(paths.html) + .pipe(gulp.dest(__dirname + '/build')); +}); + +gulp.task('bundle', () => { + return gulp.src(paths.js) + .pipe(webpack({ + output: { + filename: 'bundle.js' + } + })) + .pipe(gulp.dest('./build')); +}); + +gulp.task('default', ['bundle', 'copy']); + +gulp.task('watch', () => { + gulp.watch(paths.js, ['lint', 'bundle']); + gulp.watch(paths.html, ['copy']); +}); diff --git a/vic-bunny/karma.conf.js b/vic-bunny/karma.conf.js new file mode 100644 index 0000000..01f2aca --- /dev/null +++ b/vic-bunny/karma.conf.js @@ -0,0 +1,69 @@ +// Karma configuration +// Generated on Tue Jun 21 2016 21:34:56 GMT-0700 (PDT) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'test/test_bundle.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['Chrome'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }); +}; diff --git a/vic-bunny/package.json b/vic-bunny/package.json new file mode 100644 index 0000000..3fbc649 --- /dev/null +++ b/vic-bunny/package.json @@ -0,0 +1,25 @@ +{ + "name": "vic-bunny", + "version": "1.0.0", + "description": "", + "main": "gulpfile.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "angular": "^1.5.7", + "gulp": "^3.9.1", + "gulp-eslint": "^2.0.0", + "webpack-stream": "^3.2.0" + }, + "dependencies": { + "express": "^4.14.0" + } +} diff --git a/vic-bunny/server.js b/vic-bunny/server.js new file mode 100644 index 0000000..d216dc9 --- /dev/null +++ b/vic-bunny/server.js @@ -0,0 +1,7 @@ +'use strict'; + +const express = require('express'); +const app = express(); + +app.use(express.static(__dirname + '/build')); +app.listen(3002, () => console.log('listening on 3002'));