module Slim2html

Constants

VERSION

Public Class Methods

convert!(input) click to toggle source
# File lib/slim2html.rb, line 5
def self.convert!(input)
  @dir = input
  @dir = @dir.gsub(/\/\z/,  '')
  if @dir == "." then
    @dir = `pwd`
  end

  @newDir = @dir + "_html"
  FileUtils.rm_rf(@newDir) if FileTest.exist?(@newDir)
  FileUtils.cp_r(@dir, @newDir)

  Dir.glob(@newDir + "/**/*.slim") do |slim|
    @html = slim.gsub(/\.slim\z/, '.html')
    `slimrb -p #{slim} > #{@html}`
    File.delete slim
    puts "Made #{@html}"
  end
end