Class: Md::Generators::InstallGenerator
Instance Method Summary
collapse
#app_name, #apps_path, #asset_file_name, #asset_path, #entities_path, #extension, #javascript_path, #plural_entity_name, #plural_file_name, #rails_app_name, #singular_entity_name, #singular_file_name, #sub_app_file_name, #sub_app_name, #sub_app_scope, #template_path, #trackeable_directory
Instance Method Details
#create_app_file ⇒ Object
30
31
32
|
# File 'lib/generators/md/install/install_generator.rb', line 30
def create_app_file
template "app#{extension}", "#{javascript_path}/app#{extension}"
end
|
#create_dir_layout ⇒ Object
24
25
26
27
28
|
# File 'lib/generators/md/install/install_generator.rb', line 24
def create_dir_layout
trackeable_directory entities_path
trackeable_directory template_path
trackeable_directory apps_path
end
|
#inject_required_files ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/generators/md/install/install_generator.rb', line 34
def inject_required_files
manifest = File.join(javascript_path, options.manifest)
libs = %w(marionette_dust app)
paths = %w(./apps ./entities ../templates)
out = []
out << libs.map{ |lib| "//= require #{lib}" }
out << paths.map{ |path| "//= require_tree #{path}" }
out = out.join("\n") + "\n"
in_root do
create_file(manifest) unless File.exists?(manifest)
if File.open(manifest).read().include?('//= require_tree')
inject_into_file(manifest, out, before: '//= require_tree')
else
append_file(manifest, out)
end
end
end
|