Skip to content

Instantly share code, notes, and snippets.

@ram-nadella
Created January 10, 2013 00:14
Show Gist options
  • Save ram-nadella/4498233 to your computer and use it in GitHub Desktop.
Save ram-nadella/4498233 to your computer and use it in GitHub Desktop.
Watch the apps folder in cf-www and run jake to regenerate the minified and concatenated JS file. Send a Growl notification when done.
#!/usr/bin/env ruby
require "rubygems"
require "fssm"
require "ruby-growl"
=begin
Watch apps js files for changes and automatically generate
a merged cloudflare-apps.js file using jake
Run using: ruby watch_apps_js.rb
(Assumes that the file is located at the root of cf-www)
=end
puts "Watching apps js changes\n"
path_to_apps = "./source/javascripts/library/apps"
FSSM.monitor(path_to_apps) do
update { |base, relative|
puts "\n\n"
puts "#{relative} changed"
puts "\n"
# jake the file
begin
system("jake module apps js")
rescue
puts "Exception"
end
puts "** Generated new cloudflare-apps js (#{Time.now}) **\n"
# send a Growl notification
growl = Growl.new("192.168.2.124", "CF Apps Build Script", ["ruby-growl Notification"])
growl.notify("ruby-growl Notification", "CF Apps Build Script Status", "Generated new cloudflare-apps js\n #{Time.now}")
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment