Menu Developer Moovweb University

SDK v6.2 - August 12, 2015

This release is all about enhancing local development. It includes numerous new features that increase developer’s freedom when writing project code. Learn more about the new Task Runner, moov_builder module, the moov fusion command and incorporating scripts into your development process.

Upgrade instructions from 6.1 SDK projects

  • Add the followig section to your moov_config.json file:
      "taskrunner": {
          "on_project_start_command": "node ./tasks/start",
          "on_request_command": "node ./tasks/request",
          "on_deploy_command": "node ./tasks/deploy"
      };
Note: The "taskrunner" fields are backward compatible with 6.1 SDK, but are mandatory for 6.2 SDK. The same project developed with 6.2 SDK or 6.1 SDK will run exactly the same in the Moovweb Cloud.

6.2 SDK Changes

  • New Build/Assest folder - Production assests can now be minified and packaged for deployment. Not all asset files in the ./assests folder are required in production. If a project has a ./build/assets folder in its directory that folder will be uploaded to our servers upon moov deploy instead of the ./assests folder. Otherwise the SDK will fall back to uploading the normal ./assests folder. The ./build/assests folder should ideally mirror the local assest folder structure, but only needs to contain the assest needed in production. The new moov_builder module monitors your assets folder and compiles minified, production-ready assets in your local ./build/assets folder.
  • New Task Runner - The Task Runner executes commands automatically when specific events occur during development.
    • on_project_start_command: runs when the project is started via the start button in the Developer Dashboard or when sudo moov server is run directly.
    • on_request_command: runs every time a request comes through the server
    • on_deploy_command: runs when the moov deploy is executed

      Example ./tasks/start

          #!/usr/bin/env node
          'use strict';
          var gulp = require('../gulpfile.js'),
              exec = require('child_process').exec;
      
          function puts(error, stdout, stderr) {
              console.log(stdout); /* if (error) { throw new Error(error) } */
          }
      
          exec('moov fusion', puts);
          if (gulp.tasks) {
              gulp.start();
          }
      

      Example ./tasks/request

          #!/usr/bin/env node
          'use strict';
          console.log('=== New Request ===');
      

      Example ./tasks/deploy

          #!/usr/bin/env node
          'use strict';
          var gulp = require('../gulpfile.js'),
              exec = require('child_process').exec;
      
          function puts(error, stdout, stderr) {
              console.log(stdout); /* if (error) { throw new Error(error) } */
          }
      
          exec('moov fusion', puts);
          if (gulp.tasks) {
              gulp.run('build');
          }
      
  • New moov fusion command bundles your assets folder for production deployment. It was previously run per request while developing locally. JavaScript assets can be bundled however you choose, but for convenience, we have provided this command to be used in conjunction with the Task Runner and local debugging. Automated rebundling of JavaScript assets has not gone away, but is now triggered when changes to the files are detected. It is now provided via the new node module, moov_builder (see below.)

    Note: In earlier versions of the SDK moov fusion was run on every request which was inefficient. While this behavior has been deprecated, it can be enabled using Task Runner:

    "taskrunner": {
      "on_request_command": "moov fusion"
    }
    
  • New moov_builder module includes a set of gulp tasks for automating the build process.
    • To add this to an existing project use npm install moov_builder --save-dev from your local project direotory.
    • Create a gulpfile.js in your local project directory containing the following:

          exports = module.exports = require("moov_builder")({
              browserSync: { port: 9099 }
          });
      
    • Add the "on_project_start_command": "node ./tasks/start", to your moov_config.json (as shown above)
  • New Feature - Debugger Support debugging for JavaScript projects is now available using node-inspector.
    • Use the debug button on the Developer Dashboard to open the debug console. When the console is open the following will trigger breakpoints in your code.
      • breakpoint("My Label"); function triggers a break point.
      • add ?moov_debug=true to your URL to break at the beginning of your transformation JavaScript code.
  • New Feature - PageType allows you to tag specific pages with an arbitraty PageType string. This is useful is categorizing groups of pages for debugging, logging and statistical anaysis.
    • fns.setPageType("My PageType"); to specify the PageType. This will overwrite any previously set PageType for that request.
    • fns.getPageType(); to retrieve the current PageType.
  • New Feature on Developer Dashboard
    • displays project type: JavaScript or Tritium
    • displays and controls active layers
  • New Feature User JavaScript Exception Reporting
    • Exceptions in the transformation JavaScript code are recorded and accessable via the Moovweb Control Center
    • Customizable exception handling
    • Ability to show exception page or perfect proxy when an exception is encountered
  • Change: renamed files
    • request_main.js has been renamed to moov_request_header_transform.js
    • response_main.js has been renamed to moov_response_header_transform.js
  • Bug Fixes
    • garbled images in perfect proxy