Skip to content

Commit

Permalink
Merge pull request ladisays#1 from andela-ladenusi/develop
Browse files Browse the repository at this point in the history
Created boilerplate
  • Loading branch information
Ladi Adenusi committed Jul 9, 2015
2 parents f84aee0 + 8212ae9 commit f1be7d9
Show file tree
Hide file tree
Showing 20 changed files with 396 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "./public/lib"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

.DS_Store
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gulp
2 changes: 2 additions & 0 deletions api/routes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = function(app, config) {
};
5 changes: 5 additions & 0 deletions api/routes/keep-alive.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = function (app, config) {
app.route('/keep-alive').get(function (req, res) {
res.send('I am alive');
});
};
7 changes: 7 additions & 0 deletions app/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
doctype html
html(lang="en" ng-app='Kanoevents')
head
title Kano Events
include shared/head
body
.wrapper(ng-view)
28 changes: 28 additions & 0 deletions app/js/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// defining modules
angular.module('kanoevents.controllers', []);
angular.module('kanoevents.services', []);

/* loading services */
require('./services/refs.js');


// loading controller
require('./controllers/mainCtrl.js');

window.Kanoevents = angular.module('Kanoevents', [
'ngRoute',
'ngCookies',
'firebase',
'kanoevents.controllers',
'kanoevents.services'
]);

kanoevents.config(['$routeProvider','$locationProvider',
function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
.when('/', {
templateUrl: 'index.html',
controller: 'mainCtrl'
});
}]);
6 changes: 6 additions & 0 deletions app/js/controllers/mainCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
angular.module('uberhack.controllers')
.controller('mainCtrl', ['Authentication', '$scope', '$rootScope', '$location',
function(Authentication, $scope, $rootScope, $location) {

}
]);
11 changes: 11 additions & 0 deletions app/js/services/refs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module('kanoevents.services')
.factory('Refs', ['$cookies', '$firebase',
function($cookies, $firebase) {
var rootRef = new Firebase($cookies.rootRef || 'https://kano-events.firebaseio.com');

// define every standard ref used application wide
return {
root: rootRef
};
}
]);
23 changes: 23 additions & 0 deletions app/shared/head.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
meta(name='HandheldFriendly' content='True')
meta(name='MobileOptimized' content='320')
meta(name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no')

base(href="/")

// CDN provided
link(href='//fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css')

//build:css /dist/style.css
link(rel="stylesheet" href="/css/styles.css" type="text/css")
// endbuild
// CDN provided scripts
script(type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js")
script(type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js")
script(type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js")
script(type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-cookies.js")
script(type="text/javascript" src="https://cdn.firebase.com/js/client/2.2.7/firebase.js")
script(type="text/javascript" src="https://cdn.firebase.com/libs/angularfire/1.1.2/angularfire.min.js")
// endcdn
script(type="text/javascript" src="/js/index.js")
43 changes: 43 additions & 0 deletions app/styles/reset.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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

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


Empty file added app/styles/styles.styl
Empty file.
36 changes: 36 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var development = {
firebase: {
rootRefUrl: 'https://kano-events.firebaseio.com/',
secretKey: 'T7GOegMcPPxfYDYhWugSrd0JRbDykscjIlMSKVnC'
}
};

var test = {
firebase: {
rootRefUrl: 'https://kano-events.firebaseio.com/',
secretKey: 'T7GOegMcPPxfYDYhWugSrd0JRbDykscjIlMSKVnC'
}
};

var production = {
firebase: {
rootRefUrl: 'https://kano-events.firebaseio.com/',
secretKey: 'T7GOegMcPPxfYDYhWugSrd0JRbDykscjIlMSKVnC'
}
};

var staging = {
firebase: {
rootRefUrl: 'https://kano-events.firebaseio.com/',
secretKey: 'T7GOegMcPPxfYDYhWugSrd0JRbDykscjIlMSKVnC'
}
};

var config = {
development: development,
test: test,
production: production,
staging: staging
};

module.exports = config;
81 changes: 81 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
var browserify = require('browserify'),
bower = require('gulp-bower'),
concat = require('gulp-concat'),
gulp = require('gulp'),
gutil = require('gulp-util'),
jade = require('gulp-jade'),
stylus = require('gulp-stylus'),
nodemon = require('gulp-nodemon'),
path = require('path'),
source = require('vinyl-source-stream');

var paths = {
public: 'public/**',
jade: 'app/**/*.jade',
styles: 'app/styles/styles.styl',
scripts: 'app/**/*.js',
staticFiles: [
'!app/**/*.+(styl|css|js|jade)',
'app/**/*.*'
],
clientTests: [],
serverTests: ['test/server/**/*.js']
};

gulp.task('jade', function() {
gulp.src(paths.jade)
.pipe(jade())
.pipe(gulp.dest('./public/'));
});

gulp.task('styles', function () {
gulp
.src(paths.styles)
.pipe(stylus({
paths: [ path.join(__dirname, 'styles') ]
}))
.pipe(gulp.dest('./public/css'));
});

gulp.task('static-files',function(){
return gulp.src(paths.staticFiles)
.pipe(gulp.dest('public/'));
});

gulp.task('nodemon', function () {
nodemon({ script: 'index.js', ext: 'js', ignore: ['public/**','app/**','node_modules/**'] })
.on('restart', function () {
console.log('>> node restart');
});
});

gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(concat('index.js'))
.pipe(gulp.dest('./public/js'));
});

gulp.task('browserify', function() {
var b = browserify();
b.add('./app/js/application.js');
return b.bundle()
.on('success', gutil.log.bind(gutil, 'Browserify Rebundled'))
.on('error', gutil.log.bind(gutil, 'Browserify Error: in browserify gulp task'))
.pipe(source('index.js'))
.pipe(gulp.dest('./public/js'));
});

gulp.task('watch', function() {
gulp.watch(paths.jade, ['jade']);
gulp.watch(paths.styles, ['styles']);
gulp.watch(paths.scripts, ['browserify']);
});

gulp.task('bower', function() {
// return bower()
// .pipe(gulp.dest('public/lib/'));
});

gulp.task('build', ['bower', 'jade', 'styles', 'browserify', 'static-files']);
gulp.task('production', ['nodemon', 'build']);
gulp.task('default', ['nodemon', 'build', 'watch']);
55 changes: 55 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
global._ = require('lodash');
global.t = require('moment');

var cookieParser = require('cookie-parser'),
Firebase = require("firebase"),
env = process.env.NODE_ENV || 'development',
config = require('./config/config')[env],
routes = require('./api/routes'),
express = require('express'),
bodyParser = require('body-parser'),
app = express();

(function run(appdir, rootRefUrl) {
app.use(cookieParser());

app.dir = appdir;

// things to do on each request
app.use(function (req, res, next) {
// log each request in development environment
if(env !== 'production') console.log(t().format('HH:MM'), req.method, req.url, req.socket.bytesRead);
// tell the client what firebase to use
res.cookie('rootRef', rootRefUrl);

next();
});

// static files
app.use(express.static(app.dir + '/public'));

// Standard error handling
app.use(function(err, req, res, next){
console.error(err.stack);
res.status(500).send('Something broke!');
});

// to support JSON-encoded bodies
app.use(bodyParser.json());

// to support URL-encoded bodies
app.use(bodyParser.urlencoded({
extended: true
}));

routes(app, config);

var server = app.listen(process.env.PORT || 8888, function() {
console.log('Listening on port %d', server.address().port);
});

})(process.cwd(), config.firebase.rootRefUrl);

module.exports = app;


40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Kanoevents",
"version": "0.0.1",
"description": "An app that allows one to create an event and returns live commentary",
"main": "index.js",
"engines": {
"node": "0.10.31",
"npm": "1.4.23"
},
"scripts": {
"start": "node index.js"
},
"repository": {
"type": "git",
"url": ""
},
"author": "Ladi Adenusi",
"license": "Proprietary",
"homepage": "http://kano-events.herokuapp.com",
"dependencies": {
"body-parser": "^1.9.0",
"browserify": "^5.12.0",
"connect-livereload": "^0.4.0",
"cookie-parser": "^1.3.3",
"express": "^4.9.5",
"firebase": "2.2.0",
"gulp": "^3.8.7",
"gulp-bower": "0.0.7",
"gulp-concat": "^2.4.1",
"gulp-exit": "^0.0.2",
"gulp-jade": "^0.7.0",
"gulp-nodemon": "^1.0.4",
"gulp-stylus": "^2.0.1",
"gulp-util": "^3.0.1",
"jade": "^1.6.0",
"lodash": "^2.4.1",
"moment": "^2.8.2",
"vinyl-source-stream": "^1.1.0"
}
}
Empty file added public/css/styles.css
Empty file.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en" ng-app="Kanoevents"><head><title>Kano Events</title><meta name="HandheldFriendly" content="True"><meta name="MobileOptimized" content="320"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><base href="/"><!-- CDN provided--><link href="//fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css"><!--build:css /dist/style.css--><link rel="stylesheet" href="/css/styles.css" type="text/css"><!-- endbuild--><!-- CDN provided scripts--><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-cookies.js"></script><script type="text/javascript" src="https://cdn.firebase.com/js/client/2.2.7/firebase.js"></script><script type="text/javascript" src="https://cdn.firebase.com/libs/angularfire/1.1.2/angularfire.min.js"></script><!-- endcdn--><script type="text/javascript" src="/js/index.js"></script></head><body><div ng-view class="wrapper"></div></body></html>
Loading

0 comments on commit f1be7d9

Please sign in to comment.