class Object
Public Instance Methods
main(listen_to, options)
click to toggle source
# File bin/slimwatch, line 10 def main(listen_to, options) # Initial run Dir.glob("#{ listen_to }/*.slim").each do |filepath| slim_it filepath, options end # Now listen Listen.to(listen_to, :filter => /\.slim$/) do |modified, added, removed| modified.each do |filepath| puts "Updating html file for #{ filepath }" slim_it(filepath, options) end added.each do |filepath| puts "Creating html file for #{ filepath }" slim_it(filepath, options) end removed.each do |filepath| # end end puts "Monitoring #{ listen_to } for changes to .slim files" while true do # set up a loop so we don't exit sleep 5 end end
slim_it(filename, options)
click to toggle source
# File bin/slimwatch, line 41 def slim_it(filename, options) infile = filename outfile = infile.sub(/\.slim$/, '') outfile<< '.html' unless outfile =~ /\.html?$/ system("slimrb #{ options } #{ infile } > #{ outfile }") end