Created
June 21, 2012 20:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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