Skip to content

Commit

Permalink
Merge pull request #107 from anotheri/feature/some-improvements
Browse files Browse the repository at this point in the history
Some improvements
  • Loading branch information
niftylettuce committed Feb 21, 2015
2 parents e292445 + 349d0f2 commit b08504c
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -103,9 +103,11 @@ dwsync.xml
# ------------------------------------------------------------------------------
assets/bower/
assets/dist/
bower_components/
assets/public/css/*.css
assets/public/css/maps/
assets/public/bower/
assets/public/fonts/font-awesome/
bower_components/
.bower-cache/
.bower-registry/
.bower-tmp/
Expand Down
3 changes: 3 additions & 0 deletions app/views/layout.jade
Expand Up @@ -10,6 +10,9 @@ html.no-js
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
meta(name='description', content='This rapid MVP was built with Eskimo.')
meta(name='viewport', content='width=device-width, initial-scale=1')
if settings.server.env !== 'production'
meta(name='robots' content='noindex')
meta(name='googlebot' content='noindex')
<!-- build:css /css/app.css -->
block stylesheets
link(rel='stylesheet', href='/css/style.css')
Expand Down
24 changes: 23 additions & 1 deletion bin/eskimo.js
Expand Up @@ -20,6 +20,8 @@ var pluralize = require('pluralize');
_.pluralize = pluralize.plural;
_.singularize = pluralize.singular;

var Chance = require('chance');

var multiline = require('multiline');
var async = require('async');
var fs = require('fs');
Expand Down Expand Up @@ -157,7 +159,6 @@ function create(dirname) {
},

'Readme.md': function createReadmeFile(callback) {

var readmePath = path.resolve(path.join(dirname, 'Readme.md'));

fs.readFile(path.join(templates, 'Readme.md'), 'utf8', function(err, data) {
Expand All @@ -174,6 +175,27 @@ function create(dirname) {

});

},


'config.js': function createConfigFile(callback) {

var configPath = path.resolve(path.join(dirname, 'boot', 'config.js'));

fs.readFile(path.join(templates, 'boot', 'config.js'), 'utf8', function(err, data) {

if (err) {
return callback(err);
}

data = _.template(data)({
name: path.basename(dirname),
chance: new Chance()
});

fs.writeFile(configPath, data, callback);

});

},

Expand Down
6 changes: 6 additions & 0 deletions boot/local.js
Expand Up @@ -22,6 +22,12 @@ exports = module.exports = function() {
pass: 'abc123'
}
}
},
// less: {
// enabled: false // disable less middleware, if you use gulp watch
// },
liveReload: {
port: 35729
}
};
};
Expand Down
6 changes: 4 additions & 2 deletions etc/init/02-middleware.js
Expand Up @@ -23,8 +23,10 @@ exports = module.exports = function(IoC, logger, settings, policies) {

if (settings.server.env === 'development') {

// less middleware
app.use(lessMiddleware(settings.less.path, settings.less.options));
if (settings.less.enabled) {
// less middleware
app.use(lessMiddleware(settings.less.path, settings.less.options));
}

// jade-amd templates
app.use(settings.jade.amd.path, jadeAmd.jadeAmdMiddleware(settings.jade.amd.options));
Expand Down
2 changes: 1 addition & 1 deletion etc/init/03-sessions.js
Expand Up @@ -28,7 +28,7 @@ exports = module.exports = function(IoC, settings, sessions, User, policies) {
// support live reload
// (note this must come after sessions)
// <http://stackoverflow.com/a/26740588>
if (settings.server.env === 'development')
if (settings.server.env === 'development' && settings.liveReload)
app.all(policies.notApiRouteRegexp, connectLiveReload(settings.liveReload));

// add support for authentication
Expand Down
10 changes: 9 additions & 1 deletion gulpfile.js
Expand Up @@ -25,6 +25,7 @@ var override = require('gulp-rev-css-url');
var filter = require('gulp-filter');
var livereload = require('tiny-lr')();
var nodemon = require('gulp-nodemon');
var autoprefixer = require('gulp-autoprefixer');
//var bowerJSON = require('./bower.json');
//var googlecdn = require('gulp-google-cdn');

Expand Down Expand Up @@ -64,12 +65,19 @@ gulp.task('jshint', function() {
.pipe(jshint.reporter(stylish));
});


gulp.task('less', function() {
return gulp
.src([
'./assets/public/css/style.less'
])
.pipe(less().on('error', logger.error))
.pipe(sourcemaps.init())
.pipe(less().on('error', logger.error))
.pipe(autoprefixer({
// browsers: ['last 2 versions'],
cascade: true,
remove: true
}))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./assets/public/css'));
});
Expand Down
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -43,11 +43,13 @@
"homepage": "https://github.com/niftylettuce/eskimo",
"dependencies": {
"async": "^0.9.0",
"autoprefixer-core": "^5.1.5",
"basic-auth": "^1.0.0",
"body-parser": "^1.3.0",
"bootable": "^0.2.3",
"bootable-environment": "^0.2.0",
"chalk": "^0.5.1",
"chance": "^0.7.3",
"commander": "^2.2.0",
"compression": "^1.0.6",
"connect": "^3.1.1",
Expand Down Expand Up @@ -102,6 +104,7 @@
"cookie": "^0.1.2",
"del": "^0.1.3",
"gulp": "^3.8.8",
"gulp-autoprefixer": "^2.1.0",
"gulp-bower": "0.0.6",
"gulp-csso": "^0.2.9",
"gulp-exit": "0.0.2",
Expand Down
107 changes: 88 additions & 19 deletions boot/config.js → templates/boot/config.js
Expand Up @@ -2,6 +2,7 @@
// # config

var path = require('path');
var autoprefixer = require('autoprefixer-core');

var parentDir = path.join(__dirname, '..');
var appDir = path.join(parentDir, 'app');
Expand All @@ -17,7 +18,7 @@ var maxAge = 24 * 60 * 60 * 1000;

exports = module.exports = function() {

return {
var config = {

defaults: {
basicAuth: {
Expand Down Expand Up @@ -82,8 +83,8 @@ exports = module.exports = function() {
messageFormat: 'text'
},
session: {
secret: 'igloo-change-me',
key: 'igloo',
secret: '<%= chance.string({length: 130}) %>',
key: '<%= _.slugify(name) %>',
cookie: {
maxAge: maxAge
},
Expand All @@ -108,7 +109,7 @@ exports = module.exports = function() {
options: {}
}
},
cookieParser: 'igloo-change-me',
cookieParser: '<%= chance.string({length: 130}) %>',
csrf: {
enabled: true,
options: {
Expand Down Expand Up @@ -147,19 +148,22 @@ exports = module.exports = function() {
slack: false
},
less: {
enabled: true,
path: publicDir,
options: {
force: true
force: true,
postprocess: {
css: function(css, req) {
return autoprefixer.process(css).css;
}
}
}
},
jade: {
amd: {
path: '/js/tmpl/',
options: {}
}
},
liveReload: {
port: 35729
}
},

Expand All @@ -169,8 +173,12 @@ exports = module.exports = function() {
env: 'test',
port: 5000
},
mongo: {
dbname: '<%= _.slugify(name) %>_test',
db: '<%= _.slugify(name) %>_test' // keep for winston logger
},
redis: {
prefix: 'igloo_test'
prefix: '<%= _.slugify(name) %>_test',
},
logger: {
'console': false,
Expand All @@ -180,32 +188,91 @@ exports = module.exports = function() {

development: {
cache: true,
url: 'http://localhost:3000',
url: 'http://<%= _.slugify(name) %>-dev.clevertech.biz',
server: {
env: 'development',
port: 3000,
},
mongo: {
dbname: 'igloo-development',
db: 'igloo-development' // keep for winston logger
dbname: '<%= _.slugify(name) %>_development',
db: '<%= _.slugify(name) %>_development' // keep for winston logger
},
knex: {
debug: true,
connection: {
host: '127.0.0.1',
user: 'root',
password: '',
database: 'igloo_development'
database: '<%= _.slugify(name) %>_development'
}
},
redis: {
prefix: 'igloo-development'
prefix: '<%= _.slugify(name) %>_development'
}
},

staging: {
cache: true,
url: 'http://<%= _.slugify(name) %>-stag.clevertech.biz',
password: {
minStrength: 1,
limitAttempts: true
},
views: {
dir: path.join(assetsDir, 'dist'),
},
publicDir: path.join(assetsDir, 'dist'),
showStack: false,
updateNotifier: {
enabled: false,
},
server: {
env: 'staging',
port: 3080,
cluster: true
},
mongo: {
dbname: '<%= _.slugify(name) %>_staging',
db: '<%= _.slugify(name) %>_staging' // keep for winston logger
},
knex: {
connection: {
host: '127.0.0.1',
user: 'root',
password: '',
database: '<%= _.slugify(name) %>_staging'
}
},
redis: {
prefix: '<%= _.slugify(name) %>_staging'
},
output: {
colorize: false
},
logger: {
'console': true,
requests: true,
mongo: false,
file: false
/*
// <https://github.com/flatiron/winston#file-transport>
file: {
filename: '/var/log/igloo.log',
// TODO: maxsize
// TODO: maxFiles
timestamp: true
}
*/
},
s3: {
bucket: 'requidity-stag'
}
},

production: {
cache: true,
url: 'http://localhost:3080',
// FIXME
url: 'http://<%= _.slugify(name) %>-prod.clevertech.biz',
password: {
minStrength: 1,
limitAttempts: true
Expand All @@ -224,19 +291,19 @@ exports = module.exports = function() {
cluster: true
},
mongo: {
dbname: 'igloo-production',
db: 'igloo-production' // keep for winston logger
dbname: '<%= _.slugify(name) %>_production',
db: '<%= _.slugify(name) %>_production' // keep for winston logger
},
knex: {
connection: {
host: '127.0.0.1',
user: 'root',
password: '',
database: 'igloo_production'
database: '<%= _.slugify(name) %>_production'
}
},
redis: {
prefix: 'igloo_production'
prefix: '<%= _.slugify(name) %>_production'
},
output: {
colorize: false
Expand All @@ -260,6 +327,8 @@ exports = module.exports = function() {

};

return config;

};

exports['@singleton'] = true;

0 comments on commit b08504c

Please sign in to comment.