Open bobjackman opened 11 years ago
I'll check it out! I've noticed this issue with the full test-suite, but it worked last time I ran them individually.
I'll check again!
Any updates on this front?
Dude, I've been messing with it for over an hour today and this crap isn't working.
Doing something as simple as the following doesn't even work!!
grunt.log.writeln = function(message) {
console.log('Overrode', message);
return grunt.log;
};
grunt.log.writeln("Message");
// undefined
Nvm, more crap messing up, brb...
I think I've got it fixed!
Well crap, there's more to it. I'm going to rewrite this stupid thing to be simpler, since Hooker doesn't work as it should anymore.
So basically, I check grunt.log.header
to figure out if the task has modified verbosity, then overwrite grunt.log.writeln
to do whatever you want (DOT, ONELINE, HIDDEN, etc.), then bail back out when grunt.log.header
, grunt.log.fail
or grunt.log.success
is called.
In otherwords, I made it too complicated from the beginning by using Hooker.
I just bumped to v0.2.0
, which is a lot simpler code. Let me know how it works for you!
$ grunt
Running "jshint:all" (jshint) task
>> 3 files lint free.
Running "verbosity:hidden" (verbosity) task
Running "log:test" (log) task
Running "log:clear" (log) task
Log message #1
Running "verbosity:oneline" (verbosity) task
Running "log:test" (log) task
Log message #5
Running "log:clear" (log) task
Log message #1
Running "verbosity:normal" (verbosity) task
Running "log:test" (log) task
Log message #1
Log message #2
Log message #3
Log message #4
Log message #5
Running "log:clear" (log) task
Log message #1
Running "verbosity:dot" (verbosity) task
Running "log:test" (log) task
.....
Running "log:clear" (log) task
Log message #1
Thanks for updating! Just checked it out, but it looks like something is still getting fubar'd.
--verbose
outputRegistering "grunt-verbosity" local Npm module tasks.
Reading D:\Code\project\node_modules\grunt-verbosity\package.json...OK
Parsing D:\Code\project\node_modules\grunt-verbosity\package.json...OK
Loading "verbosity_task.js" tasks...OK
+ verbosity
Loading "Gruntfile.js" tasks...OK
+ _start, build:only, projectInfo
Running tasks: build:only
Running "build:only" task
Running "_start" task
Running "verbosity:default" (verbosity) task
Verifying property verbosity.default exists in config...OK
File: [no files]
Verifying property verbosity.default.tasks exists in config...OK
Warning: Cannot call method 'indexOf' of null Use --force to continue.
At this point it dies. Here are the relevant parts of my gruntfile (not the complete file)
gruntfile.js
module.exports = function( grunt ) {
grunt.initConfig({
verbosity: {
default: {
options: { mode: 'dot' }, // normal, oneline, dot, hidden
tasks: ['groundskeeper', 'requirejs']
}
},
// Remove any dev/debugging code
groundskeeper: {
default: { ... },
options: { ... }
},
// Optimize modules using requirejs
requirejs: {
build: {
options: { ... }
}
}
});
grunt.registerTask( '_start', ['verbosity:default', 'projectInfo'] );
grunt.registerTask( 'build:only', ['_start', 'groundskeeper', 'requirejs'] );
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-groundskeeper');
grunt.loadNpmTasks('grunt-verbosity');
};
Just published v0.2.1
. Try now!
Still no go...
grunt build:only
Running "verbosity:default" (verbosity) task
Running "groundskeeper:default" (groundskeeper) task
Running "requirejs:build" (requirejs) task
Tracing dependencies for: app
Uglifying file: D:/Code/project/release/app.js
D:/Code/project/release/app.js
----------------
D:/Code/project/release/lib/jquery.js
D:/Code/project/release/lib/handlebars.js
D:/Code/project/release/lib/ember/ember.js
D:/Code/project/release/lib/require/text.js
<snip 500 lines>
timers.js:103
if (!process.listeners('uncaughtException').length) throw e;
^
TypeError: Cannot read property 'length' of undefined
at Verbosity.writeln (D:\Code\project\node_modules\grunt-verbosity\tasks\lib\verbosity.js:54:16)
at Object.fail.report (D:\Code\project\node_modules\grunt\lib\grunt\fail.js:82:15)
at Object.grunt.tasks.task.options.done (D:\Code\project\node_modules\grunt\lib\grunt.js:140:12)
at Task.<anonymous> (D:\Code\project\node_modules\grunt\lib\util\task.js:261:25)
at Task.<anonymous> (D:\Code\project\node_modules\grunt\lib\util\task.js:215:7)
at Object.Task.runTaskFn.context.async [as _onTimeout] (D:\Code\project\node_modules\grunt\lib\util\task.js:225:33)
at Timer.list.ontimeout (timers.js:101:19)
BAM, v0.2.2
. Turns out, you have a lot of undefined
writeln()
commands that I wasn't testing for.
TRY NOW, TROUBLEMAKER!
Looks like all the errors have been resolved, but now I'm just getting normal, full output, not "dots" as configured. I've also tried "oneline" and "hidden" but it just always outputs as if in "normal" mode.
What is it about what I'm doing that's so much different than how you're testing?
You're not using the verbose flag every time are you?
Otherwise, I don't know what other scripts you're running to generate output. Perhaps they don't use grunt.log.writeln?
Eric Clemmons Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Monday, August 26, 2013 at 4:56 PM, KOGI wrote:
Looks like all the errors have been resolved, but now I'm just getting normal, full output, not "dots" as configured. I've also tried "oneline" and "hidden" but it just always outputs as if in "normal" mode. What is it about what I'm doing that's so much different than how you're testing?
— Reply to this email directly or view it on GitHub (https://github.com/ericclemmons/grunt-verbosity/issues/4#issuecomment-23298383).
No, I'm not using verbose. The only other scripts running are already down in my previous posts. Requirejs is making the most noise. ATM I have no idea the mechanism they're using for output.
Your project wouldn't be open-source, would it? :)
Otherwise, I may need to wrap several other commands that are being used by requirejs. Does that seem right?
Unfortunately, although free, it's not open source. But my scripts aren't creating the output... Requires is making all the noise. Unless I'm missing something?
Eric Clemmons notifications@github.com wrote:
Your project wouldn't be open-source, would it? :)
Otherwise, I may need to wrap several other commands that are being used by requirejs. Does that seem right?
— Reply to this email directly or view it on GitHub.
Could you at least setup a simple project for me to test against? I think I know the culprit, but it'll take a lot more for me to guess at what you're actual problem is rather than fixing your test case.
I figure a Gruntfile.js
, package.json
, grunt-verbosity
, grunt-contrib-requirejs
and some sample JS files would be enough, right?
I may have to go back to grunt.util.hooker
, which works now in grunt v0.4.2...
I'm trying to use this package, but running into an odd behavior. If I use any mode other than
normal
(i.e.oneline
ordot
), I just get a blank line of output:However, if I use
--verbose
on the command line, then I do, indeed, see the behavior that I expect.Do you see this issue? What info do you need from me?