require 'fileutils'

module Sinatra
  module AssetSnack
    extend InstanceMethods

    def self.precompile!
      self.assets.each do |assets|
        path = File.join(self.app.public_dir, assets[:route])
        FileUtils.mkdir_p File.dirname(path)
        File.open(path, 'w') do |file|
          file.write compile(assets[:paths])[:body]
        end
      end
    end
  end
end


require 'fileutils'

module Sinatra
  module AssetSnack
    def self.precompile!
      snack = self
      Module.new do
        extend snack::InstanceMethods
        snack.assets.each do |assets|
          path = File.join(snack.app.public_dir, assets[:route])
          FileUtils.mkdir_p File.dirname(path)
          File.open(path, 'w') do |file|
            file.write compile(assets[:paths])[:body]
          end
        end
      end
    end
  end
end


Extend anonymous module instead of AssetSnack itself; also be more explicit about it to appease Travis
Extend anonymous module instead of AssetSnack itself; also be more explicit about it to appease Travis
