Created
November 11, 2015 18:29
-
-
Save typeoneerror/e093c87d725edd7d047c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint node: true */ | |
var _ = require('lodash'); | |
module.exports = function(deployTarget) { | |
var ENV = { | |
build: {} | |
}; | |
var s3 = { | |
accessKeyId: process.env.AWS_ACCESS_KEY, | |
secretAccessKey: process.env.AWS_SECRET_KEY, | |
region: 'us-west-2' | |
}; | |
var redis = { | |
keyPrefix: 'doki', | |
allowOverwrite: true, | |
host: 'localhost', | |
port: 6379 | |
}; | |
if (deployTarget === 'development-postbuild') { | |
ENV.plugins = ['redis']; | |
ENV.build.environment = 'development'; | |
ENV.redis = _.merge(redis, { | |
revisionKey: '__development__', | |
distDir: function(context) { | |
return context.commandOptions.buildDir; | |
} | |
}); | |
} | |
if (deployTarget === 'staging') { | |
ENV.build.environment = 'staging'; | |
ENV.s3 = _.merge(s3, { | |
bucket: 'doki-staging' | |
}); | |
} | |
if (deployTarget === 'production') { | |
ENV.build.environment = 'production'; | |
ENV.s3 = _.merge(s3, { | |
bucket: 'doki-production' | |
}); | |
} | |
// Note: if you need to build some configuration asynchronously, you can return | |
// a promise that resolves with the ENV object instead of returning the | |
// ENV object synchronously. | |
return ENV; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global require, module */ | |
var EmberApp = require('ember-cli/lib/broccoli/ember-app'); | |
var Funnel = require('broccoli-funnel'); | |
var MergeTrees = require('broccoli-merge-trees'); | |
module.exports = function(defaults) { | |
var env = EmberApp.env() || 'development'; | |
var config = require('./config/environment')(env); | |
var isProductionLikeBuild = ['production', 'staging'].indexOf(env) > -1; | |
var assetEndpoint = ''; | |
var fingerprintOptions = { | |
enabled: true, | |
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'] | |
}; | |
switch (env) { | |
case 'development': | |
assetEndpoint = 'http://localhost:4200/'; | |
fingerprintOptions.customHash = null; | |
break; | |
case 'staging': | |
assetEndpoint = 'TODO'; | |
break; | |
case 'production': | |
assetEndpoint = 'https://d14org02d2kfl8.cloudfront.net/'; | |
break; | |
} | |
fingerprintOptions.prepend = assetEndpoint; | |
//-------------------// | |
// Create Ember App! // | |
//-------------------// | |
var app = new EmberApp(defaults, { | |
autoprefixer: { cascade: true }, | |
emberCLIDeploy: { | |
runOnPostBuild: (env === 'development') ? 'development-postbuild' : false, // returns the deployTarget | |
shouldActivate: true // optionally call the activate hook on deploy | |
}, | |
fingerprint: fingerprintOptions, | |
hinting: process.env.EMBER_CLI_TEST_COMMAND || !isProductionLikeBuild, | |
inlineContent: { | |
'inline-body-footer': { | |
file: './config/includes/footer.js', | |
postProcess: function(content) { | |
return content.replace(/\{\{ZERO_CLIPBOARD_PATH\}\}/g, assetEndpoint + 'assets/') | |
.replace(/\{\{FILEPICKER_API_KEY\}\}/g, config.APP.FILEPICKER_API_KEY); | |
} | |
} | |
}, | |
minifyCSS: { enabled: isProductionLikeBuild }, | |
minifyJS: { enabled: isProductionLikeBuild }, | |
sourcemaps: { enabled: !isProductionLikeBuild }, | |
storeConfigInMeta: false, // @see http://www.ember-cli.com/#application-configuration | |
tests: process.env.EMBER_CLI_TEST_COMMAND || !isProductionLikeBuild | |
}); | |
// Use `app.import` to add additional libraries to the generated | |
// output files. | |
// | |
// If you need to use different assets in different | |
// environments, specify an object as the first parameter. That | |
// object's keys should be the environment name and the values | |
// should be the asset to use in that environment. | |
// | |
// If the library that you are including contains AMD or ES6 | |
// modules that you would like to import into your application | |
// please specify an object with the list of modules as keys | |
// along with the exports of each module as its value. | |
//--------// | |
// Styles // | |
//--------// | |
app.import('bower_components/animate.css/animate.min.css'); | |
app.import('bower_components/toastr/toastr.min.css'); | |
app.import('bower_components/bootstrapcolorpicker/dist/css/bootstrap-colorpicker.css'); | |
app.import('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css'); | |
app.import('vendor/fonts/ss-glyphish-outlined/ss-glyphish-outlined.css'); | |
app.import('vendor/redactor/lib/redactor.css'); | |
//------------// | |
// Javascript // | |
//------------// | |
app.import({ | |
development: 'vendor/logger/logger.development.js', | |
production: 'vendor/logger/logger.production.js' | |
}); | |
app.import('vendor/modernizr.min.js'); | |
app.import('bower_components/lodash/lodash.min.js'); | |
app.import('bower_components/moment/min/moment.min.js'); | |
app.import('bower_components/Sortable/Sortable.min.js'); | |
app.import('bower_components/toastr/toastr.min.js'); | |
app.import('bower_components/jquery.hotkeys/jquery.hotkeys.js'); | |
app.import('bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.min.js'); | |
app.import('bower_components/bootstrapcolorpicker/dist/js/bootstrap-colorpicker.min.js'); | |
app.import('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js'); | |
app.import('bower_components/zeroclipboard/dist/ZeroClipboard.min.js'); | |
app.import('bower_components/urijs/src/URI.min.js'); | |
app.import('vendor/redactor/lib/redactor.js'); | |
['filepicker', 'fullscreen', 'table', 'video'].forEach(function(plugin) { | |
app.import('vendor/redactor/plugins/' + plugin + '.js'); | |
}) | |
app.import('vendor/global-after.js'); | |
//--------// | |
// Assets // | |
//--------// | |
var bootstrapFonts = new Funnel('bower_components/bootstrap-sass-official/assets/fonts', { | |
srcDir: '/bootstrap', | |
destDir: '/assets/fonts' | |
}); | |
var fontAwesome = new Funnel('bower_components/fontawesome', { | |
srcDir: '/fonts', | |
destDir: '/assets/fonts' | |
}); | |
var zeroClipboard = new Funnel('bower_components/zeroclipboard/dist', { | |
srcDir: '/', | |
files: ['ZeroClipboard.swf'], | |
destDir: '/assets' | |
}); | |
var colorPicker = new Funnel('bower_components/bootstrapcolorpicker/dist', { | |
srcDir: '/img', | |
destDir: '/img' | |
}); | |
var ssFonts = new Funnel('vendor/fonts', { | |
srcDir: '/ss-glyphish-outlined', | |
destDir: '/assets' | |
}); | |
//------------------------// | |
// Merge trees and export // | |
//------------------------// | |
var trees = [ | |
app.toTree(), | |
bootstrapFonts, | |
fontAwesome, | |
zeroClipboard, | |
colorPicker, | |
ssFonts | |
]; | |
return new MergeTrees(trees); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment