Skip to content

Commit

Permalink
first import
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAhmed committed Oct 23, 2010
0 parents commit f34d3c2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README
@@ -0,0 +1,3 @@
Puppet-Growl

Automatic syntax checking for your puppet manifests, instant notifications to your desktop using Growl
30 changes: 30 additions & 0 deletions puppet-growl.rb
@@ -0,0 +1,30 @@
#!/usr/bin/ruby -w

require 'rubygems'
require 'em-dir-watcher'
require 'ruby-growl'

# Growl host to send notifications to, make sure to allow the following in Growl preferences:
# Listen for incoming connections, allow remote application registeration
host = "127.0.0.1"
# Dir to watch puppet manifests, could be your puppet manifests under development
dir = "/etc/puppet"

EM.run {
dw = EMDirWatcher.watch File.expand_path(dir), :include_only => ['*.pp'] do |paths|
paths.each do |path|
full_path = File.join(dir, path)
puts "Full Path: #{full_path}"

result = `puppet --parseonly #{full_path}`.chomp

g = Growl.new host, "ruby-growl", ["ruby-growl Notification"]
if result.any?
g.notify "ruby-growl Notification", "Puppet", "Syntax Problem, Manifest #{full_path}: #{result}"
else
g.notify "ruby-growl Notification", "Puppet", "Manifest #{full_path}: Syntax OK"

end
end
end
}

0 comments on commit f34d3c2

Please sign in to comment.