Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
grunt-monty-python
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f1701c26
authored
2016-02-18 11:23:16 -0600
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add support for jasmine.
1 parent
7c0a2e88
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
grunt-monty-python.js
package.json
grunt-monty-python.js
View file @
f1701c2
...
...
@@ -391,6 +391,92 @@ module.exports = function (grunt) {
}
};
}
if
(
mpConfig
.
jasmine
)
{
var
src
=
[
mpConfig
.
base
+
'/scripts/{,**/}*.js'
,
'!'
+
mpConfig
.
base
+
'/scripts/main.js'
,
];
var
specs
=
[
mpConfig
.
base
+
'/scripts/**/*.spec.js'
,
];
var
template
=
require
(
'grunt-template-jasmine-requirejs'
);
var
templateOptions
=
{
requireConfigFile
:
mpConfig
.
base
+
'/scripts/config.js'
,
requireConfig
:
{
baseUrl
:
mpConfig
.
base
+
'/scripts'
,
},
};
if
(
mpConfig
.
jasmine
.
withCoverage
)
{
templateOptions
.
requireConfig
.
callback
=
function
()
{
/* global requirejs:false */
var
oldLoad
=
requirejs
.
load
;
requirejs
.
load
=
function
(
context
,
moduleName
,
url
)
{
//console.log('context=' + JSON.stringify(arguments), 'moduleName=' + moduleName, 'url=' + url);
var
parts
=
url
.
split
(
'/'
);
for
(
var
i
=
0
;
i
<
parts
.
length
;
)
{
var
part
=
parts
[
i
];
if
(
part
===
'.'
)
{
parts
.
splice
(
i
,
1
);
}
else
if
(
part
===
''
)
{
parts
.
splice
(
i
,
1
);
}
else
if
(
part
===
'..'
)
{
if
(
i
>
0
)
{
i
--
;
parts
.
splice
(
i
,
2
);
}
else
{
parts
.
splice
(
i
,
1
);
}
}
else
{
i
++
;
}
}
url
=
parts
.
join
(
'/'
);
if
(
url
.
indexOf
(
mpConfig
.
base
+
'/scripts/'
)
===
0
)
{
url
=
'./.grunt/grunt-contrib-jasmine/'
+
url
;
}
return
oldLoad
.
apply
(
this
,
[
context
,
moduleName
,
url
]);
};
};
templateOptions
=
{
coverage
:
'dist/coverage/coverage.json'
,
report
:
'dist/coverage'
,
replace
:
false
,
template
:
_
.
extend
({},
template
,
{
process
:
(
function
(
origProcess
)
{
return
function
process
(
grunt
,
task
,
context
)
{
var
src
=
[];
context
.
scripts
.
src
.
forEach
(
function
(
file
)
{
if
(
!
grunt
.
file
.
isMatch
(
specs
,
file
))
{
src
.
push
(
file
);
}
});
context
.
scripts
.
src
=
src
;
return
origProcess
.
apply
(
this
,
arguments
);
};
})(
template
.
process
),
}),
templateOptions
:
templateOptions
,
files
:
_
.
concat
([],
src
,
specs
),
};
template
=
require
(
'grunt-template-jasmine-istanbul'
);
}
initConfig
.
jasmine
=
{
options
:
{
template
:
template
,
templateOptions
:
templateOptions
,
},
all
:
{
src
:
_
.
concat
([],
src
,
specs
),
options
:
{
specs
:
specs
,
},
},
};
}
if
(
mpConfig
.
css
)
{
initConfig
.
copy
.
css
=
{
...
...
package.json
View file @
f1701c2
...
...
@@ -24,11 +24,14 @@
"grunt-contrib-jshint"
:
"~0"
,
"grunt-contrib-htmlmin"
:
"~0"
,
"grunt-contrib-imagemin"
:
"~0"
,
"grunt-contrib-jasmine"
:
""
,
"grunt-contrib-requirejs"
:
"~0"
,
"grunt-contrib-uglify"
:
"~0"
,
"grunt-jscs"
:
""
,
"grunt-rev"
:
"~0"
,
"grunt-svgmin"
:
"~0"
,
"grunt-template-jasmine-istanbul"
:
""
,
"grunt-template-jasmine-requirejs"
:
""
,
"grunt-usemin"
:
"~2"
,
"jshint-stylish"
:
"~0"
,
"load-grunt-tasks"
:
"~0"
,
...
...
Please
register
or
sign in
to post a comment