Skip to content
Jonathan Porta edited this page Feb 17, 2015 · 2 revisions

With no additional configuration, Rupert understands a front-edge architecture with a node API server and AngularJS browser application. AngularJS and Node share a strength in their module systems. Rupert emphasises that modularity, expecting projects to be layed out in a component-oriented folder structure. For each side of the application, Rupert looks inside your folder structure for component names, and compiles pieces of the components based on their file names.

Client

Within the ./src/client folder, components may have several script types, some style types, and template types. Scripts can be either javascript or coffeescript, with a .js or .coffee extension. They must have a name of main, directive, service, filter, or provider. Styles can be CSS, Stylus, or Less (.css, .styl, .less). The names all, screen, and print create seperate style sheets for various media types. Templates can be either HTML or Jade (.html, .jade), are named template, and are loaded as Angular modules with the path to the file as the module name (eg auth.login.template), and register themselves (without their basename) in the $templateCache (eg templateUrl: 'auth/login). Tests are either JS or Coffeescript, run in a mocha test runner, with the file name *.test.(js|coffee).

Server

The default configuration looks for all files named route.(js|coffee) in the ./src/server folder. The server will reuquire each file, and expects the module.exports to be a function that takes an express app as the first parameter and the rupert configuration object as the second. Tests are named test.(js|coffee), and are run in Mocha on the server. In tests, passing a route module to superRupert returns a [supertest][supertest] instance to make requests against.

Feature Testing

Feature tests are in ./src/feature, with the extension .feature. They are written in the Cucumber syntax. Steps are loaded from ./src/feature/steps/, and again can be either coffee or javascript. To include a variety of Rupert feature test helpers (including built-in support for running across a matrix of browser profiles on browserstack), the steps should export a module wrapped in require('rupert-grunt/steps')(steps, {protractor: yes}).