diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..c13c5f6
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["es2015"]
+}
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..ca51474
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,21 @@
+{
+ "rules": {
+ "no-console": "off",
+ "indent": [ "error", 2 ],
+ "quotes": [ "error", "single" ],
+ "semi": ["error", "always"],
+ "linebreak-style": [ "error", "unix" ]
+ },
+ "env": {
+ "es6": true,
+ "node": true,
+ "mocha": true,
+ "jasmine": true
+ },
+ "ecmaFeatures": {
+ "modules": true,
+ "experimentalObjectRestSpread": true,
+ "impliedStrict": true
+ },
+ "extends": "eslint:recommended"
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ac4aad8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,129 @@
+
+# Created by https://www.gitignore.io/api/node,osx,windows,linux
+
+### Linux ###
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### Node ###
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# Typescript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+
+### OSX ###
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.gitignore.io/api/node,osx,windows,linux
diff --git a/.gulpfile.js b/.gulpfile.js
new file mode 100644
index 0000000..d66519f
--- /dev/null
+++ b/.gulpfile.js
@@ -0,0 +1,23 @@
+'use strict';
+
+const gulp = require('gulp');
+const eslint = require('gulp-eslint');
+const mocha = require ('gulp-mocha');
+
+gulp.task('test', function(){
+ gulp.src('./test/*-test.js', { read: false})
+ .pipe(mocha({ reporter: 'spec'}));
+});
+
+gulp.task('lint', function() {
+ return gulp.src(['**/*.js', '!node_modules'])
+ .pipe(eslint())
+ .pipe(eslint.format())
+ .pipe(eslint.failAfterError());
+});
+
+gulp.task('dev', function(){
+ gulp.watch(['**/*.js', '!node_modules/**'], ['lint', 'test']);
+});
+
+gulp.task('default', ['dev']);
diff --git a/app/entry.js b/app/entry.js
new file mode 100644
index 0000000..6f1bc64
--- /dev/null
+++ b/app/entry.js
@@ -0,0 +1,63 @@
+'use strict';
+
+require('./scss/core.scss');
+
+const angular = require('angular');
+const cowsay = require('cowsay-browser');
+
+const cowsayApp = angular.module('cowsayApp', []);
+
+cowsayApp.controller('CowsayController', ['$log', CowsayController]);
+
+function CowsayController($log) {
+ $log.debug('CowsayController');
+
+ this.title = 'cow creator.';
+ this.subTitle = 'make it, view it, and undo it!';
+ this.history = [];
+ this.historyTitle = 'view it!';
+ this.historySubTitle = 'checkout the cow you just made';
+
+ cowsay.list((err, cowfiles) => {
+ this.cowfiles = cowfiles;
+ this.current = this.cowfiles[0];
+ });
+
+ this.update = function(input){
+ $log.debug('cowsayCtrl.update()');
+ return cowsay.say({ text:input || 'mooooo', f: this.current});
+ };
+
+ this.speak = function(input) {
+ $log.debug('cowsayCtrl.speak()');
+ this.spoken = this.update(input);
+ this.history.push(this.spoken);
+ };
+
+ this.undo = function(){
+ $log.debug('cowsayCtrl.undo()');
+ this.history.pop();
+ this.spoken = this.history.pop() || '';
+ };
+}
+
+cowsayApp.controller('NavController', ['$log', NavController]);
+
+function NavController($log) {
+ $log.debug('NavController');
+
+ this.routes = [
+ {
+ name:'home',
+ url: '/home'
+ },
+ {
+ name: 'about',
+ url: '/about-us'
+ },
+ {
+ name: 'contact',
+ url: '/contact-us'
+ }
+ ];
+}
diff --git a/app/index.html b/app/index.html
new file mode 100644
index 0000000..d3ed856
--- /dev/null
+++ b/app/index.html
@@ -0,0 +1,67 @@
+
+
+
+ Welcome to Cowville!
+
+
+
+
+
+
+
+
+ {{ cowsayCtrl.update(cowsayCtrl.text) }}
+
+
+
+
+
+
+
+
diff --git a/app/scss/_base.scss b/app/scss/_base.scss
new file mode 100644
index 0000000..5be8040
--- /dev/null
+++ b/app/scss/_base.scss
@@ -0,0 +1,95 @@
+$tertiaryColor: #555;
+$primaryColor: #999;
+$black: #000;
+$white: #fff;
+
+body{
+ background: $primaryColor;
+ font-family: helvetica;
+ font-size: 1vw;
+}
+
+a{
+ text-decoration: none;
+ color: $primaryColor;
+ cursor: all-scroll;
+}
+nav{
+ background: $tertiaryColor;
+ height: 100px;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: center;
+ align-content: stretch;
+
+ h1{
+ font-size: 5vw;
+ }
+ ul{
+ width: 50%;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: space-around;
+ align-items: flex-end;
+ align-content: stretch;
+ li{
+ font-size: 3vw;
+ display: inline;
+ }
+ }
+}
+
+
+
+h2{
+ font-size: 6vw;
+}
+
+h3{
+ font-size: 3vw;
+}
+
+section{
+ margin: 100px;
+}
+
+pre{
+ border: 2px solid black;
+ float: left;
+ margin-right: 2vw;
+ font-size: 3vw;
+}
+
+select{
+ width: 80%;
+ height: 50px;
+}
+
+input{
+ width: 80%;
+ height: 50px;
+ margin-bottom: 3vw;
+}
+
+button{
+ width: 80%;
+ height: 50px;
+}
+
+footer{
+ clear: both;
+ height:150px;
+ background: $tertiaryColor;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: flex-end;
+ align-items: flex-end;
+ align-content: stretch;
+ p{
+ font-size: 3vw;
+ }
+}
diff --git a/app/scss/_main.scss b/app/scss/_main.scss
new file mode 100644
index 0000000..99a3ab9
--- /dev/null
+++ b/app/scss/_main.scss
@@ -0,0 +1,48 @@
+.undo{
+ width: 40%;
+}
+
+.histCow{
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: flex-end;
+ align-content: stretch;
+}
+
+.history{
+ clear: both;
+ margin-top: 25px;
+}
+
+.inputs{
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: center;
+ align-content: stretch;
+}
+
+.headers{
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+ align-items: flex-end;
+ align-content: stretch;
+}
+
+.buttonTitle{
+ margin-top: 3vw;
+ margin-bottom: 3vw;
+ font-size: 2.34vw;
+}
+
+.divider{
+ clear: both;
+ margin: 3vw;
+ font-size: 2vw;
+}
diff --git a/app/scss/_reset.scss b/app/scss/_reset.scss
new file mode 100644
index 0000000..ed11813
--- /dev/null
+++ b/app/scss/_reset.scss
@@ -0,0 +1,48 @@
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section {
+ display: block;
+}
+body {
+ line-height: 1;
+}
+ol, ul {
+ list-style: none;
+}
+blockquote, q {
+ quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+ content: '';
+ content: none;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
diff --git a/app/scss/core.scss b/app/scss/core.scss
new file mode 100644
index 0000000..0060c72
--- /dev/null
+++ b/app/scss/core.scss
@@ -0,0 +1,3 @@
+@import 'reset';
+@import 'base';
+@import 'main';
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644
index 0000000..b174dbe
--- /dev/null
+++ b/karma.conf.js
@@ -0,0 +1,26 @@
+const webpackConfig = require('./webpack.config.js');
+webpackConfig.entry = {};
+
+module.exports = function(config) {
+ config.set({
+ webpack: webpackConfig,
+ basePath: '',
+ frameworks: ['jasmine'],
+ files: [
+ 'test/**/*-test.js'
+ ],
+ exclude: [
+ ],
+ preprocessors: {
+ 'test/**/*-test.js': ['webpack']
+ },
+ reporters: ['mocha'],
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: true,
+ browsers: ['PhantomJS'],
+ singleRun: false,
+ concurrency: Infinity
+ });
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..63bf92a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "angular-controllers",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "./node_modules/webpack/bin/webpack.js",
+ "watch": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot",
+ "test-watch": "./node_modules/karma/bin/karma start",
+ "test": "./node_modules/karma/bin/karma start --single-run",
+ "lint": "./node_modules/eslint/bin/eslint.js ."
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "angular": "^1.6.3",
+ "babel-core": "^6.24.0",
+ "babel-loader": "^6.4.1",
+ "babel-preset-es2015": "^6.24.0",
+ "cowsay-browser": "^1.1.8",
+ "css-loader": "^0.27.3",
+ "extract-text-webpack-plugin": "^1.0.1",
+ "html-webpack-plugin": "^2.28.0",
+ "node-sass": "^4.5.1",
+ "sass-loader": "^6.0.3",
+ "style-loader": "^0.15.0",
+ "webpack": "^1.14.0"
+ },
+ "devDependencies": {
+ "angular-mocks": "^1.6.3",
+ "jasmine-core": "^2.5.2",
+ "karma": "^1.5.0",
+ "karma-jasmine": "^1.1.0",
+ "karma-mocha-reporter": "^2.2.3",
+ "karma-phantomjs-launcher": "^1.0.4",
+ "karma-webpack": "^2.0.3",
+ "webpack-dev-server": "^1.16.2"
+ }
+}
diff --git a/test/cwosay-ctrl-test.js b/test/cwosay-ctrl-test.js
new file mode 100644
index 0000000..84b2826
--- /dev/null
+++ b/test/cwosay-ctrl-test.js
@@ -0,0 +1,53 @@
+'use strict';
+
+require('./lib/test-setup.js');
+const angular = require('angular');
+const cowsay = require('cowsay-browser');
+
+describe('Cowsay Controller', function(){
+ beforeEach(() => {
+ angular.mock.module('cowsayApp');
+ angular.mock.inject($controller => {
+ this.cowsayCtrl = new $controller('CowsayController');
+ });
+ });
+ describe('initial properties', () => {
+ it('title property should equal cow creator.', () => {
+ expect(this.cowsayCtrl.title).toBe('cow creator.');
+ });
+ it('history property should be an empty array', () => {
+ expect(Array.isArray(this.cowsayCtrl.history)).toBe(true);
+ });
+ it('list of cowfile should show proper cowfiles', ()=> {
+ cowsay.list((err, list) => {
+ expect(this.cowsayCtrl.cowfiles).toEqual(list);
+ expect(this.cowsayCtrl.current).toEqual(list[0]);
+ });
+ });
+ });
+ describe('#update', () => {
+ it('should return a cow that says testing', () => {
+ let expected = cowsay.say({ text: 'testing', f: this.cowsayCtrl.current});
+ let result = this.cowsayCtrl.update('testing');
+ expect(result).toEqual(expected);
+ });
+ });
+ describe('speak', () => {
+ it('should return a cow that says testing', () => {
+ let expected = cowsay.say({text: 'testing', f: this.cowsayCtrl.current});
+ this.cowsayCtrl.speak('testing');
+ expect(this.cowsayCtrl.spoken).toEqual(expected);
+ expect(this.cowsayCtrl.history[0]).toEqual(expected);
+ });
+ });
+ describe('undo', () => {
+ it('should return a cow that says testing', () => {
+ let expected = cowsay.say({text: 'testing', f: this.cowsayCtrl.current});
+ this.cowsayCtrl.speak('testing');
+ this.cowsayCtrl.speak('testing again');
+ this.cowsayCtrl.undo();
+ expect(this.cowsayCtrl.spoken).toEqual(expected);
+ expect(this.cowsayCtrl.history.length).toEqual(0);
+ });
+ });
+});
diff --git a/test/lib/test-setup.js b/test/lib/test-setup.js
new file mode 100644
index 0000000..6368526
--- /dev/null
+++ b/test/lib/test-setup.js
@@ -0,0 +1,4 @@
+'use strict';
+
+require('../../app/entry.js');
+require('angular-mocks');
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..ad54a41
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,35 @@
+'use strict';
+
+const HTMLPlugin = require('html-webpack-plugin');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+
+module.exports = {
+ entry: `${__dirname}/app/entry.js`,
+ output: {
+ filename: 'bundle.js',
+ path: 'build'
+ },
+ plugins: [
+ new HTMLPlugin({
+ template: `${__dirname}/app/index.html`
+ }),
+ new ExtractTextPlugin('bundle.css')
+ ],
+ module: {
+ loaders: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ loader: 'babel'
+ },
+ {
+ test: /\.scss$/,
+ loader: 'style!css!sass!'
+ },
+ {
+ test: /\.(eot|woff|ttf|svg).*/,
+ loader: 'url?limit=10000&name=fonts/[hash].[ext]'
+ }
+ ]
+ }
+};