Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaredoug committed Jul 29, 2014
0 parents commit 6da2358
Show file tree
Hide file tree
Showing 10 changed files with 297 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# generic (system) files/extensions we don't want
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
.idea/*
*.DS_Store
lib-cov
pids
logs
results

node_modules

#Actually, need to track these for site to run on Github Pages..
#bower_components
108 changes: 108 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
@toc
2. load grunt plugins
3. init
4. setup variables
5. grunt.initConfig
6. register grunt tasks
*/

'use strict';

module.exports = function(grunt) {

/**
Load grunt plugins
@toc 2.
*/
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');

/**
Function that wraps everything to allow dynamically setting/changing grunt options and config later by grunt task. This init function is called once immediately (for using the default grunt options, config, and setup) and then may be called again AFTER updating grunt (command line) options.
@toc 3.
@method init
*/
function init(params) {
/**
Project configuration.
@toc 5.
*/
grunt.initConfig({
concat: {
devCss: {
src: [],
dest: []
}
},
jshint: {
options: {
//force: true,
globalstrict: true,
//sub: true,
node: true,
loopfunc: true,
browser: true,
devel: true,
globals: {
angular: false,
$: false,
moment: false,
Pikaday: false,
module: false,
forge: false
}
},
beforeconcat: {
options: {
force: false,
ignores: ['**.min.js']
},
files: {
src: []
}
},
//quick version - will not fail entire grunt process if there are lint errors
beforeconcatQ: {
options: {
force: true,
ignores: ['**.min.js']
},
files: {
src: ['**.js']
}
}
},
uglify: {
options: {
mangle: false
},
build: {
files: {},
src: 'r-search.js',
dest: 'r-search.min.js'
}
}/*,
karma: {
unit: {
configFile: publicPathRelativeRoot+'config/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}
}*/
});


/**
register/define grunt tasks
@toc 6.
*/
// Default task(s).
grunt.registerTask('default', ['jshint:beforeconcatQ', 'uglify:build']);

}
init({}); //initialize here for defaults (init may be called again later within a task)

};
32 changes: 32 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
@toc
1. setup - whitelist, appPath, html5Mode
*/

'use strict';

angular.module('myApp', [
'ngRoute', 'ngSanitize', 'ngTouch', //additional angular modules
'o19s.splainer-search'
]).
config(['$routeProvider', '$locationProvider', '$compileProvider', function($routeProvider, $locationProvider, $compileProvider) {
/**
setup - whitelist, appPath, html5Mode
@toc 1.
*/
$locationProvider.html5Mode(false); //can't use this with github pages / if don't have access to the server

// var staticPath ='/';
var staticPath;
// staticPath ='/angular-services/splainer-search/'; //local
staticPath ='/'; //nodejs (local)
// staticPath ='/splainer-search/'; //gh-pages
var appPathRoute ='/';
var pagesPath =staticPath+'pages/';


$routeProvider.when(appPathRoute+'home', {templateUrl: pagesPath+'home/home.html'});

$routeProvider.otherwise({redirectTo: appPathRoute+'home'});

}]);
26 changes: 26 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "splainer-search-demo",
"version": "0.0.0",
"authors": [
"Doug Turnbull <[email protected]>"
],
"description": "Demo",
"keywords": [
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular":"~1.2.0",
"angular-sanitize":"~1.2.0",
"angular-route":"~1.2.0",
"angular-touch":"~1.2.0"
},
"devDependencies": {
}
}
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">

<title>splainer-search</title>

</head>
<body>
<div ng-view></div>

<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/angular-route/angular-route.min.js"></script>
<script type="text/javascript" src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script type="text/javascript" src="bower_components/angular-touch/angular-touch.min.js"></script>

<script type="text/javascript" src="r-search.js"></script>
<!--<script type="text/javascript" src="r-search.min.js"></script>-->

<script type="text/javascript" src="app.js"></script>

<script type="text/javascript" src="pages/home/HomeCtrl.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"author": "",
"name": "splainer-search-demo",
"version": "0.0.0",
"description": "",
"homepage": "",
"dependencies": {
},
"devDependencies": {
"express":"~3.4.4",
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-jshint": "~0.7.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": "",
"engines":{
"node":"0.10.10"
}
}
8 changes: 8 additions & 0 deletions pages/home/HomeCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*/

'use strict';

angular.module('myApp').controller('HomeCtrl', ['$scope', 'o19sRSearch', function($scope, o19sRSearch) {
//TODO - put any directive code here
}]);
3 changes: 3 additions & 0 deletions pages/home/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div ng-controller='HomeCtrl'>
<!-- TODO: place directive call here -->
</div>
20 changes: 20 additions & 0 deletions r-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
@fileOverview
@toc
*/

'use strict';

angular.module('o19s.splainer-search', [])
.factory('o19sRSearch', [ function () {

//public methods & properties
var self ={
};

//private methods and properties - should ONLY expose methods and properties publicly (via the 'return' object) that are supposed to be used; everything else (helper methods that aren't supposed to be called externally) should be private.

return self;
}]);
34 changes: 34 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

var fs =require('fs'); //for image upload file handling

var express = require('express');
var app = express();

var port =3000;
var host ='localhost';
var serverPath ='/';
var staticPath ='/';

var staticFilePath = __dirname + serverPath;
// remove trailing slash if present
if(staticFilePath.substr(-1) === '/'){
staticFilePath = staticFilePath.substr(0, staticFilePath.length - 1);
}

app.configure(function(){
// compress static content
app.use(express.compress());
app.use(serverPath, express.static(staticFilePath)); //serve static files

app.use(express.bodyParser()); //for post content / files - not sure if this is actually necessary?
});

//catch all route to serve index.html (main frontend app)
app.get('*', function(req, res){
res.sendfile(staticFilePath + staticPath+ 'index.html');
});

app.listen(port);

console.log('Server running at http://'+host+':'+port.toString()+'/');

0 comments on commit 6da2358

Please sign in to comment.