/*jshint node:true*/
/* global require, module */
var path = require('path');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
    var config = require('./config/environment')(process.env.EMBER_ENV);

    var app = new EmberApp(defaults, {
        'ember-bootstrap': {
            importBootstrapCSS: false
        },
        sassOptions: {
            includePaths: [
                'node_modules/ember-osf/addon/styles',
                'bower_components/bootstrap-sass/assets/stylesheets',
                'bower_components/osf-style/sass'
            ]
        },
        inlineContent: {
            raven: {
                content: `<script src="https://cdn.ravenjs.com/3.5.1/ember/raven.min.js"></script>
                <script>
                    Raven.config("${config.sentryDSN}", {}).install();
                    Raven.debug=${process.env.EMBER_ENV === 'development' ? 'true' : 'false'};
                </script>`
            }
        },
        postcssOptions: {
            compile: {
                enabled: false
            },
            filter: {
                enabled: true,
                plugins: [{
                    module: require('autoprefixer'),
                    options: {
                        browsers: ['last 4 versions'],
                        cascade: false
                    }
                }, {
                    // Wrap progid declarations with double-quotes
                    module: require('postcss').plugin('progid-wrapper', () => {
                        return css =>
                            css.walkDecls(declaration => {
                                if (declaration.value.startsWith('progid')) {
                                    return declaration.value = `"${declaration.value}"`;
                                }
                            });
                    })
                }]
            }
        },
        // bable options included to fix issue with testing discover controller
        // http://stackoverflow.com/questions/32231773/ember-tests-passing-in-chrome-not-in-phantomjs
        babel: {
            optional: ['es6.spec.symbols'],
            includePolyfill: true
        }
    });

    // 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.

    // osf-style
    app.import(path.join(app.bowerDirectory, 'osf-style/vendor/prism/prism.css'));
    app.import(path.join(app.bowerDirectory, 'osf-style/page.css'));
    app.import(path.join(app.bowerDirectory, 'osf-style/css/base.css'));

    app.import(path.join(app.bowerDirectory, 'osf-style/img/cos-white2.png'), {
        destDir: 'img'
    });

    // app.import('bower_components/dropzone/dist/dropzone.js');
    app.import({
        development: path.join(app.bowerDirectory, 'dropzone/dist/dropzone.css'),
        production: path.join(app.bowerDirectory, 'dropzone/dist/min/dropzone.min.css')
    });

    app.import(path.join(app.bowerDirectory, 'jquery.tagsinput/src/jquery.tagsinput.js'));

     app.import({
        development: path.join(app.bowerDirectory, 'hint.css/hint.css'),
        production: path.join(app.bowerDirectory, 'hint.css/hint.css')
    });

    // Import component styles from addon
    app.import('vendor/assets/ember-osf.css');

    return app.toTree();
};

@@ -678,18 +678,105 @@
     
-content: %60
+enabled: process.env.EMBER_ENV !== 'development',%0A                content: %60%0A                    
 %3Cscr
@@ -864,16 +864,20 @@
     
+    
 %3Cscript%3E
 %0A   
@@ -872,37 +872,16 @@
 %3Cscript%3E
-%0A                    
 Raven.co
@@ -926,120 +926,8 @@
 l();
-%0A                    Raven.debug=$%7Bprocess.env.EMBER_ENV === 'development' ? 'true' : 'false'%7D;%0A                
 %3C/sc

Disable sentry in non-dev mode