Skip to content

Instantly share code, notes, and snippets.

@denniskuczynski
Created June 21, 2012 20:02
Show Gist options
  • Save denniskuczynski/2968202 to your computer and use it in GitHub Desktop.
Save denniskuczynski/2968202 to your computer and use it in GitHub Desktop.
Example Rake task to process ERB version of Monit Configuration File to leverage Ruby in the Config
namespace :monit do
desc 'Generate the monit configuration'
task :generate do
require 'erb'
PWD = ENV['PWD']
CONFIG_TEMPLATE = File.join(PWD, 'config', 'monit.cfg.erb')
templ = ERB.new(File.read(CONFIG_TEMPLATE))
CONFIG = File.join(PWD, 'monit.cfg')
File.open(CONFIG, 'w') {|f| f.write(templ.result) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment