Class: MHaml::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/generators/mhaml/install/install_generator.rb

Instance Method Summary collapse

Methods included from Helpers

#app_path, #asset_path, #js_path

Instance Method Details

#create_dirObject



33
34
35
36
# File 'lib/generators/mhaml/install/install_generator.rb', line 33

def create_dir
  template_dir = options[:template_dir]
  empty_directory "#{app_path}/#{template_dir}"
end

#inject_mustacheObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/mhaml/install/install_generator.rb', line 17

def inject_mustache
  manifest = options[:manifest]
  template_dir = options[:template_dir]

  create_file("#{js_path}/#{manifest}") unless File.exists?("#{js_path}/#{manifest}")

  append_to_file "#{js_path}/#{manifest}" do
    out = ""
    out << "//= require mustache"
    out << "\n"
    out << "//= require_tree ../../#{template_dir}"
    out << "\n"
    out << "\n"
  end
end