use whenerver to generate a cron ERB template

53 views
Skip to first unread message

thei...@gmail.com

unread,
Feb 25, 2014, 6:13:59 AM2/25/14
to whenev...@googlegroups.com
Hi

! love whenever but in a clever-only-to-me move I'm tried to generate a cron file with erb placeholders.

It is because I'm plan to feed the whenever generated file to erb in order to fill these placeholders.

There are so many of them and there are some stored as arrays in my stuff that's because I'm not using the "set" to copy my actual variables. (a matter of lazyness perhaps, but that's another way to say do not repeat yourself)

So my problem is that whenerver scapes the ' and the % which I plan to be erb code.

So... Is it possible to tell whenever in schedule.erb not to scape ' and % in a string?

someting like:

every 2.day, at: "00:00" do
  command "curl http://localhost:8080/cron.php?cron_key=" + do_not_scape_for_cron_this_stuff('<%= secrets[stage]['drupal']['cron_key'] %>')
end

Many thanks

Javan Makhmali

unread,
Feb 25, 2014, 10:11:39 AM2/25/14
to whenev...@googlegroups.com
Could you do the ERB processing first? Render your schedule.erb file into schedule.rb and hand that off to Whenever.


--
--
You received this message because you are subscribed to the Google
Groups "Whenever Gem" group and because you're awesome.
To post to this group, send email to whenev...@googlegroups.com
To unsubscribe from this group, send email to
whenever-gem...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/whenever-gem?hl=en
---
You received this message because you are subscribed to the Google Groups "Whenever Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to whenever-gem...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Carlos Peñas

unread,
Feb 26, 2014, 4:37:58 AM2/26/14
to whenev...@googlegroups.com

Could you do the ERB processing first? Render your schedule.erb file into schedule.rb and hand that off to Whenever.
 
That could be a nice workarround... Now what I'm doing is replicate the code which loads my needed variables into schedule.rb which is a workarround too but mine is more coupled. I'll switch to doing what you suggest but only if whenevers's DSL lacks of this feature.
 
So... Is it possible to tell whenever in schedule.erb not to scape ' and % in a string?

someting like:

every 2.day, at: "00:00" do
  command "curl http://localhost:8080/cron.php?cron_key=" + do_not_scape_for_cron_this_stuff('<%= secrets[stage]['drupal']['cron_key'] %>')
end

I'm still intrested in knowing if this is possible or could be achieved without patching the gem.
 

Many thanks
 
Again

Javan Makhmali

unread,
Feb 26, 2014, 10:36:01 AM2/26/14
to whenev...@googlegroups.com
It's not possible. Whenever generates crontab-ready output so those characters will always be escaped.


Reply all
Reply to author
Forward
0 new messages