Skip to content
Browse files

changing conf option names to support sending in pre-load steal optio…

…ns to the template
  • Loading branch information...
1 parent af97fef commit 5506dc54fde0b33935b2fa8db7c7caf4ec3b7803 @jaredstehler-cengage jaredstehler-cengage committed May 6, 2013
Showing with 32 additions and 17 deletions.
  1. +1 −1 Gruntfile.js
  2. +16 −4 README.md
  3. +1 −1 package.json
  4. +2 −6 src/template-jasmine-steal.js
  5. +12 −5 src/templates/jasmine-steal.html
View
2 Gruntfile.js
@@ -52,7 +52,7 @@ module.exports = function(grunt) {
host: 'http://127.0.0.1:<%= connect.test.options.port %>/',
template : require('./'),
templateOptions: {
- stealOptions : {
+ steal : {
map: {
'test': '../../test'
}
View
20 README.md
@@ -9,17 +9,26 @@ npm install grunt-template-jasmine-steal --save-dev
## Template Options
-### templateOptions.stealOptions.stealUrl
+### templateOptions.steal.url
Type: `String`
Default: path to steal.js (defaults to internal version, probably not desired)
The steal script to use.
-### templateOptions.stealOptions.map
+### templateOptions.steal.map
Type: `Object`
This object is `JSON.stringify()`-ed into the template and passed into `steal.map()`
+### templateOptions.steal.executed
+Type: `Object`
+
+This object is `JSON.stringify()`-ed into the template and passed into `steal.executed()`
+
+### templateOptions.steal.options
+Type: `Object`
+
+This object is `JSON.stringify()`-ed into the template and set as the default steal options object in the page, before steal is loaded.
## Sample usage
@@ -44,10 +53,13 @@ grunt.initConfig({
host: 'http://127.0.0.1:<%= connect.test.options.port %>/',
template: require('grunt-template-jasmine-steal'),
templateOptions: {
- stealOptions: {
- stealUrl: 'src/steal/steal.js',
+ steal: {
+ url: 'src/steal/steal.js',
map: {
'.grunt': '../.grunt'
+ },
+ options: {
+ logLevel: 3
}
}
}
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "grunt-template-jasmine-steal",
- "version": "0.3.0",
+ "version": "0.3.1",
"description": "StealJS template for grunt-contrib-jasmine",
"main": "src/template-jasmine-steal.js",
"scripts": {
View
8 src/template-jasmine-steal.js
@@ -9,7 +9,7 @@ var template = __dirname + '/templates/jasmine-steal.html',
exports.process = function(grunt, task, context) {
context.options.stealOptions = context.options.stealOptions || {};
- var stealUrl = context.options.stealOptions.stealUrl;
+ var stealUrl = context.options.steal.url;
// find the latest version if none given
if (!stealUrl) {
@@ -18,7 +18,7 @@ exports.process = function(grunt, task, context) {
var stealRoot = stealUrl.substring(0, stealUrl.indexOf('steal/steal.js'));
- context.options.stealOptions.stealUrl = stealUrl;
+ context.options.steal.url = stealUrl;
context.fn = {
pathify: function(s) {
@@ -35,10 +35,6 @@ exports.process = function(grunt, task, context) {
}
};
- context.options.stealOptions.config = grunt.util._.extend({
-
- }, context.options.stealOptions.config);
-
// put steal into place
task.copyTempFile(steal['3.2.3'] + '/steal.js','steal/steal.js');
task.copyTempFile(steal['3.2.3'] + '/dev/dev.js','steal/dev/dev.js');
View
17 src/templates/jasmine-steal.html
@@ -4,16 +4,23 @@
<meta charset="utf-8">
<title>Jasmine Spec Runner</title>
- <script src="<%= options.stealOptions.stealUrl %>"></script>
- <% if (options.stealOptions.map) { %>
+ <% if(options.steal.options) { %>
<script>
- steal.map(<%= JSON.stringify(options.stealOptions.map) %>);
+ steal = <%= JSON.stringify(options.steal.options) %>
</script>
<% } %>
- <% if(options.stealOptions.executed) { %>
+ <script src="<%= options.steal.url %>"></script>
+
+ <% if (options.steal.map) { %>
+ <script>
+ steal.map(<%= JSON.stringify(options.steal.map) %>);
+ </script>
+ <% } %>
+
+ <% if(options.steal.executed) { %>
<script>
- <% options.stealOptions.executed.forEach(function(script) { %>
+ <% options.steal.executed.forEach(function(script) { %>
steal.executed("<%= script %>");
<% }) %>
</script>

0 comments on commit 5506dc5

Please sign in to comment.
Something went wrong with that request. Please try again.