Created
November 8, 2015 21:37
-
-
Save typeoneerror/ec8a96f0df5be70d4aef 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 | |
| }; | |
| console.log(deployTarget); | |
| 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' | |
| }); | |
| } | |
| console.log(ENV); | |
| // 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 pickFiles = require('broccoli-static-compiler'); | |
| var mergeTrees = require('broccoli-merge-trees'); | |
| var replace = require('broccoli-replace'); | |
| module.exports = function(defaults) { | |
| var env = EmberApp.env() || 'development'; | |
| var isProductionLikeBuild = ['production', 'staging'].indexOf(env) > -1; | |
| var fingerprintOptions = { | |
| enabled: true, | |
| extensions: ['js', 'css', 'png', 'jpg', 'gif'], | |
| }; | |
| switch (env) { | |
| case 'development': | |
| fingerprintOptions.prepend = 'http://localhost:4200/'; | |
| break; | |
| case 'staging': | |
| fingerprintOptions.prepend = 'TODO'; | |
| break; | |
| case 'production': | |
| fingerprintOptions.prepend = 'https://d14org02d2kfl8.cloudfront.net/'; | |
| break; | |
| } | |
| //-------------------// | |
| // Create Ember App! // | |
| //-------------------// | |
| var app = new EmberApp(defaults, { | |
| autoprefixer: { cascade: true }, | |
| emberCLIDeploy: { | |
| runOnPostBuild: (env === 'development') ? 'development-postbuid' : false, // returns the deployTarget | |
| shouldActivate: true // optionally call the activate hook on deploy | |
| }, | |
| hinting: process.env.EMBER_CLI_TEST_COMMAND || !isProductionLikeBuild, | |
| minifyCSS: { enabled: isProductionLikeBuild }, | |
| minifyJS: { enabled: isProductionLikeBuild }, | |
| sourcemaps: { enabled: !isProductionLikeBuild }, | |
| // @see http://www.ember-cli.com/#application-configuration | |
| storeConfigInMeta: false, | |
| 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/bootstrap-datepicker/dist/css/bootstrap-datepicker3.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/global-before.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 = pickFiles('bower_components/bootstrap-sass-official/assets/fonts', { | |
| srcDir: '/', | |
| files: ['bootstrap/*'], | |
| destDir: '/assets/fonts' | |
| }); | |
| var fontAwesome = pickFiles('bower_components/fontawesome', { | |
| srcDir: '/', | |
| files: ['fonts/*', 'css/*.css'], | |
| destDir: '/assets/fonts/fontawesome' | |
| }); | |
| var zeroClipboard = pickFiles('bower_components/zeroclipboard/dist', { | |
| srcDir: '/', | |
| files: ['ZeroClipboard.swf'], | |
| destDir: '/assets' | |
| }); | |
| var colorPicker = pickFiles('bower_components/bootstrapcolorpicker/dist', { | |
| srcDir: '/', | |
| files: ['css/*', 'img/bootstrap-colorpicker/*'], | |
| destDir: '/assets/bcp' | |
| }); | |
| //------------------------// | |
| // Merge trees and export // | |
| //------------------------// | |
| var trees = [ | |
| app.toTree(), | |
| bootstrapFonts, | |
| fontAwesome, | |
| zeroClipboard, | |
| colorPicker | |
| ]; | |
| return mergeTrees(trees); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment