Class: Plasmoid::WebkitGenerator

Inherits:
Generator show all
Defined in:
lib/plasmoid/webkit_generator.rb

Instance Attribute Summary

Attributes inherited from Generator

#description, #homepage, #options, #project_name, #summary, #target_dir, #user_email, #user_name

Instance Method Summary collapse

Methods inherited from Generator

#create_version_control, #initialize, #run, run!

Methods included from Generator::TemplateHelper

included, #mkdir, #prefix_dir, #render_template, #template_dir, #write_template

Constructor Details

This class inherits a constructor from Plasmoid::Generator

Instance Method Details

#create_filesObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/plasmoid/webkit_generator.rb', line 3

def create_files
  puts "Creating files in #{target_dir}"
  FileUtils.mkpath(target_dir)

  Find.find(template_dir) do |path|
    dest = path.sub(template_dir, "")

    next if path =~ /^\.+$/ || dest.empty? || path =~ /~$/
    if File.directory?(path)
      mkdir(dest)
    else
      write_template(dest, dest)
    end
  end

  if options[:use_haml]
    Dir.chdir(target_dir) do
      Dir.glob(File.join("contents/**/**/*.html")) do |path|
        dest = path + ".haml"
        puts dest
        system("html2haml '#{path}' '#{dest}'")
        File.unlink path
      end
    end
  end
end