Module: Slim2html

Defined in:
lib/slim2html.rb,
lib/slim2html/version.rb

Constant Summary collapse

VERSION =
"0.3.3"

Class Method Summary collapse

Class Method Details

.convert!(input) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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