Class: Appifier::Components::Templates
- Inherits:
-
Object
- Object
- Appifier::Components::Templates
- Extended by:
- Carioca::Injector
- Defined in:
- lib/appifier/components/templates.rb
Class Method Summary collapse
Class Method Details
.list ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/appifier/components/templates.rb', line 10 def self.list output.info "List of avaible templates for user : #{current_user} :" template_path = File.(Appifier::DEFAULT_TEMPLATES_PATH) Dir.glob("#{template_path}/*").map { |item| item.delete_prefix("#{template_path}/") }.each do |template| output.item "#{template}" end end |
.rm(template) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/appifier/components/templates.rb', line 18 def self.rm(template) output.info "Removing template #{template} for user : #{current_user} :" template_path = File.(Appifier::DEFAULT_TEMPLATES_PATH) begin if File::exist? "#{template_path}/#{template}" FileUtils.rm_rf "#{template_path}/#{template}" output.ok "Template #{template} deleted of bundle for user #{current_user}" else raise "Template #{template} not found in bundle for user #{current_user}" end rescue Errno::ENOENT raise "Template #{template} not found in bundle for user #{current_user}" end end |