#!/usr/bin/env node
'use strict';

var packageJson = require('./package.json'),
    adventure = require('adventure');

var shop = adventure(packageJson.name),
    lesson;

[
  'traditional-looping',
  'introduction-to-iterators',
  'built-in-iterators',
  'advanced-iterables',
  'introduction-to-generators'
].forEach(function(lesson, index) {

  lesson = require('./' + lesson);

  shop.add((index + 1) + '. ' + lesson.title, function() {
    return lesson.problem
  });
})

shop.execute(process.argv.slice(2));

#!/bin/sh
":" //# why? http://sambal.org/?p=1014 ; exec /usr/bin/env node --harmony "$0" "$@"

'use strict';

var packageJson = require('./package.json'),
    adventure = require('adventure');

var shop = adventure(packageJson.name),
    lesson;

[
  'traditional-looping',
  'introduction-to-iterators',
  'built-in-iterators',
  'advanced-iterables',
  'introduction-to-generators'
].forEach(function(lesson, index) {

  lesson = require('./' + lesson);

  shop.add((index + 1) + '. ' + lesson.title, function() {
    return lesson.problem
  });
})

shop.execute(process.argv.slice(2));

Add bash hack to ensure node is run with --harmony
Add bash hack to ensure node is run with --harmony

For details, see: http://sambal.org/?p=1014

tl;dr:
 * Bash reads the first two lines, switching to node from `exec ...`
 * Node re-reads the entire file, and skips over the string constant + comment line
