Closed ZuBB closed 10 years ago
Hi,
i didn't try any of the combination, anyway a quick fix would be to use the __dirname
global to point to the folder where your Gruntfile resides.
With path
module you can have cross platform path format too:
var path = require('path');
console.log(path.normalize(__dirname + '/path/file.txt'));
Hi!
Your comment did not help me, but still get a hint to me where to go.. But I could not get anything of it
Best case which get some info is next
attachments: [{
filePath: __dirname + grunt.file.expand(grunt.config.get('vars.dest') + '*')[0]
}]
In the log there is next line
Running "nodemailer:send" (nodemailer) task
[D] Task source: /home/vv/work/own/js/uos/ads/node_modules/grunt-nodemailer/tasks/nodemailer.js
Verifying property nodemailer.send exists in config...OK
File: [no files]
Options: transport={"type":"SMTP","options":{"service":"Gmail","auth":{"user":"...@gmail.com","pass":"..."}}}, message={"from":"...","to":"...","cc":"","bcc":"","subject":"ads: new developer build","text":"\n\nEmail sent by ASH robat v2.","attachments":[{"filePath":"/home/vv/work/own/js/uos/adsundefined"}]}, recipients=[], from="", subject="", html="", text=""
Sending 1 e-mail to recipients: ...
Message sent successfully.
Its obvious that second part of filepath value is 'broken'. All examples that I found in the internet is using static pathes (or hardcoded; same as you btw). I am sending with help of grunt file that has dynamic name. Today this is build/output/ads.dev.master-61.ajs
and tomorrow that will be build/output/ads.dev.master-62.ajs
for example.
I tried different cases and it looks like that grunt's config (and its values respectively) becomes unavailable at some level.
Hope you will give me one more hint because I am out of ideas..
Just for the record I was able to get this working with next line
7 grunt.config('nodemailer.options.message.attachments',
6 [{filePath: grunt.file.expand(grunt.config('vars.dest') + '*')[0]}]);
None values from below does not work except first
Any idea how to make this does its job?