Created
August 21, 2013 09:50
-
-
Save silentworks/6292522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var generateAngularTemplate = require('./../utils/generate-angular-template'); | |
| // Adds html tempalate in $templateCache and writes file to destFile | |
| // | |
| // $templateCache key is the filepath passed in as srcFile: | |
| // options.prependPrefix + options.srcFile.replace(stripPrefix, '') | |
| // | |
| // grunt.initConfig({ | |
| // ngtemplatecache: { | |
| // app: { | |
| // options: { | |
| // stripPrefix: '' | |
| // prependPrefix: '', | |
| // cacheIdFromPath: function(filepath) { | |
| // // gets set as $tempalteCache key | |
| // return filepath; | |
| // } | |
| // }, | |
| // files: { | |
| // destFile: srcFile | |
| // } | |
| // } | |
| // } | |
| // }); | |
| module.exports = function(grunt) { | |
| grunt.task.registerMultiTask('ngtemplatecache', | |
| 'Put angular templates in $templateCache.', function() { | |
| var options = this.options({ | |
| prependPrefix: '', | |
| stripPrefix: '' | |
| }); | |
| var stripPrefix = new RegExp('^' + options.stripPrefix); | |
| var prependPrefix = options.prependPrefix; | |
| var cacheIdFromPath = options.cacheIdFromPath ||function (filepath) { | |
| return prependPrefix + filepath.replace(stripPrefix, ''); | |
| }; | |
| this.files.map(function(el) { | |
| var filepath = el.src[0]; | |
| var htmlPath = cacheIdFromPath(filepath); | |
| var content = grunt.file.read(filepath); | |
| var template = generateAngularTemplate({ | |
| moduleName: options.moduleName, | |
| htmlPath: htmlPath, | |
| content: content | |
| }); | |
| grunt.file.write(el.dest, template); | |
| }); | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| module.exports = function(grunt) { | |
| grunt.registerTask('protractor', 'Run integration tests', function() { | |
| var done = this.async(); | |
| var opts = this.options(); | |
| var protractor = grunt.util.spawn({ | |
| cmd: 'protractor', | |
| args: [opts.configFile] | |
| }, function(err, result, code) { | |
| done(code === 0); | |
| }); | |
| protractor.stdout.pipe(process.stdout); | |
| protractor.stderr.pipe(process.stderr); | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment