Ejemplo n.º 1
0
// Config
var requireJsRuntimeConfig = vm.runInNewContext(fs.readFileSync('src/app/require.config.js') + '; require;');
    requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
        out: 'scripts.js',
        baseUrl: './src',
        name: 'app/startup',
        paths: {
            requireLib: 'bower_modules/requirejs/require'
        },
        include: [
            'requireLib',
            'components/nav-bar/nav-bar',
            'components/home-page/home',
            'components/products/products',
            'components/contact/contact',
            'components/blog/blog',
            'components/info/info',

        ],
        insertRequire: ['app/startup'],
        bundles: {
          'about': ['text!components/about-page/about.html']
            // If you want parts of the site to load on demand, remove them from the 'include' list
            // above, and group them into bundles here.
            // 'bundle-name': [ 'some/module', 'another/module' ],
            // 'another-bundle-name': [ 'yet-another-module' ]
        }
    });

// Discovers all AMD dependencies, concatenates together all required .js files, minifies them
gulp.task('js', function () {
Ejemplo n.º 2
0
// Config
var requireJsRuntimeConfig = vm.runInNewContext(fs.readFileSync('src/app/require.config.js') + '; require;');
    requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
        out: 'scripts.js',
        baseUrl: './src',
        name: 'app/startup',
        paths: {
            requireLib: 'bower_modules/requirejs/require'
        },
        include: [
            'requireLib',
        ],
        insertRequire: ['app/startup'],
        bundles: {
            // If you want parts of the site to load on demand, remove them from the 'include' list
            // above, and group them into bundles here.
            // 'bundle-name': [ 'some/module', 'another/module' ],
            // 'another-bundle-name': [ 'yet-another-module' ]
            'home':['components/home-page/home'],
            'clock':['components/clock/clock'],
            'refresh':['components/refresh/refresh'],
            'hsstatusdevice':['components/hsstatusdevice/hsstatusdevice'],
            'hsdevice':['components/hsdevice/hsdevice'],
            'hsthermostat':['components/hsthermostat/hsthermostat'],
            'staticimage':['components/staticimage/staticimage'],
            'weather':['components/weather/weather']
        }
    });


Ejemplo n.º 3
0
    gutil.log(msg);
    throw msg;
}

writeBuildConfig(args.config);
var layout = loadLayout(args.layout, args.config);
layout.version = gitRev.short();

gutil.log(
    'Building ' + chalk.white(args.layout) +
    ' configured with ' + chalk.white(args.config) + ' ...'
);

layout.requireJsOptimizerConfig = merge(
    require(defaults.requireConfig),
    defaults.optimizerConfig,
    layout.optimizerConfig
);
/* End Parse Arguments */

/* Gulp Tasks (all tasks are layout-specific, based on the arguments parsed above) */
gulp.task('default', ['html'], function () {
    gutil.log('');
});

gulp.task('html', ['js', 'css', 'themes'], function () {
    // restore the build config to return nothing so it doesn't break
    // automated or local testing
    writeBuildConfig(null);
    var piwikScript = getPiwikScript();
Ejemplo n.º 4
0
 _game.team     = _.each(res.team, function(team, key){ res.team[key] = merge(templateTeam, team); }) && res.team;
Ejemplo n.º 5
0
 _game.question = _.each(res.question, function(question, key){ res.question[key] = merge(templateQuestion, question); }) && res.question;
Ejemplo n.º 6
0
// Gulp and plugins
var gulp = require('gulp'), rjs = require('gulp-requirejs-bundler'), concat = require('gulp-concat'), clean = require('gulp-clean'),
    replace = require('gulp-replace'), uglify = require('gulp-uglify'), htmlreplace = require('gulp-html-replace');

// Config
var requireJsRuntimeConfig = vm.runInNewContext(fs.readFileSync('src/app/require.config.js') + '; require;');
    requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
        out: 'scripts.js',
        baseUrl: './src',
        name: 'app/startup',
        paths: {
            requireLib: 'bower_modules/requirejs/require'
        },
        include: [
            'requireLib',
            'components/nav-bar/nav-bar',
            'components/job-preview/job-preview'
        ],
        insertRequire: ['app/startup'],
        bundles: {
            // If you want parts of the site to load on demand, remove them from the 'include' list
            // above, and group them into bundles here.
            // 'bundle-name': [ 'some/module', 'another/module' ],
            // 'another-bundle-name': [ 'yet-another-module' ]
        }
    });

// Discovers all AMD dependencies, concatenates together all required .js files, minifies them
gulp.task('js', function () {
    return rjs(requireJsOptimizerConfig)
        .pipe(uglify({ preserveComments: 'some' }))
        .pipe(gulp.dest(output));
Ejemplo n.º 7
0
 _game.getQuestion({index: data.index}, function Game_getQuestion_callback(err, question)
 {
   // perform callback
   socket.write({ '_:callback': {hash: data.callback, err: err, data: merge(templateQuestion, question)} });
 });
Ejemplo n.º 8
0
    requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
        out: 'scripts.js',
        baseUrl: './src',
        name: 'app/startup',
        paths: {
            requireLib: 'bower_modules/requirejs/require',
            "tinymce-themes":       "bower_modules/tinymce/themes/modern/theme",
            "tinymce-advlist":      "bower_modules/tinymce/plugins/advlist/plugin",
            "tinymce-autolink":     "bower_modules/tinymce/plugins/autolink/plugin",
            "tinymce-lists":        "bower_modules/tinymce/plugins/lists/plugin",
            "tinymce-link":         "bower_modules/tinymce/plugins/link/plugin",
            "tinymce-image":        "bower_modules/tinymce/plugins/image/plugin",
            "tinymce-charmap":      "bower_modules/tinymce/plugins/charmap/plugin",
            "tinymce-preview":      "bower_modules/tinymce/plugins/preview/plugin",
            "tinymce-anchor":       "bower_modules/tinymce/plugins/anchor/plugin",
            "tinymce-sr":           "bower_modules/tinymce/plugins/searchreplace/plugin",
            "tinymce-vb":           "bower_modules/tinymce/plugins/visualblocks/plugin",
            "tinymce-code":         "bower_modules/tinymce/plugins/code/plugin",
            "tinymce-fullscreen":   "bower_modules/tinymce/plugins/fullscreen/plugin",
            "tinymce-insertdt":     "bower_modules/tinymce/plugins/insertdatetime/plugin",
            "tinymce-table":        "bower_modules/tinymce/plugins/table/plugin",
            "tinymce-contextmenu":  "bower_modules/tinymce/plugins/contextmenu/plugin",
            "tinymce-paste":        "bower_modules/tinymce/plugins/paste/plugin"

        },
        include: [
            'requireLib',
            "tinymce-themes",
            "tinymce-advlist",
            "tinymce-autolink",
            "tinymce-lists",
            "tinymce-link",
            "tinymce-image",
            "tinymce-charmap",
            "tinymce-preview",
            "tinymce-anchor",
            "tinymce-sr",
            "tinymce-vb",
            "tinymce-code",
            "tinymce-fullscreen",
            "tinymce-insertdt",
            "tinymce-table",
            "tinymce-contextmenu",
            "tinymce-paste",
            'components/nav-bar/nav-bar',
            'components/upcoming-events/upcoming-events',
            'components/announcements/announcements',
            'components/events-list/events-list',
            'components/home-page/home-page',
            'components/document-list/document-list',
            'components/data-objects/data-object.js',
            'components/data-objects/announcement-do.js',
            'components/data-objects/date-time-do.js',
            'components/data-objects/schedule-do.js',
            'components/data-objects/event-do.js',
            'components/data-objects/shoot-do.js'
        ],
        insertRequire: ['app/startup'],
        bundles: {
            'about-stuff': ['components/about-page/about-page', 'components/club-board/club-board'],
            'benefit-stuff': ['text!components/benefit-page/benefit.html'],
            'lessons-stuff': ['components/lessons-page/lessons-page'],
            'events-stuff': ['components/events-page/events-page'],
            'membership-stuff': ['components/membership-page/membership-page'],
            'directions-stuff': ['text!components/directions-page/directions-page.html'],
            'members-stuff': ['components/members-page/members-page', 'components/message-center-page/message-center-page',
                'components/forgot-password-page/forgot-password-page', 'components/profile-page/profile-page',
                'components/change-password/change-password'],
            'shoot-page-stuff': ['components/shoot-page/shoot-page'],
            'viewer-page-stuff': ['components/viewer-page/viewer-page']
        }
    });
Ejemplo n.º 9
0
var requireJsRuntimeConfig = vm.runInNewContext(fs.readFileSync('src/app/require.config.js') + '; require;');
    requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
        out: 'scripts.js',
        baseUrl: './src',
        name: 'app/startup',
        paths: {
            requireLib: '../node_modules/requirejs/require'
        },
        include: [
            'requireLib',
            'components/app/app',
            'components/nav-bar/nav-bar',
            'components/main-map/main-map',
            'components/side-list/side-list',
            'components/detail-view/detail-view',
            'components/favorite-view/favorite-view',
            'components/yelp-details/yelp-details',
            'components/favorite-list-view/favorite-list-view',
            'components/footer-bar/footer-bar',
            'pages/home/home',
            'pages/about/about'
        ],
        insertRequire: ['app/startup'],
        bundles: {
            // If you want parts of the site to load on demand, remove them from the 'include' list
            // above, and group them into bundles here.
            // 'bundle-name': [ 'some/module', 'another/module' ],
            // 'another-bundle-name': [ 'yet-another-module' ]
            // 'about-page': [ 'pages/about/about' ]
        }
    });
Ejemplo n.º 10
0
/**
 * Wraps provided adapter with response
 * and offers flexible api function
 *
 * Signature:
 * response([code], [content[, options]])
 *
 * @this  agnostic.options
 * @param {function} adapter - server specific adapter that consumer normalized response call
 * @param {object|function} response - server specific response object (or function n Hapi's case)
 * @param {object} request - server specific request object
 * @param {number} [code] - http code for the response
 * @param {string|object|array} [content] - content to output with the response
 * @param {object} [options] - extra options to augment response object with
 */
function wrapResponse(adapter, response, request, code, content, options)
{
  var contentType, contentMimeType;

  // requires magic
  if (arguments.length < 6)
  {
    // case 1. `code` is omitted
    if (typeOf(code) != 'number')
    {
      options = content;
      content = code;
      code    = this.response.statusCode;
    }

    // case 2. no content
    if (typeof content == 'undefined')
    {
      // use default content-type
      contentMimeType = this.response.contentType;
      content         = http.STATUS_CODES[code] || code.toString();
    }
  }

  // case 3. no options
  if (!options)
  {
    options = {};
  }

  // no content for HEAD requests
  if (request.method == 'HEAD')
  {
    content = '';
  }
  else
  {
    // should be separate function?
    contentType = typeOf(content);

    // guess mime-type
    contentMimeType = contentMimeType || this.contentMimeTypes[contentType] || this.response.contentType;

    // make content string
    if (contentType != 'string')
    {
      if (typeof(this.stringifiers[contentType]) == 'function')
      {
        // TODO: either add catch here, or remove from parsers
        content = this.stringifiers[contentType](content);
      }
      else if (typeof(this.stringifiers[contentType]) == 'string')
      {
        content = this.stringifiers[contentType];
      }
      else
      {
        this.logger.warn({message: 'Unable to find stringifiers for non string content type', contentType: contentType});
        // poor man's stringifier
        content = content.toString();
      }
    }

    // adjust options
    options = merge({
      headers: {
        'content-type': contentMimeType,
        // TODO: multibyte and Buffers
        'content-length': Buffer.byteLength(content, 'utf8')
      }}, options);
  }

  // always have headers defined
  options.headers = options.headers || {};

  // do the ting
  adapter.call(this, response, code, content, options);
}
Ejemplo n.º 11
0
var path       = require('path')
  , glob       = require('glob')
  , merge      = require('deeply')
  , rawBody    = require('raw-body')
  , asynckit   = require('asynckit')
  , hyperquest = require('hyperquest')
  , agnostic   = require('../')
  ;

// augment agnostic defaults for tests
agnostic.defaults = merge(agnostic.defaults, {request: {bodyMaxLength: 100}});

// expose suite methods
var common = module.exports =
{
  server: {
    endpoint: '/endpoint',
    port    : 56789
  },

  // shared methods
  requestHandler: requestHandler,

  sendRequest: sendRequest,
  sendAllRequests: sendAllRequests,
  sendRequestByName: sendRequestByName,

  // test requests
  requests: {}
};
module.exports = function (configuration, environment) {
    configuration = merge(configuration || {});
    configuration.data = configuration.data || {};
    environment = environment || process.env;

    Object.keys(environment).forEach(function (key) {
        switch(key.toLowerCase()) {
            case 'ms_mobileloglevel':
                configuration.logging.level = environment[key];
                break;

            case 'sqlconnstr_ms_tableconnectionstring':
            case 'sqlazureconnstr_ms_tableconnectionstring':
            case 'ms_tableconnectionstring':
                configuration.data.connectionString = environment[key];
                break;

            case 'ms_tableschema':
                configuration.data.schema = environment[key];
                break;

            case 'ms_dynamicschema':
                configuration.data.dynamicSchema = parseBoolean(environment[key]);
                break;

            case 'ema_runtimeurl':
                configuration.auth.gatewayUrl = environment[key];
                break;

            case 'website_auth_signing_key':
                configuration.auth.secret = environment[key];
                break;

            case 'ms_mobileappname':
            case 'ms_mobileservicename':
            case 'website_site_name':
                configuration.name = environment[key];
                break;

            case 'ms_crossdomainwhitelist':
                environment[key].split(',').forEach(function (origin) {
                    configuration.cors.hostnames.push(origin);
                });
                break;

            case 'ms_notificationhubname':
                configuration.notifications.hubName = environment[key];
                break;

            case 'customconnstr_ms_notificationhubconnectionstring':
            case 'ms_notificationhubconnectionstring':
                configuration.notifications.connectionString = environment[key];
                break;

            case 'ms_debugmode':
                configuration.debug = parseBoolean(environment[key]);
                break;

            case 'ms_disableversionheader':
                if(parseBoolean(environment[key]))
                    configuration.version = undefined;
                break;

            case 'ms_skipversioncheck':
                configuration.skipVersionCheck = parseBoolean(environment[key]);
                break;

            case 'website_hostname':
                // using website_hostname to determine that we are hosted on Azure Web Apps
                configuration.hosted = true;

                configuration.auth.audience = 'https://' + environment[key] + '/';
                configuration.auth.issuer = 'https://' + environment[key] + '/';
                break;
        }
    });

    configuration.data = merge(configuration.data, connectionString.parse(configuration.data.connectionString));

    return configuration;
};