Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 26, 2015 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/949ab1fb822baa0b7ce8 to your computer and use it in GitHub Desktop.
Save linus-amg/949ab1fb822baa0b7ce8 to your computer and use it in GitHub Desktop.
ensure modules 2 coffee
ensureModules = (app, modules) ->
_.each app.submodules, (module) ->
if (modules.indexOf(module.moduleName) == -1 && module.started)
console.log 'stopping module:', module.moduleName
module.stop()
_.each(app.submodules, (module) ->
if (modules.indexOf(module.moduleName) > -1 && !module.started)
console.log 'starting module:', module.moduleName
module.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment