nom

I hate all that nasty output from sprockets that is dumped into your terminal when running rails server! Lots of people has some great ideas to eliminate it: adding the quiet_assets gem, or setting an initializer that kills the sprockets logger. However, all of these options seem to break my logs because I run with threadsafe = true. So, I had to devise my own idea and I came up with nom.

#!/usr/bin/env ruby

if ARGV[0].nil?
  puts "Tell me what to eat!!!"
  exit 1
end
 
$stdin.each_line do |line|
  if line.include? ARGV[0]
    $skipped = true
    next
  end
  next if $skipped && !(line =~ /[a-z]+/i)
  $skipped = false
  puts line
end

I just pipe my log’s output into that script and tell it to nom every like containing the work ‘assets’ and, poof, problem soloved! No need to add extra gems or jigger with the internals of logging. Just tell nom to eat whatever you don’t want to see. Stupid simple.