<commit_before>/**
 * @fileoverview
This module implements the Stream/TextStream classes as per
 * the CommonJS IO/A
 * proposal.

 */

var ByteArray = require("binary").ByteArray;

defineClass(org.ringojs.wrappers.Stream);
/**
 * @constructor
 */
exports.Stream = Stream;
/** @ignore Narwhal compatibility */
exports.IO = Stream;

var InputStreamReader = java.io.InputStreamReader,
    BufferedReader = java.io.BufferedReader,
    OutputStreamWriter = java.io.OutputStreamWriter,
    BufferedWriter = java.io.BufferedWriter;

module.shared = true;

Stream.prototype.copy = function(output) {
    var length = 8192;
    var buffer = new ByteArray(length);
    while (true) {
        var read = this.readInto(buffer, 0, length);
        if (read < 0)
            break;
        output.write(buffer, 0, read);
    }
    output.flush();
    return this;
};

exports.TextStream = function TextStream(io, charset, buflen) {
    if (this.constructor !== exports.TextStream) {
        return new exports.TextStream(io, charset, buflen);
    }

    var reader, writer;

    if (io.readable()) {
        reader = charset == undefined ?
                 new InputStreamReader(io.inputStream) :
                 new InputStreamReader(io.inputStream, charset);
        reader = new BufferedReader(reader, buflen || 8192);
    }

    if (io.writable()) {
        writer = charset == undefined ?
                 new OutputStreamWriter(io.outputStream):
                 new OutputStreamWriter(io.outputStream, charset);
        writer = new BufferedWriter(writer, buflen || 8192);
    }

    this.readable = function() {
       return io.readable();
    };

    this.writable = function() {
        return io.writable();
    };

    this.seekable = function() {
        return false;
    };

    this.readLine = function () {
        var line = reader.readLine();
        if (line === null)
            return '';
        return String(line) + "\n";
    };

    this.iterator = function () {
        return this;
    };

    this.next = function () {
        var line = reader.readLine();
        if (line === null)
            throw StopIteration;
        return String(line);
    };

    this.forEach = function (block, context) {
        var line;
        while (true) {
            try {
                line = this.next();
            } catch (exception) {
                break;
            }
            block.call(context, line);
        }
    };

    this.readLines = function () {
        var lines = [];
        do {
            var line = this.readLine();
            if (line.length)
                lines.push(line);
        } while (line.length);
        return lines;
    };

    this.read = function () {
        return this.readLines().join('');
    };

    this.readInto = function (buffer) {
        throw new Error("Not implemented");
    };

    this.copy = function (output) {
        while (true) {
            var line = this.readLine();
            if (!line.length)
                break;
            output.write(line).flush();
        }
        return this;
    };

    this.write = function () {
        writer.write.apply(writer, arguments);
        return this;
    };

    this.writeLine = function (line) {
        this.write(line + "\n"); // todo recordSeparator
        return this;
    };

    this.writeLines = function (lines) {
        lines.forEach(this.writeLine);
        return this;
    };

    this.print = function () {
        for (var i = 0; i < arguments.length; i++) {
            this.write(String(arguments[i]));
            if (i < arguments.length - 1) {
                this.write(' ');
            }
        }
        this.write('\n');
        this.flush();
        // todo recordSeparator, fieldSeparator
        return this;
    };

    this.flush = function () {
        writer.flush();
        return this;
    };

    this.close = function () {
        io.close();
    };

    return this;
};

/**
 * @name Stream.prototype.write
 * @function
 */

/**
 * @name Stream.prototype.read
 * @function
 */

/**
 * @name Stream.prototype.flush
 * @function
 */

/**
 * @name Stream.prototype.readable
 * @function
 */

/**
 * @name Stream.prototype.seekable
 * @function
 */

/**
 * @name Stream.prototype.writable
 * @function
 */

/**
 * Get the Java input or output stream instance wrapped by this Stream.
 * @name Stream.prototype.unwrap
 * @function
 */
<commit_msg>Add some missing jsdoc stubs.<commit_after>/**
 * @fileoverview
This module implements the Stream/TextStream classes as per
 * the CommonJS IO/A
 * proposal.

 */

var ByteArray = require("binary").ByteArray;

defineClass(org.ringojs.wrappers.Stream);
/**
 * @constructor
 */
exports.Stream = Stream;
/** @ignore Narwhal compatibility */
exports.IO = Stream;

var InputStreamReader = java.io.InputStreamReader,
    BufferedReader = java.io.BufferedReader,
    OutputStreamWriter = java.io.OutputStreamWriter,
    BufferedWriter = java.io.BufferedWriter;

module.shared = true;

Stream.prototype.copy = function(output) {
    var length = 8192;
    var buffer = new ByteArray(length);
    while (true) {
        var read = this.readInto(buffer, 0, length);
        if (read < 0)
            break;
        output.write(buffer, 0, read);
    }
    output.flush();
    return this;
};

exports.TextStream = function TextStream(io, charset, buflen) {
    if (this.constructor !== exports.TextStream) {
        return new exports.TextStream(io, charset, buflen);
    }

    var reader, writer;

    if (io.readable()) {
        reader = charset == undefined ?
                 new InputStreamReader(io.inputStream) :
                 new InputStreamReader(io.inputStream, charset);
        reader = new BufferedReader(reader, buflen || 8192);
    }

    if (io.writable()) {
        writer = charset == undefined ?
                 new OutputStreamWriter(io.outputStream):
                 new OutputStreamWriter(io.outputStream, charset);
        writer = new BufferedWriter(writer, buflen || 8192);
    }

    this.readable = function() {
       return io.readable();
    };

    this.writable = function() {
        return io.writable();
    };

    this.seekable = function() {
        return false;
    };

    this.readLine = function () {
        var line = reader.readLine();
        if (line === null)
            return '';
        return String(line) + "\n";
    };

    this.iterator = function () {
        return this;
    };

    this.next = function () {
        var line = reader.readLine();
        if (line === null)
            throw StopIteration;
        return String(line);
    };

    this.forEach = function (block, context) {
        var line;
        while (true) {
            try {
                line = this.next();
            } catch (exception) {
                break;
            }
            block.call(context, line);
        }
    };

    this.readLines = function () {
        var lines = [];
        do {
            var line = this.readLine();
            if (line.length)
                lines.push(line);
        } while (line.length);
        return lines;
    };

    this.read = function () {
        return this.readLines().join('');
    };

    this.readInto = function (buffer) {
        throw new Error("Not implemented");
    };

    this.copy = function (output) {
        while (true) {
            var line = this.readLine();
            if (!line.length)
                break;
            output.write(line).flush();
        }
        return this;
    };

    this.write = function () {
        writer.write.apply(writer, arguments);
        return this;
    };

    this.writeLine = function (line) {
        this.write(line + "\n"); // todo recordSeparator
        return this;
    };

    this.writeLines = function (lines) {
        lines.forEach(this.writeLine);
        return this;
    };

    this.print = function () {
        for (var i = 0; i < arguments.length; i++) {
            this.write(String(arguments[i]));
            if (i < arguments.length - 1) {
                this.write(' ');
            }
        }
        this.write('\n');
        this.flush();
        // todo recordSeparator, fieldSeparator
        return this;
    };

    this.flush = function () {
        writer.flush();
        return this;
    };

    this.close = function () {
        io.close();
    };

    return this;
};

/**
 * @name Stream.prototype.write
 * @function
 */

/**
 * @name Stream.prototype.read
 * @function
 */

/**
 * @name Stream.prototype.readInto
 * @function
 */

/**
 * @name Stream.prototype.flush
 * @function
 */

/**
 * @name Stream.prototype.close
 * @function
 */

/**
 * @name Stream.prototype.readable
 * @function
 */

/**
 * @name Stream.prototype.seekable
 * @function
 */

/**
 * @name Stream.prototype.writable
 * @function
 */

/**
 * Get the Java input or output stream instance wrapped by this Stream.
 * @name Stream.prototype.unwrap
 * @function
 */

/**
 * @name Stream.prototype.inputStream
 * @property
 */

/**
 * @name Stream.prototype.outputStream
 * @type java.io.OutputStream
 */
<|endoftext|>


<commit_before>module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
  banner: '/*!\n * <%= pkg.name %> <%= pkg.version %> | http://fotorama.io/license/\n */\n',
  sass: ['src/scss/*'],
  js: [
    'src/js/intro.js',
    'src/js/css-classes.js',
    'src/js/skip.js',
    'src/js/_.js',
    'src/js/modernizr.js',
    'src/js/fullscreen.js',
    'src/js/bez.js',
    'src/js/basevars.js',
    'src/js/utils.js',
    'src/js/animate.js',
    'src/js/touch.js',
    'src/js/moveontouch.js',
    'src/js/wheel.js',
    'src/js/fotorama.js',
    'src/js/fn-fotorama.js',
    'src/js/instances.js',
    'src/js/cache.js',
    'src/templates/compiled.js',
    'src/js/auto-initialization.js',
    'src/js/outro.js'
  ]
},
jst: {
  compile: {
    options: {
      namespace: '$.Fotorama.jst',
      processName: function (filename) {
        return filename.replace('src/templates/', '').replace(/\.jst$/, '').replace(/\//g, '_');
      },
      templateSettings: {
        variable: 'v'
      }
    },
    files: {
      'src/templates/compiled.js': ['src/templates/*.jst']
    }
  }
},
watch: {
  jst: {
    files: 'src/templates/*.jst',
    tasks: ['jst', 'replace:jst']
  },
  sass: {
    files: '<%= meta.sass %>',
    tasks: ['sass', 'autoprefixer']
  },
  js: {
    files: '<%= meta.js %>',
    tasks: 'concat:js'
  },
  i: {
    files: 'src/i/*',
    tasks: 'copy:i'
  },
  test: {
    files: ['test/**/*', '!test/index.html', '!test/*/index.html', '!test/*/*/index.html', '!test/*/*/*/index.html'],
    tasks: 'shell:indexes'
  }
},
sass: {
  mixdown: {
    options: {
    },
    files: {
      'product/fotorama.css': 'src/scss/fotorama.scss'
    }
  }
},
autoprefixer: {
  mixdown: {
    options: {
      browsers: ['last 2 version', 'ie 8', 'ie 7']
    },
    files: {
      'product/fotorama.css': 'product/fotorama.css'
    }
  }
},
copy: {
  i: {
    files: [
      {
        expand: true,
        flatten: true,
        src: ['src/i/*.png'],
        dest: 'product/'
      }
    ]
  },
  example: {
    files: [
      {
        src: 'src/example/example.html',
        dest: 'product/example.html'
      }
    ]
  }
},
concat: {
  js: {
    files: {
      'product/fotorama.js': '<%= meta.js %>'
    },
    options: {
      banner: '<%= meta.banner %>'
    }
  },
  css: {
    files: {
      'product/fotorama.uncompressed.css': 'product/fotorama.css'
    },
    options: {
      banner: '<%= meta.banner %>'
    }
  }
},
cssmin: {
  product: {
    files: {
      'product/fotorama.css': 'product/fotorama.css'
    },
    options: {
      banner: '<%= meta.banner.replace(/\\n$/, "") %>'
    }
  }
},
replace: {
  jst: {
    files: {
      'src/templates/compiled.js': 'src/templates/compiled.js'
    },
    options: {
      patterns: [
        {
          match: /this\[\"(\$)\"\]/g,
          replacement: "$"
        },
        {
          match: /\[\"([a-z]+)\"\]/gi,
          replacement: ".$1"
        }
      ]
    }
  },
  console: {
    files: {
      'product/fotorama.uncompressed.js': 'product/fotorama.js'
    },
    options: {
      patterns: [
        {
          match: /(console\.)/g,
          replacement: "//$1"
        }
      ]
    }
  },
  version: {
    files: {
      'fotorama.jquery.json': 'fotorama.jquery.json'
    },
    options: {
      patterns: [
        {
          match: /(\.?\d+){3,4}/g,
          replacement: '<%= pkg.version %>'
        }
      ]
    }
  },
  history: {
    files: {
      'history.json': 'HISTORY.md'
    },
    options: {
      patterns: [
        {
          match: /[^\r]+/g,
          replacement: function (file) {
            // /<!--(.+)-->([^\r]+)<!--\/\1-->/g
            var json = {};

            file.replace(/<!--(.+)-->([^\r]+?)<!--\/\1-->/g, function (fragment, key, notes) {
              json[key] = notes
                  .replace(/^\n+/, '')
                  .replace(/\n+$/, '');
            });

            console.log('json', json);

            return JSON.stringify(json, null, '  ');
          }
        }
      ]
    }
  }
},
uglify: {
  product: {
    options: {
      banner: '<%= meta.banner %>'
    },
    files: {
      'product/fotorama.js': 'product/fotorama.uncompressed.js'
    }
  }
},
clean: {
  zip: ['product/fotorama*.zip']
},
compress: {
  uncompressed: {
    options: {
      archive: 'product/fotorama-<%= pkg.version %>.uncompressed.zip'
    },
    files: [
      {expand: true, cwd: 'product/', src: 'fotorama.uncompressed.css', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama.uncompressed.js', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama.png', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama@2x.png', dest: 'fotorama-<%= pkg.version %>.uncompressed/'}
    ]
  },
  product: {
    options: {
      archive: 'product/fotorama-<%= pkg.version %>.zip'
    },
    files: [
      {expand: true, cwd: 'product/', src: 'fotorama.css', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama.js', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama.png', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama@2x.png', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'example.html', dest: 'fotorama-<%= pkg.version %>/'}
    ]
  }
},
s3: {
  options: {
    key: '<%= grunt.file.readJSON("secret.json").s3.key %>',
    secret: '<%= grunt.file.readJSON("secret.json").s3.secret %>',
    bucket: 'fotorama',
    access: 'public-read',
    gzip: true,
    secure: false
  },
  product: {
    options: {
      headers: {'Cache-Control': 'max-age=2592000'}
    },
    upload: [
        // Separate version to separate folder
      {
        src: 'product/*',
        dest: '<%= pkg.version %>/'
      }
    ]
  },
  edge: {
    // Latest to the root
    options: {
      headers: {'Cache-Control': 'max-age=1'}
    },
    upload: [
      {
        src: 'product/fotorama.*',
        dest: ''
      },
      {
        src: 'product/fotorama@2x.png',
        dest: 'fotorama@2x.png'
      }
    ]
  }
},

connect: {
  server: {
    options: {
      hostname: '*',
      port: 9001,
      keepalive: true
    }
  }
},

shell: {
  options: {
    stdout: true,
    stderr: true,
    failOnError: true
  },
  commit: {
    command: 'git commit fotorama.jquery.json -m \'Tagging the <%= pkg.version %> release\''
  },
  /*tag: {
    command: 'git tag <%= pkg.version %>'
  },*/
  push: {
    command: 'git push --tags --progress origin master:master'
  },
  publish: {
    command: 'heroku config:add FOTORAMA_VERSION=<%= pkg.version %>'
  },
  indexes: {
    command: './test/index.sh'
  }
},

jasmine: grunt.file.readJSON('test/specs/_specs.json'),

tweet: {
  options: grunt.file.readJSON('secret.json').tweet,
  release: {
    options: {
      crop: true
    },
    text: 'Fotorama <%= pkg.version %>',
    url: 'https://github.com/artpolikarpov/fotorama/releases/tag/<%= pkg.version %>'
  }
},

gh_release: {
  options: {
    token: grunt.file.readJSON('secret.json').github.token,
    owner: 'artpolikarpov',
    repo: 'fotorama'
  },
  release: {
    tag_name: '<%= pkg.version %>', // required
    name: '<%= grunt.file.readJSON("history.json")[pkg.version + ":name"] %>',
    body: '<%= grunt.file.readJSON("history.json")[pkg.version + ":notes"] %>',
    asset: {
      name: 'fotorama-<%= pkg.version %>.zip',
      file: 'product/fotorama-4.4.4.zip',
      'Content-Type': 'application/zip'
    }
  }
}
});

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');

grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-shell');

grunt.loadNpmTasks('grunt-tweet');
grunt.loadNpmTasks('grunt-gh-release');

var defaultTask = 'copy sass autoprefixer jst replace:jst concat:js replace:console concat:css jasmine uglify cssmin jasmine clean compress';
var build = 'copy sass autoprefixer jst replace:jst concat:js replace:console concat:css uglify cssmin clean compress'.split(' ');

// Compile
grunt.registerTask('default', defaultTask.split(' '));
grunt.registerTask('build', build);
grunt.registerTask('look', 'copy:i sass autoprefixer jst replace:jst concat:js watch'.split(' '));

// Publish, will fail without secret details ;-)
grunt.registerTask('publish', (defaultTask + ' ' + 's3 replace:version shell replace:history gh_release tweet').split(' '));
};<commit_msg>(Fix gh_release)<commit_after>module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
  banner: '/*!\n * <%= pkg.name %> <%= pkg.version %> | http://fotorama.io/license/\n */\n',
  sass: ['src/scss/*'],
  js: [
    'src/js/intro.js',
    'src/js/css-classes.js',
    'src/js/skip.js',
    'src/js/_.js',
    'src/js/modernizr.js',
    'src/js/fullscreen.js',
    'src/js/bez.js',
    'src/js/basevars.js',
    'src/js/utils.js',
    'src/js/animate.js',
    'src/js/touch.js',
    'src/js/moveontouch.js',
    'src/js/wheel.js',
    'src/js/fotorama.js',
    'src/js/fn-fotorama.js',
    'src/js/instances.js',
    'src/js/cache.js',
    'src/templates/compiled.js',
    'src/js/auto-initialization.js',
    'src/js/outro.js'
  ]
},
jst: {
  compile: {
    options: {
      namespace: '$.Fotorama.jst',
      processName: function (filename) {
        return filename.replace('src/templates/', '').replace(/\.jst$/, '').replace(/\//g, '_');
      },
      templateSettings: {
        variable: 'v'
      }
    },
    files: {
      'src/templates/compiled.js': ['src/templates/*.jst']
    }
  }
},
watch: {
  jst: {
    files: 'src/templates/*.jst',
    tasks: ['jst', 'replace:jst']
  },
  sass: {
    files: '<%= meta.sass %>',
    tasks: ['sass', 'autoprefixer']
  },
  js: {
    files: '<%= meta.js %>',
    tasks: 'concat:js'
  },
  i: {
    files: 'src/i/*',
    tasks: 'copy:i'
  },
  test: {
    files: ['test/**/*', '!test/index.html', '!test/*/index.html', '!test/*/*/index.html', '!test/*/*/*/index.html'],
    tasks: 'shell:indexes'
  }
},
sass: {
  mixdown: {
    options: {
    },
    files: {
      'product/fotorama.css': 'src/scss/fotorama.scss'
    }
  }
},
autoprefixer: {
  mixdown: {
    options: {
      browsers: ['last 2 version', 'ie 8', 'ie 7']
    },
    files: {
      'product/fotorama.css': 'product/fotorama.css'
    }
  }
},
copy: {
  i: {
    files: [
      {
        expand: true,
        flatten: true,
        src: ['src/i/*.png'],
        dest: 'product/'
      }
    ]
  },
  example: {
    files: [
      {
        src: 'src/example/example.html',
        dest: 'product/example.html'
      }
    ]
  }
},
concat: {
  js: {
    files: {
      'product/fotorama.js': '<%= meta.js %>'
    },
    options: {
      banner: '<%= meta.banner %>'
    }
  },
  css: {
    files: {
      'product/fotorama.uncompressed.css': 'product/fotorama.css'
    },
    options: {
      banner: '<%= meta.banner %>'
    }
  }
},
cssmin: {
  product: {
    files: {
      'product/fotorama.css': 'product/fotorama.css'
    },
    options: {
      banner: '<%= meta.banner.replace(/\\n$/, "") %>'
    }
  }
},
replace: {
  jst: {
    files: {
      'src/templates/compiled.js': 'src/templates/compiled.js'
    },
    options: {
      patterns: [
        {
          match: /this\[\"(\$)\"\]/g,
          replacement: "$"
        },
        {
          match: /\[\"([a-z]+)\"\]/gi,
          replacement: ".$1"
        }
      ]
    }
  },
  console: {
    files: {
      'product/fotorama.uncompressed.js': 'product/fotorama.js'
    },
    options: {
      patterns: [
        {
          match: /(console\.)/g,
          replacement: "//$1"
        }
      ]
    }
  },
  version: {
    files: {
      'fotorama.jquery.json': 'fotorama.jquery.json'
    },
    options: {
      patterns: [
        {
          match: /(\.?\d+){3,4}/g,
          replacement: '<%= pkg.version %>'
        }
      ]
    }
  },
  history: {
    files: {
      'history.json': 'HISTORY.md'
    },
    options: {
      patterns: [
        {
          match: /[^\r]+/g,
          replacement: function (file) {
            // /<!--(.+)-->([^\r]+)<!--\/\1-->/g
            var json = {};

            file.replace(/<!--(.+)-->([^\r]+?)<!--\/\1-->/g, function (fragment, key, notes) {
              json[key] = notes
                  .replace(/^\n+/, '')
                  .replace(/\n+$/, '');
            });

            console.log('json', json);

            return JSON.stringify(json, null, '  ');
          }
        }
      ]
    }
  }
},
uglify: {
  product: {
    options: {
      banner: '<%= meta.banner %>'
    },
    files: {
      'product/fotorama.js': 'product/fotorama.uncompressed.js'
    }
  }
},
clean: {
  zip: ['product/fotorama*.zip']
},
compress: {
  uncompressed: {
    options: {
      archive: 'product/fotorama-<%= pkg.version %>.uncompressed.zip'
    },
    files: [
      {expand: true, cwd: 'product/', src: 'fotorama.uncompressed.css', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama.uncompressed.js', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama.png', dest: 'fotorama-<%= pkg.version %>.uncompressed/'},
      {expand: true, cwd: 'product/', src: 'fotorama@2x.png', dest: 'fotorama-<%= pkg.version %>.uncompressed/'}
    ]
  },
  product: {
    options: {
      archive: 'product/fotorama-<%= pkg.version %>.zip'
    },
    files: [
      {expand: true, cwd: 'product/', src: 'fotorama.css', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama.js', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama.png', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'fotorama@2x.png', dest: 'fotorama-<%= pkg.version %>/'},
      {expand: true, cwd: 'product/', src: 'example.html', dest: 'fotorama-<%= pkg.version %>/'}
    ]
  }
},
s3: {
  options: {
    key: '<%= grunt.file.readJSON("secret.json").s3.key %>',
    secret: '<%= grunt.file.readJSON("secret.json").s3.secret %>',
    bucket: 'fotorama',
    access: 'public-read',
    gzip: true,
    secure: false
  },
  product: {
    options: {
      headers: {'Cache-Control': 'max-age=2592000'}
    },
    upload: [
        // Separate version to separate folder
      {
        src: 'product/*',
        dest: '<%= pkg.version %>/'
      }
    ]
  },
  edge: {
    // Latest to the root
    options: {
      headers: {'Cache-Control': 'max-age=1'}
    },
    upload: [
      {
        src: 'product/fotorama.*',
        dest: ''
      },
      {
        src: 'product/fotorama@2x.png',
        dest: 'fotorama@2x.png'
      }
    ]
  }
},

connect: {
  server: {
    options: {
      hostname: '*',
      port: 9001,
      keepalive: true
    }
  }
},

shell: {
  options: {
    stdout: true,
    stderr: true,
    failOnError: true
  },
  commit: {
    command: 'git commit fotorama.jquery.json -m \'Tagging the <%= pkg.version %> release\''
  },
  /*tag: {
    command: 'git tag <%= pkg.version %>'
  },*/
  push: {
    command: 'git push --tags --progress origin master:master'
  },
  publish: {
    command: 'heroku config:add FOTORAMA_VERSION=<%= pkg.version %>'
  },
  indexes: {
    command: './test/index.sh'
  }
},

jasmine: grunt.file.readJSON('test/specs/_specs.json'),

tweet: {
  options: grunt.file.readJSON('secret.json').tweet,
  release: {
    options: {
      crop: true
    },
    text: 'Fotorama <%= pkg.version %>',
    url: 'https://github.com/artpolikarpov/fotorama/releases/tag/<%= pkg.version %>'
  }
},

gh_release: {
  options: {
    token: grunt.file.readJSON('secret.json').github.token,
    owner: 'artpolikarpov',
    repo: 'fotorama'
  },
  release: {
    tag_name: '<%= pkg.version %>', // required
    name: '<%= grunt.file.readJSON("history.json")[pkg.version + ":name"] %>',
    body: '<%= grunt.file.readJSON("history.json")[pkg.version + ":notes"] %>',
    asset: {
      name: 'fotorama-<%= pkg.version %>.zip',
      file: 'product/fotorama-<%= pkg.version %>.zip',
      'Content-Type': 'application/zip'
    }
  }
}
});

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');

grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-shell');

grunt.loadNpmTasks('grunt-tweet');
grunt.loadNpmTasks('grunt-gh-release');

var defaultTask = 'copy sass autoprefixer jst replace:jst concat:js replace:console concat:css jasmine uglify cssmin jasmine clean compress';
var build = 'copy sass autoprefixer jst replace:jst concat:js replace:console concat:css uglify cssmin clean compress'.split(' ');

// Compile
grunt.registerTask('default', defaultTask.split(' '));
grunt.registerTask('build', build);
grunt.registerTask('look', 'copy:i sass autoprefixer jst replace:jst concat:js watch'.split(' '));

// Publish, will fail without secret details ;-)
grunt.registerTask('publish', (defaultTask + ' ' + 's3 replace:version shell replace:history gh_release tweet').split(' '));
};<|endoftext|>


<commit_before>import run from "ember-metal/run_loop";
import copy from "ember-runtime/copy";
import merge from "ember-metal/merge";
import { map } from "ember-metal/enumerable_utils";
import Container from 'container/container';
import HashLocation from "ember-routing/location/hash_location";
import AutoLocation from "ember-routing/location/auto_location";
import EmberRouter from "ember-routing/system/router";

var container, Router, router;

function createRouter(overrides) {
  var opts = merge({ container: container }, overrides);
  router = Router.create(opts);
}

QUnit.module("Ember Router", {
  setup: function() {
    container = new Container();

    //register the HashLocation (the default)
    container.register('location:hash', HashLocation);

    // ensure rootURL is injected into any locations
    container.injection('location', 'rootURL', '-location-setting:root-url');

    Router = EmberRouter.extend();
  },
  teardown: function() {
    container = Router = router = null;
  }
});

test("should create a router if one does not exist on the constructor", function() {
  createRouter();

  ok(router.router);
});

test("should destroy its location upon destroying the routers container.", function() {
  createRouter();

  var location = router.get('location');

  run(container, 'destroy');

  ok(location.isDestroyed, "location should be destroyed");
});

test("should instantiate its location with its `rootURL`", function() {
  createRouter({
    rootURL: '/rootdir/'
  });

  var location = router.get('location');

  equal(location.get('rootURL'), '/rootdir/');
});

test("Ember.AutoLocation._replacePath should be called with the right path", function() {
  expect(1);

  var AutoTestLocation = copy(AutoLocation);

  AutoTestLocation._location = {
    href: 'http://test.com/rootdir/welcome',
    origin: 'http://test.com',
    pathname: '/rootdir/welcome',
    hash: '',
    search: '',
    replace: function(url) {
      equal(url, 'http://test.com/rootdir/#/welcome');
    }
  };
  AutoTestLocation._getSupportsHistory = function() { return false; };

  container.register('location:auto', AutoTestLocation);

  createRouter({
    location: 'auto',
    rootURL: '/rootdir/'
  });
});

test("Ember.Router._routePath should consume identical prefixes", function() {
  createRouter();

  expect(8);

  function routePath(s1, s2, s3) {
    var handlerInfos = map(arguments, function(s) {
      return { name: s };
    });
    handlerInfos.unshift({ name: 'ignored' });

    return EmberRouter._routePath(handlerInfos);
  }

  equal(routePath('foo'), 'foo');
  equal(routePath('foo', 'bar', 'baz'), 'foo.bar.baz');
  equal(routePath('foo', 'foo.bar'), 'foo.bar');
  equal(routePath('foo', 'foo.bar', 'foo.bar.baz'), 'foo.bar.baz');
  equal(routePath('foo', 'foo.bar', 'foo.bar.baz.wow'), 'foo.bar.baz.wow');
  equal(routePath('foo', 'foo.bar.baz.wow'), 'foo.bar.baz.wow');
  equal(routePath('foo.bar', 'bar.baz.wow'), 'foo.bar.baz.wow');

  // This makes no sense, not trying to handle it, just
  // making sure it doesn't go boom.
  equal(routePath('foo.bar.baz', 'foo'), 'foo.bar.baz.foo');
});

test("Router should cancel routing setup when the Location class says so via cancelRouterSetup", function() {
  expect(0);

  var FakeLocation = {
    cancelRouterSetup: true,
    create: function () { return this; }
  };

  container.register('location:fake', FakeLocation);

  router = Router.create({
    container: container,
    location: 'fake',

    _setupRouter: function () {
      ok(false, '_setupRouter should not be called');
    }
  });

  router.startRouting();
});

test("AutoLocation should replace the url when it's not in the preferred format", function() {
  expect(1);

  var AutoTestLocation = copy(AutoLocation);

  AutoTestLocation._location = {
    href: 'http://test.com/rootdir/welcome',
    origin: 'http://test.com',
    pathname: '/rootdir/welcome',
    hash: '',
    search: '',
    replace: function(url) {
      equal(url, 'http://test.com/rootdir/#/welcome');
    }
  };

  AutoTestLocation._getSupportsHistory = function() { return false; };

  container.register('location:auto', AutoTestLocation);

  createRouter({
    location: 'auto',
    rootURL: '/rootdir/'
  });
});
<commit_msg>Test instantiation without a container.<commit_after>import run from "ember-metal/run_loop";
import copy from "ember-runtime/copy";
import merge from "ember-metal/merge";
import { map } from "ember-metal/enumerable_utils";
import Container from 'container/container';
import HashLocation from "ember-routing/location/hash_location";
import AutoLocation from "ember-routing/location/auto_location";
import EmberRouter from "ember-routing/system/router";

var container, Router, router;

function createRouter(overrides) {
  var opts = merge({ container: container }, overrides);
  router = Router.create(opts);
}

QUnit.module("Ember Router", {
  setup: function() {
    container = new Container();

    //register the HashLocation (the default)
    container.register('location:hash', HashLocation);

    // ensure rootURL is injected into any locations
    container.injection('location', 'rootURL', '-location-setting:root-url');

    Router = EmberRouter.extend();
  },
  teardown: function() {
    container = Router = router = null;
  }
});

test("can create a router without a container", function() {
  var router = Router.create();

  ok(router.router);
});

test("should create a router if one does not exist on the constructor", function() {
  createRouter();

  ok(router.router);
});

test("should destroy its location upon destroying the routers container.", function() {
  createRouter();

  var location = router.get('location');

  run(container, 'destroy');

  ok(location.isDestroyed, "location should be destroyed");
});

test("should instantiate its location with its `rootURL`", function() {
  createRouter({
    rootURL: '/rootdir/'
  });

  var location = router.get('location');

  equal(location.get('rootURL'), '/rootdir/');
});

test("Ember.AutoLocation._replacePath should be called with the right path", function() {
  expect(1);

  var AutoTestLocation = copy(AutoLocation);

  AutoTestLocation._location = {
    href: 'http://test.com/rootdir/welcome',
    origin: 'http://test.com',
    pathname: '/rootdir/welcome',
    hash: '',
    search: '',
    replace: function(url) {
      equal(url, 'http://test.com/rootdir/#/welcome');
    }
  };
  AutoTestLocation._getSupportsHistory = function() { return false; };

  container.register('location:auto', AutoTestLocation);

  createRouter({
    location: 'auto',
    rootURL: '/rootdir/'
  });
});

test("Ember.Router._routePath should consume identical prefixes", function() {
  createRouter();

  expect(8);

  function routePath(s1, s2, s3) {
    var handlerInfos = map(arguments, function(s) {
      return { name: s };
    });
    handlerInfos.unshift({ name: 'ignored' });

    return EmberRouter._routePath(handlerInfos);
  }

  equal(routePath('foo'), 'foo');
  equal(routePath('foo', 'bar', 'baz'), 'foo.bar.baz');
  equal(routePath('foo', 'foo.bar'), 'foo.bar');
  equal(routePath('foo', 'foo.bar', 'foo.bar.baz'), 'foo.bar.baz');
  equal(routePath('foo', 'foo.bar', 'foo.bar.baz.wow'), 'foo.bar.baz.wow');
  equal(routePath('foo', 'foo.bar.baz.wow'), 'foo.bar.baz.wow');
  equal(routePath('foo.bar', 'bar.baz.wow'), 'foo.bar.baz.wow');

  // This makes no sense, not trying to handle it, just
  // making sure it doesn't go boom.
  equal(routePath('foo.bar.baz', 'foo'), 'foo.bar.baz.foo');
});

test("Router should cancel routing setup when the Location class says so via cancelRouterSetup", function() {
  expect(0);

  var FakeLocation = {
    cancelRouterSetup: true,
    create: function () { return this; }
  };

  container.register('location:fake', FakeLocation);

  router = Router.create({
    container: container,
    location: 'fake',

    _setupRouter: function () {
      ok(false, '_setupRouter should not be called');
    }
  });

  router.startRouting();
});

test("AutoLocation should replace the url when it's not in the preferred format", function() {
  expect(1);

  var AutoTestLocation = copy(AutoLocation);

  AutoTestLocation._location = {
    href: 'http://test.com/rootdir/welcome',
    origin: 'http://test.com',
    pathname: '/rootdir/welcome',
    hash: '',
    search: '',
    replace: function(url) {
      equal(url, 'http://test.com/rootdir/#/welcome');
    }
  };

  AutoTestLocation._getSupportsHistory = function() { return false; };

  container.register('location:auto', AutoTestLocation);

  createRouter({
    location: 'auto',
    rootURL: '/rootdir/'
  });
});
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

    var path = require('path'),
        pkg = require('./package.json');

    // Project configuration.
    grunt.initConfig({
        pkg: pkg,
        min: path.basename(pkg.main, '.js') + '.min.js',
        qunit: {
            all: {
                options: {
                    urls: [
                        'http://0.0.0.0:8000/tests/test_tagify.html'
                    ],
                    force: true
                }
            }
        },
        connect: {
            server: {
                options: {
                    port: 8000,
                    base: '.'
                }
            }
        },
        'bower-install-simple': {
            main: {
                options: {
                    directory: './tests/lib'
                }
            }
        },
        devUpdate: {
            main: {
                options: {
                    semver: false,
                    updateType: 'prompt'
                }
            }
        },
        uglify: {
            main: {
                files: {
                    '<%= min %>': '<%= pkg.main %>'
                },
                options: {
                    banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                    '<%= pkg.homepage %>\n' +
                    ' * Copyright (c) <%= grunt.template.today("yyyy") %> Decipher, Inc.;' +
                    ' Licensed <%= pkg.license %> */',
                    sourceMap: true
                }
            }
        },
        bump: {
            options: {
                files: ['package.json', 'bower.json',
                    'jquery.tagify.jquery.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'Release v%VERSION%',
                commitFiles: [
                    'package.json',
                    'bower.json',
                    'tagify.jquery.json',
                    '<%= min %>',
                    '<%= min %>' + '.map'
                ],
                createTag: true,
                tagName: 'v%VERSION%',
                tagMessage: 'Version %VERSION%',
                push: false,
                gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
            }
        }
    });

    require('load-grunt-tasks')(grunt);

    grunt.registerTask('test',
        ['bower-install-simple:main', 'connect', 'qunit']);
    grunt.registerTask('default', ['uglify:main']);

    grunt.registerTask('release', 'Make a new release', function (target) {
        var task = grunt.task;
        task.run('bump-only:' + target);
        task.run('uglify:main');
        task.run('bump-commit');
    });

    grunt.event.on('qunit.log',
        function (result, actual, expected, message) {
            if (!!result) {
                grunt.log.ok(message);
            }
        });
};
<commit_msg>fix bump task<commit_after>'use strict';

module.exports = function (grunt) {

    var path = require('path'),
        pkg = require('./package.json');

    // Project configuration.
    grunt.initConfig({
        pkg: pkg,
        min: path.basename(pkg.main, '.js') + '.min.js',
        qunit: {
            all: {
                options: {
                    urls: [
                        'http://0.0.0.0:8000/tests/test_tagify.html'
                    ],
                    force: true
                }
            }
        },
        connect: {
            server: {
                options: {
                    port: 8000,
                    base: '.'
                }
            }
        },
        'bower-install-simple': {
            main: {
                options: {
                    directory: './tests/lib'
                }
            }
        },
        devUpdate: {
            main: {
                options: {
                    semver: false,
                    updateType: 'prompt'
                }
            }
        },
        uglify: {
            main: {
                files: {
                    '<%= min %>': '<%= pkg.main %>'
                },
                options: {
                    banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                    '<%= pkg.homepage %>\n' +
                    ' * Copyright (c) <%= grunt.template.today("yyyy") %> Decipher, Inc.;' +
                    ' Licensed <%= pkg.license %> */',
                    sourceMap: true
                }
            }
        },
        bump: {
            options: {
                files: ['package.json', 'bower.json', 'tagify.jquery.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'Release v%VERSION%',
                commitFiles: [
                    'package.json',
                    'bower.json',
                    'tagify.jquery.json',
                    '<%= min %>',
                    '<%= min %>' + '.map'
                ],
                createTag: true,
                tagName: 'v%VERSION%',
                tagMessage: 'Version %VERSION%',
                push: false,
                gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
            }
        }
    });

    require('load-grunt-tasks')(grunt);

    grunt.registerTask('test',
        ['bower-install-simple:main', 'connect', 'qunit']);
    grunt.registerTask('default', ['uglify:main']);

    grunt.registerTask('release', 'Make a new release', function (target) {
        var task = grunt.task;
        task.run('bump-only:' + target);
        task.run('uglify:main');
        task.run('bump-commit');
    });

    grunt.event.on('qunit.log',
        function (result, actual, expected, message) {
            if (!!result) {
                grunt.log.ok(message);
            }
        });
};
<|endoftext|>


<commit_before>// listen for the request to show the extension as active and
// forward it to the U/I

chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
  if (request.action == "show") {
    chrome.tabs.query({
      active: true,
      currentWindow: true
    }, function(tabs) {
      chrome.pageAction.show(tabs[0].id);
    });
  }
});<commit_msg>version 1.0.0 commit unsaved file. (oops)<commit_after>// listen for the request to show the extension as active and
// forward it to the U/I

chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
  if (request.action == "show") {
    chrome.tabs.query({
      active: true,
      currentWindow: true
    }, function(tabs) {
      chrome.pageAction.show(tabs[0].id);
    });
  }
});

// chrome.runtime.onInstalled should be available but sanity check it
if (chrome.runtime.onInstalled) {
  // show the welcome page on first time install
  chrome.runtime.onInstalled.addListener(function (details) {
      if (details.reason == "install") {
        chrome.tabs.create({url: "http://hollies.pw/static/ffh/v100/welcome/"}, function (tab) {});
      }
  });
}<|endoftext|>


<commit_before>/**
 * This file is used to build Handsontable from `src/*`
 *
 * Installation:
 * 1. Install Grunt CLI (`npm install -g grunt-cli`)
 * 1. Install Grunt 0.4.0 and other dependencies (`npm install`)
 *
 * Build:
 * Execute `grunt` from root directory of this directory (where Gruntfile.js is)
 * To execute automatically after each change, execute `grunt --force default watch`
 * To execute build followed by the test run, execute `grunt test`
 *
 * Result:
 * building Handsontable will create files:
 *  - dist/handsontable.js
 *  - dist/handsontable.css
 *  - dist/handsontable.full.js
 *  - dist/handsontable.full.css
 *  - dist/handsontable.full.min.js
 *  - dist/handsontable.full.min.css
 *
 * See http://gruntjs.com/getting-started for more information about Grunt
 */
var browsers = [
  {
    browserName: 'firefox',
    platform: 'Windows 7'
  },
  {
    browserName: 'chrome',
    platform: 'Windows 7'
  },
  {
    browserName: 'opera',
    platform: 'Windows 7'
  },
  //{
  //  browserName: 'internet explorer',
  //  version: '8',
  //  platform: 'Windows 7'
  //},
  //{
  //  browserName: 'internet explorer',
  //  version: '9',
  //  platform: 'Windows 7'
  //},
  {
    browserName: 'internet explorer',
    version: '10',
    platform: 'Windows 8'
  }
];

module.exports = function(grunt) {

  require('time-grunt')(grunt);
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    gitinfo: {},

    meta: {
      src: [
        'src/*.js',
        'src/editors/*.js',
        'src/plugins/**/!(*.spec).js',
        'src/renderers/*.js',
        'src/validators/*.js',
        'src/shims/*.js',
        'src/3rdparty/*.js'
      ],
      walkontable: [
        'src/3rdparty/walkontable/src/**/*.js'
      ],
      vendor: [
        'lib/numeral/numeral.js'
      ]
    },

    watch: {
      options: {
        livereload: true // works with Chrome LiveReload extension. See: https://github.com/gruntjs/grunt-contrib-watch
      },
      files: [
        'src/**/*(*.js|*.css|*.html)',
        '!src/3rdparty/walkontable/test/**/*',
        'lib/**/*(*.js|*.css)'
      ],
      tasks: ['build-dev']
    },

    jasmine: {
      handsontable: {
        src: [
          'dist/handsontable.js',
          'demo/js/numeral.de-de.js',
          'demo/js/backbone/lodash.underscore.js',
          'demo/js/backbone/backbone.js',
          'demo/js/backbone/backbone-relational/backbone-relational.js',
          'demo/js/jquery-ui/js/jquery-ui.custom.js',
          'plugins/removeRow/handsontable.removeRow.js'
        ],
        options: {
          specs: [
            'test/jasmine/spec/*Spec.js',
            'test/jasmine/spec/!(mobile)*/*Spec.js',
            'src/plugins/*/test/*.spec.js',
            'plugins/*/test/*.spec.js',
            'test/jasmine/spec/MemoryLeakTest.js'
          ],
          styles: [
            'test/jasmine/css/SpecRunner.css',
            'dist/handsontable.css',
            'plugins/removeRow/handsontable.removeRow.css',
            'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
            'demo/js/pikaday/css/pikaday.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'demo/js/ZeroClipboard.js',
            'test/jasmine/lib/jasmine-extensions.js'
          ],
          helpers: [
            'test/jasmine/spec/SpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'test/jasmine/spec/test-init.js'
          ],
          outfile: 'test/jasmine/SpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      },
      walkontable: {
        src: [
          'dist/handsontable.js'
        ],
        options: {
          specs: [
            'src/3rdparty/walkontable/test/jasmine/spec/**/*.spec.js'
          ],
          styles: [
            'src/3rdparty/walkontable/css/walkontable.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'demo/js/ZeroClipboard.js',
            'demo/js/numeral.de-de.js'
          ],
          helpers: [
            'src/3rdparty/walkontable/test/jasmine/SpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'src/3rdparty/walkontable/test/jasmine/test-init.js'

          ],
          outfile: 'src/3rdparty/walkontable/test/jasmine/SpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      },
      mobile: {
        src: [
          'dist/handsontable.js',
          'demo/js/numeral.de-de.js',
          'demo/js/backbone/lodash.underscore.js',
          'demo/js/backbone/backbone.js',
          'demo/js/backbone/backbone-relational/backbone-relational.js',
          'demo/js/jquery-ui/js/jquery-ui.custom.js',
          'plugins/removeRow/handsontable.removeRow.js'
        ],
        options: {
          specs: [
            'test/jasmine/spec/mobile/*Spec.js',
            'src/plugins/*/test/mobile/*.spec.js'
          ],
          styles: [
            'test/jasmine/css/SpecRunner.css',
            'dist/handsontable.css',
            'plugins/removeRow/handsontable.removeRow.css',
            'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
            'demo/js/pikaday/css/pikaday.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/ZeroClipboard.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'test/jasmine/lib/jasmine-extensions.js'
          ],
          helpers: [
            'test/jasmine/spec/SpecHelper.js',
            'test/jasmine/spec/MobileSpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'test/jasmine/spec/test-init.js'
          ],
          outfile: 'test/jasmine/MobileSpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      }
    },

    connect: {
      server: {
        options: {
          port: 8080,
          base: '.',
          keepalive: true
        }
      },
      sauce: {
        options: {
          port: 9999,
          base: '.',
          keepalive: false
        }
      }
    },
    'saucelabs-jasmine': {
      handsontable: {
        options: {
          urls: ['http://localhost:9999/test/jasmine/SpecRunner.html'],
          build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
          concurrency: 3,
          browsers: browsers,
          testname: 'Development test (Handsontable)'
        }
      },
      walkontable: {
        options: {
          urls: ['http://localhost:9999/src/3rdparty/walkontable/test/jasmine/SpecRunner.html'],
          build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
          concurrency: 3,
          browsers: browsers,
          testname: 'Development test (Walkontable)'
        }
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      handsontable: '<%= meta.src %>',
      walkontable: '<%= meta.walkontable %>'
    },

    jscs: {
      handsontable: {
        files: {
          src: ['<%= meta.src %>', '!src/shims/classes.js']
        }
      },
      walkontable: {
        files: {
          src: ['<%= meta.walkontable %>', '!src/shims/classes.js']
        }
      },
      options: {
        config: '.jscsrc',
        esnext: true,
        verbose: true
      }
    },

    hotBuilder: {
      handsontable: {
        files: {
          dist: 'package.json'
        }
      },
      handsontableDev: {
        files: {
          dist: 'package.json'
        },
        options: {
          devMode: true
        }
      },
      handsontableCustom: {
        files: {
          dist: 'package.json'
        },
        options: {
          disableUI: false
        }
      },
      options: {
        minify: true
      }
    }
  });

  // Default task.
  grunt.registerTask('default', ['jscs', 'jshint', 'gitinfo', 'build']);
  grunt.registerTask('build', ['hotBuilder:handsontable']);
  grunt.registerTask('build-dev', ['hotBuilder:handsontableDev']);
  grunt.registerTask('build-custom', ['hotBuilder:handsontableCustom']);
  grunt.registerTask('test', ['default', 'jasmine:handsontable', 'jasmine:walkontable', 'jasmine:mobile:build']);
  grunt.registerTask('test:handsontable', ['default', 'jasmine:handsontable']);
  grunt.registerTask('test:walkontable', ['default', 'jasmine:walkontable']);
  grunt.registerTask('test:mobile', ['default', 'jasmine:mobile:build']);
  grunt.registerTask('sauce', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable', 'saucelabs-jasmine:handsontable']);
  grunt.registerTask('sauce:handsontable', ['default', 'connect:sauce', 'saucelabs-jasmine:handsontable']);
  grunt.registerTask('sauce:walkontable', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable']);

  grunt.loadTasks('tasks');
  grunt.loadNpmTasks('hot-builder');
  grunt.loadNpmTasks('grunt-jscs');
};
<commit_msg>Change the handsontable lib to minified version for the tests.<commit_after>/**
 * This file is used to build Handsontable from `src/*`
 *
 * Installation:
 * 1. Install Grunt CLI (`npm install -g grunt-cli`)
 * 1. Install Grunt 0.4.0 and other dependencies (`npm install`)
 *
 * Build:
 * Execute `grunt` from root directory of this directory (where Gruntfile.js is)
 * To execute automatically after each change, execute `grunt --force default watch`
 * To execute build followed by the test run, execute `grunt test`
 *
 * Result:
 * building Handsontable will create files:
 *  - dist/handsontable.js
 *  - dist/handsontable.css
 *  - dist/handsontable.full.js
 *  - dist/handsontable.full.css
 *  - dist/handsontable.full.min.js
 *  - dist/handsontable.full.min.css
 *
 * See http://gruntjs.com/getting-started for more information about Grunt
 */
var browsers = [
  {
    browserName: 'firefox',
    platform: 'Windows 7'
  },
  {
    browserName: 'chrome',
    platform: 'Windows 7'
  },
  {
    browserName: 'opera',
    platform: 'Windows 7'
  },
  //{
  //  browserName: 'internet explorer',
  //  version: '8',
  //  platform: 'Windows 7'
  //},
  //{
  //  browserName: 'internet explorer',
  //  version: '9',
  //  platform: 'Windows 7'
  //},
  {
    browserName: 'internet explorer',
    version: '10',
    platform: 'Windows 8'
  }
];

module.exports = function(grunt) {

  require('time-grunt')(grunt);
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    gitinfo: {},

    meta: {
      src: [
        'src/*.js',
        'src/editors/*.js',
        'src/plugins/**/!(*.spec).js',
        'src/renderers/*.js',
        'src/validators/*.js',
        'src/shims/*.js',
        'src/3rdparty/*.js'
      ],
      walkontable: [
        'src/3rdparty/walkontable/src/**/*.js'
      ],
      vendor: [
        'lib/numeral/numeral.js'
      ]
    },

    watch: {
      options: {
        livereload: true // works with Chrome LiveReload extension. See: https://github.com/gruntjs/grunt-contrib-watch
      },
      files: [
        'src/**/*(*.js|*.css|*.html)',
        '!src/3rdparty/walkontable/test/**/*',
        'lib/**/*(*.js|*.css)'
      ],
      tasks: ['build-dev']
    },

    jasmine: {
      handsontable: {
        src: [
          'dist/handsontable.min.js',
          'demo/js/numeral.de-de.js',
          'demo/js/backbone/lodash.underscore.js',
          'demo/js/backbone/backbone.js',
          'demo/js/backbone/backbone-relational/backbone-relational.js',
          'demo/js/jquery-ui/js/jquery-ui.custom.js',
          'plugins/removeRow/handsontable.removeRow.js'
        ],
        options: {
          specs: [
            'test/jasmine/spec/*Spec.js',
            'test/jasmine/spec/!(mobile)*/*Spec.js',
            'src/plugins/*/test/*.spec.js',
            'plugins/*/test/*.spec.js',
            'test/jasmine/spec/MemoryLeakTest.js'
          ],
          styles: [
            'test/jasmine/css/SpecRunner.css',
            'dist/handsontable.min.css',
            'plugins/removeRow/handsontable.removeRow.css',
            'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
            'demo/js/pikaday/css/pikaday.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'demo/js/ZeroClipboard.js',
            'test/jasmine/lib/jasmine-extensions.js'
          ],
          helpers: [
            'test/jasmine/spec/SpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'test/jasmine/spec/test-init.js'
          ],
          outfile: 'test/jasmine/SpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      },
      walkontable: {
        src: [
          'dist/handsontable.min.js'
        ],
        options: {
          specs: [
            'src/3rdparty/walkontable/test/jasmine/spec/**/*.spec.js'
          ],
          styles: [
            'src/3rdparty/walkontable/css/walkontable.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'demo/js/ZeroClipboard.js',
            'demo/js/numeral.de-de.js'
          ],
          helpers: [
            'src/3rdparty/walkontable/test/jasmine/SpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'src/3rdparty/walkontable/test/jasmine/test-init.js'

          ],
          outfile: 'src/3rdparty/walkontable/test/jasmine/SpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      },
      mobile: {
        src: [
          'dist/handsontable.min.js',
          'demo/js/numeral.de-de.js',
          'demo/js/backbone/lodash.underscore.js',
          'demo/js/backbone/backbone.js',
          'demo/js/backbone/backbone-relational/backbone-relational.js',
          'demo/js/jquery-ui/js/jquery-ui.custom.js',
          'plugins/removeRow/handsontable.removeRow.js'
        ],
        options: {
          specs: [
            'test/jasmine/spec/mobile/*Spec.js',
            'src/plugins/*/test/mobile/*.spec.js'
          ],
          styles: [
            'test/jasmine/css/SpecRunner.css',
            'dist/handsontable.min.css',
            'plugins/removeRow/handsontable.removeRow.css',
            'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
            'demo/js/pikaday/css/pikaday.css'
          ],
          vendor: [
            'demo/js/jquery.min.js',
            'lib/numeral/numeral.js',
            'demo/js/ZeroClipboard.js',
            'demo/js/moment/moment.js',
            'demo/js/pikaday/pikaday.js',
            'test/jasmine/lib/jasmine-extensions.js'
          ],
          helpers: [
            'test/jasmine/spec/SpecHelper.js',
            'test/jasmine/spec/MobileSpecHelper.js',
            'test/jasmine/lib/nodeShim.js',
            'test/jasmine/spec/test-init.js'
          ],
          outfile: 'test/jasmine/MobileSpecRunner.html',
          template: 'test/jasmine/templates/SpecRunner.tmpl',
          keepRunner: true
        }
      }
    },

    connect: {
      server: {
        options: {
          port: 8080,
          base: '.',
          keepalive: true
        }
      },
      sauce: {
        options: {
          port: 9999,
          base: '.',
          keepalive: false
        }
      }
    },
    'saucelabs-jasmine': {
      handsontable: {
        options: {
          urls: ['http://localhost:9999/test/jasmine/SpecRunner.html'],
          build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
          concurrency: 3,
          browsers: browsers,
          testname: 'Development test (Handsontable)'
        }
      },
      walkontable: {
        options: {
          urls: ['http://localhost:9999/src/3rdparty/walkontable/test/jasmine/SpecRunner.html'],
          build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
          concurrency: 3,
          browsers: browsers,
          testname: 'Development test (Walkontable)'
        }
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      handsontable: '<%= meta.src %>',
      walkontable: '<%= meta.walkontable %>'
    },

    jscs: {
      handsontable: {
        files: {
          src: ['<%= meta.src %>', '!src/shims/classes.js']
        }
      },
      walkontable: {
        files: {
          src: ['<%= meta.walkontable %>', '!src/shims/classes.js']
        }
      },
      options: {
        config: '.jscsrc',
        esnext: true,
        verbose: true
      }
    },

    hotBuilder: {
      handsontable: {
        files: {
          dist: 'package.json'
        }
      },
      handsontableDev: {
        files: {
          dist: 'package.json'
        },
        options: {
          devMode: true
        }
      },
      handsontableCustom: {
        files: {
          dist: 'package.json'
        },
        options: {
          disableUI: false
        }
      },
      options: {
        minify: true
      }
    }
  });

  // Default task.
  grunt.registerTask('default', ['jscs', 'jshint', 'gitinfo', 'build']);
  grunt.registerTask('build', ['hotBuilder:handsontable']);
  grunt.registerTask('build-dev', ['hotBuilder:handsontableDev']);
  grunt.registerTask('build-custom', ['hotBuilder:handsontableCustom']);
  grunt.registerTask('test', ['default', 'jasmine:handsontable', 'jasmine:walkontable', 'jasmine:mobile:build']);
  grunt.registerTask('test:handsontable', ['default', 'jasmine:handsontable']);
  grunt.registerTask('test:walkontable', ['default', 'jasmine:walkontable']);
  grunt.registerTask('test:mobile', ['default', 'jasmine:mobile:build']);
  grunt.registerTask('sauce', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable', 'saucelabs-jasmine:handsontable']);
  grunt.registerTask('sauce:handsontable', ['default', 'connect:sauce', 'saucelabs-jasmine:handsontable']);
  grunt.registerTask('sauce:walkontable', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable']);

  grunt.loadTasks('tasks');
  grunt.loadNpmTasks('hot-builder');
  grunt.loadNpmTasks('grunt-jscs');
};
<|endoftext|>


<commit_before>// Generated on 2014-07-02 using generator-angular-fullstack 1.4.3
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-ng-constant');
  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Define the configuration for all the tasks
  grunt.initConfig({

    //Environment
    ngconstant: {
      options: {
        name: 'config',
        wrap: '"use strict";\n\n{%= __ngModule %}',
        space: '  '
      },

//------------------------CONFIG----------------------------------------------------
      development: {
        options: {
          dest: '<%= yeoman.app %>/scripts/config.js',
        },
        constants: {
          ENV: 'development',
          MAXS2LEVEL:16,
          WEBSERVICE:'https://localhost:3001/v1/cells-dev',
          WEBSERVICEWIFI:'https://localhost:3002/v1/wifimeasurements-dev',

          MAPSERVER:{

             mapbox_streets_basics:{
                  url: "https://localhost:7777/tiles/mapbox-streets-basic/{z}/{x}/{y}.png",
                  type:'xyz',
                  name:'Mapbox Streets Basic',
                  options: {
                    tms: false,
                    maxZoom: 22,
                    opacity: 1
                  }
              },

              center:{
                 lat:52.060,
                 lng:4.37,
                 zoom:10
              }

          }

        }
      },
      production: {
        options: {
          dest: 'app/scripts/config.js',
        },
        constants: {
          ENV: 'production',
          WEBSERVICE:'https://localhost:3001/v1/cells',
          WEBSERVICEWIFI:'https://localhost:3002/v1/wifimeasurements',
          MAXS2LEVEL:16,
          MAPSERVER:{
               mapbox_streets_basics:{
                  url: "https://localhost:7777/tiles/mapbox-streets-basic/{z}/{x}/{y}.png",
                  type:'xyz',
                  name:'Mapbox Streets Basic',
                  options: {
                    tms: false,
                    maxZoom: 22,
                    opacity: 1
                  }
              },

              center:{
                 lat:52.060,
                 lng:4.37,
                 zoom:10
              }

          }
        }
      }
    },
//------------------------CONFIG----------------------------------------------------

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },
    express: {
      options: {
        port: process.env.PORT || 9000
      },
      dev: {
        options: {
          script: 'server.js',
          debug: true
        }
      },
      prod: {
        options: {
          script: 'dist/server.js',
          node_env: 'production'
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= express.options.port %>'
      }
    },
    watch: {
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      mochaTest: {
        files: ['test/server/{,*/}*.js'],
        tasks: ['env:test', 'mochaTest']
      },
      jsTest: {
        files: ['test/client/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        files: [
          '<%= yeoman.app %>/views/{,*//*}*.{html,jade}',
          '{.tmp,<%= yeoman.app %>}/styles/{,*//*}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*//*}*.js',
          '<%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
        ],

        options: {
          livereload: true
        }
      },
      express: {
        files: [
          'server.js',
          'lib/**/*.{js,json}'
        ],
        tasks: ['newer:jshint:server', 'express:dev', 'wait'],
        options: {
          livereload: true,
          nospawn: true //Without this option specified express won't be reloaded
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      server: {
        options: {
          jshintrc: 'lib/.jshintrc'
        },
        src: [ 'lib/{,*/}*.js']
      },
      all: [
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/client/.jshintrc'
        },
        src: ['test/client/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*',
            '!<%= yeoman.dist %>/Procfile'
          ]
        }]
      },
      heroku: {
        files: [{
          dot: true,
          src: [
            'heroku/*',
            '!heroku/.git*',
            '!heroku/Procfile'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Debugging with node inspector
    'node-inspector': {
      custom: {
        options: {
          'web-host': 'localhost'
        }
      }
    },

    // Use nodemon to run server in debug mode with an initial breakpoint
    nodemon: {
      debug: {
        script: 'server.js',
        options: {
          nodeArgs: ['--debug-brk'],
          env: {
            PORT: process.env.PORT || 9000
          },
          callback: function (nodemon) {
            nodemon.on('log', function (event) {
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function () {
              setTimeout(function () {
                require('open')('http://localhost:8080/debug?port=5858');
              }, 500);
            });
          }
        }
      }
    },

    // Automatically inject Bower components into the app
    'bower-install': {
      app: {
        html: '<%= yeoman.app %>/views/index.html',
        ignorePath: '<%= yeoman.app %>/',
        exclude: ['bootstrap-sass']
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/public/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/public/styles/{,*/}*.css',
            '<%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/styles/fonts/*',

          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    //edited HG
    useminPrepare: {
      html: ['<%= yeoman.app %>/views/index.html',
             '<%= yeoman.app %>/views/index.jade'],
      options: {
        dest: '<%= yeoman.dist %>/public',
        flow: {
          steps:{
                  'js':['concat'],
                  'css':['concat']
                },
          post:{}
        }
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/views/{,*/}*.html',
             '<%= yeoman.dist %>/views/{,*/}*.jade'],
      css: ['<%= yeoman.dist %>/public/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>/public']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      options : {
        cache: false
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          //collapseWhitespace: true,
          //collapseBooleanAttributes: true,
          //removeCommentsFromCDATA: true,
          //removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/views',
          src: ['*.html', 'partials/**/*.html'],
          dest: '<%= yeoman.dist %>/views'
        }]
      }
    },

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/views/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>/public',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'font-awesome/**/*',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>/views',
          dest: '<%= yeoman.dist %>/views',
          src: '**/*.jade'
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/public/images',
          src: ['generated/*']
        }, {
          expand: true,
          dest: '<%= yeoman.dist %>',
          src: [
            'package.json',
            'server.js',
            'lib/**/*'
          ]
        },{
          expand: true,
          cwd: '<%= yeoman.app %>/styles/images',
          dest: '<%= yeoman.dist %>/public/styles/images',
          src: ['*']

        }
        ]

      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/public/styles/main.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= yeoman.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '<%= yeoman.dist %>/scripts/scripts.js'
          ]
        }
      }
    },
    concat: {
      dist: {}
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },

    mochaTest: {
      options: {
        reporter: 'spec'
      },
      src: ['test/server/**/*.js']
    },

    env: {
      test: {
        NODE_ENV: 'test'
      }
    }
  });

  // Used for delaying livereload until after server has restarted
  grunt.registerTask('wait', function () {
    grunt.log.ok('Waiting for server reload...');

    var done = this.async();

    setTimeout(function () {
      grunt.log.writeln('Done waiting!');
      done();
    }, 500);
  });

  grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
    this.async();
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run([
        'build',
        'express:prod',
        'open',
        'express-keepalive']);
    }

    if (target === 'debug') {

      return grunt.task.run([
        'clean:server',
        'bower-install',
        'ngconstant:development',
        'concurrent:server',
        'autoprefixer',
        'concurrent:debug'
      ]);
    }

    grunt.task.run([
      'clean:server',
      'bower-install',
      'ngconstant:development',
      'concurrent:server',
      'autoprefixer',
      'express:dev',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', function(target) {
    if (target === 'server') {
      return grunt.task.run([
        'env:test',
        'mochaTest'
      ]);
    }

    else if (target === 'client') {
      return grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'karma'
      ]);
    }

    else grunt.task.run([
      'test:server',
      'test:client'
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'ngconstant:production',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    //'cssmin',
    'uglify',
    'rev',
    'usemin'
  ]);

  grunt.registerTask('heroku', function () {
    grunt.log.warn('The `heroku` task has been deprecated. Use `grunt build` to build for deployment.');
    grunt.task.run(['build']);
  });

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>updated gruntfile.js<commit_after>// Generated on 2014-07-02 using generator-angular-fullstack 1.4.3
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-ng-constant');
  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Define the configuration for all the tasks
  grunt.initConfig({

    //Environment
    ngconstant: {
      options: {
        name: 'config',
        wrap: '"use strict";\n\n{%= __ngModule %}',
        space: '  '
      },

//------------------------CONFIG----------------------------------------------------
      development: {
        options: {
          dest: '<%= yeoman.app %>/scripts/config.js',
        },
        constants: {
          ENV: 'development',
          MAXS2LEVEL:16,
          WEBSERVICE:'https://192.168.202.201:3001/v1/cellmeasurements-dev',
          WEBSERVICEWIFI:'https://192.168.202.201:3002/v1/wifimeasurements-dev',

		   MAPSERVER :

							{
								mapbox_streets_basics : {
									url : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
									type : 'xyz',
									name : 'Mapbox Streets Basic',
									options : {
										tms : false,
										maxZoom : 22,
										opacity : 1
									}
								},
								osm : {
									url : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
									type : 'xyz',
									name : 'OpenStreetMap',
									options : {
										tms : false,
										maxZoom : 22,
										opacity : 1
									}
								},
								luchtfoto : {
									url : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
									type : 'xyz',
									name : 'Luchtfoto',
									options : {
										tms : false,
										maxZoom : 20,
										opacity : 0.9
									}
								},
								center : {
									lat : 52.373750,
									lng : 6.647809,
									zoom : 10
								}
							}

						}
					},
      production: {
        options: {
          dest: 'app/scripts/config.js',
        },
        constants: {
          ENV: 'production',
          WEBSERVICE:'https://localhost:3001/v1/cells',
          WEBSERVICEWIFI:'https://localhost:3002/v1/wifimeasurements',
          MAXS2LEVEL:16,
          MAPSERVER:{
               mapbox_streets_basics:{
                  url: "https://localhost:7777/tiles/mapbox-streets-basic/{z}/{x}/{y}.png",
                  type:'xyz',
                  name:'Mapbox Streets Basic',
                  options: {
                    tms: false,
                    maxZoom: 22,
                    opacity: 1
                  }
              },

              center:{
                 lat:52.060,
                 lng:4.37,
                 zoom:10
              }

          }
        }
      }
    },
//------------------------CONFIG----------------------------------------------------

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },
    express: {
      options: {
        port: process.env.PORT || 9000
      },
      dev: {
        options: {
          script: 'cellmapping-frontend.js',
          debug: true
        }
      },
      prod: {
        options: {
          script: 'dist/cellmapping-frontend.js',
          node_env: 'production'
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= express.options.port %>'
      }
    },
    watch: {
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      mochaTest: {
        files: ['test/server/{,*/}*.js'],
        tasks: ['env:test', 'mochaTest']
      },
      jsTest: {
        files: ['test/client/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        files: [
          '<%= yeoman.app %>/views/{,*//*}*.{html,jade}',
          '{.tmp,<%= yeoman.app %>}/styles/{,*//*}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*//*}*.js',
          '<%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
        ],

        options: {
          livereload: true
        }
      },
      express: {
        files: [
          'cellmapping-frontend.js',
          'lib/**/*.{js,json}'
        ],
        tasks: ['newer:jshint:server', 'express:dev', 'wait'],
        options: {
          livereload: true,
          nospawn: true //Without this option specified express won't be reloaded
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      server: {
        options: {
          jshintrc: 'lib/.jshintrc'
        },
        src: [ 'lib/{,*/}*.js']
      },
      all: [
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/client/.jshintrc'
        },
        src: ['test/client/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*',
            '!<%= yeoman.dist %>/Procfile'
          ]
        }]
      },
      heroku: {
        files: [{
          dot: true,
          src: [
            'heroku/*',
            '!heroku/.git*',
            '!heroku/Procfile'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Debugging with node inspector
    'node-inspector': {
      custom: {
        options: {
          'web-host': 'localhost'
        }
      }
    },

    // Use nodemon to run server in debug mode with an initial breakpoint
    nodemon: {
      debug: {
        script: 'cellmapping-frontend.js',
        options: {
          nodeArgs: ['--debug-brk'],
          env: {
            PORT: process.env.PORT || 9000
          },
          callback: function (nodemon) {
            nodemon.on('log', function (event) {
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function () {
              setTimeout(function () {
                require('open')('http://localhost:8080/debug?port=5858');
              }, 500);
            });
          }
        }
      }
    },

    // Automatically inject Bower components into the app
    'bower-install': {
      app: {
        html: '<%= yeoman.app %>/views/index.html',
        ignorePath: '<%= yeoman.app %>/',
        exclude: ['bootstrap-sass']
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/public/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/public/styles/{,*/}*.css',
            '<%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/styles/fonts/*',

          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    //edited HG
    useminPrepare: {
      html: ['<%= yeoman.app %>/views/index.html',
             '<%= yeoman.app %>/views/index.jade'],
      options: {
        dest: '<%= yeoman.dist %>/public',
        flow: {
          steps:{
                  'js':['concat'],
                  'css':['concat']
                },
          post:{}
        }
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/views/{,*/}*.html',
             '<%= yeoman.dist %>/views/{,*/}*.jade'],
      css: ['<%= yeoman.dist %>/public/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>/public']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      options : {
        cache: false
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          //collapseWhitespace: true,
          //collapseBooleanAttributes: true,
          //removeCommentsFromCDATA: true,
          //removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/views',
          src: ['*.html', 'partials/**/*.html'],
          dest: '<%= yeoman.dist %>/views'
        }]
      }
    },

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/views/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>/public',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'font-awesome/**/*',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>/views',
          dest: '<%= yeoman.dist %>/views',
          src: '**/*.jade'
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/public/images',
          src: ['generated/*']
        }, {
          expand: true,
          dest: '<%= yeoman.dist %>',
          src: [
            'package.json',
            'cellmapping-frontend.js',
            'lib/**/*'
          ]
        },{
          expand: true,
          cwd: '<%= yeoman.app %>/styles/images',
          dest: '<%= yeoman.dist %>/public/styles/images',
          src: ['*']

        }
        ]

      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/public/styles/main.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= yeoman.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '<%= yeoman.dist %>/scripts/scripts.js'
          ]
        }
      }
    },
    concat: {
      dist: {}
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },

    mochaTest: {
      options: {
        reporter: 'spec'
      },
      src: ['test/server/**/*.js']
    },

    env: {
      test: {
        NODE_ENV: 'test'
      }
    }
  });

  // Used for delaying livereload until after server has restarted
  grunt.registerTask('wait', function () {
    grunt.log.ok('Waiting for server reload...');

    var done = this.async();

    setTimeout(function () {
      grunt.log.writeln('Done waiting!');
      done();
    }, 500);
  });

  grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
    this.async();
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run([
        'build',
        'express:prod',
        'open',
        'express-keepalive']);
    }

    if (target === 'debug') {

      return grunt.task.run([
        'clean:server',
        'bower-install',
        'ngconstant:development',
        'concurrent:server',
        'autoprefixer',
        'concurrent:debug'
      ]);
    }

    grunt.task.run([
      'clean:server',
      'bower-install',
      'ngconstant:development',
      'concurrent:server',
      'autoprefixer',
      'express:dev',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', function(target) {
    if (target === 'server') {
      return grunt.task.run([
        'env:test',
        'mochaTest'
      ]);
    }

    else if (target === 'client') {
      return grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'karma'
      ]);
    }

    else grunt.task.run([
      'test:server',
      'test:client'
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'ngconstant:production',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    //'cssmin',
    'uglify',
    'rev',
    'usemin'
  ]);

  grunt.registerTask('heroku', function () {
    grunt.log.warn('The `heroku` task has been deprecated. Use `grunt build` to build for deployment.');
    grunt.task.run(['build']);
  });

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<|endoftext|>


<commit_before>'use strict';

Ember.SimpleAuth.Authorizers.Base = Ember.Object.extend({
  session: null,

  authorize: function(jqXHR, requestOptions) {
  }
});
<commit_msg>docs for base authorizer<commit_after>'use strict';

/**
  The base for all authorizers. This serves as a starting point for
  implementing custom authorizers and must not be used directly.

  @class Base
  @namespace Ember.SimpleAuth.Authorizers
  @extends Ember.Object
  @constructor
*/
Ember.SimpleAuth.Authorizers.Base = Ember.Object.extend({
  /**
    The application session the authorizer get access tokens etc. from.

    @property session
    @type Ember.SimpleAuth.Session
    @default null
  */
  session: null,

  /**
    Authorizes an XHR request by adding some sort of secret information that
    allows the server to identify the user making the request (e.g. a token in
    the `Authorization` header or some other secret in the query string etc.).

    `Ember.SimpleAuth.Authorizers.Base`'s implementation does nothing as
    there's no reasonable default behavior (for Ember.SimpleAuth's default
    authorizer see Ember.SimpleAuth.Authorizers.OAuth2).

    @method authorize
    @param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR)
    @param {Object} requestOptions The options as provided to the `$.ajax` method (see http://api.jquery.com/jQuery.ajaxPrefilter/)
  */
  authorize: function(jqXHR, requestOptions) {
  }
});
<|endoftext|>