Module: Appifier::Helpers::Templates

Defined in:
lib/appifier/helpers/templates.rb

Instance Method Summary collapse

Instance Method Details

#list_bundled_templatesObject



6
7
8
9
10
11
# File 'lib/appifier/helpers/templates.rb', line 6

def list_bundled_templates
  template_path = File.expand_path(Appifier::DEFAULT_TEMPLATES_PATH)
  Dir.glob("#{template_path}/*").map { |item| item.delete_prefix("#{template_path}/") }.each do |template|
    puts " * #{template}"
  end
end

#rm_bundled_template(template) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/appifier/helpers/templates.rb', line 13

def rm_bundled_template(template)
  template_path = File.expand_path(Appifier::DEFAULT_TEMPLATES_PATH)
  begin
    if FileUtils.rm_rf "#{template_path}/#{template}"
      puts "[RM] Template #{template} deleted of bundle for user #{current_user}"
    else
      puts "[ERROR] Template #{template} not found in bundle for user #{current_user}"
    end
  rescue Errno::ENOENT
    puts "[ERROR] Template #{template} not found in bundle for user #{current_user}"
  end
end