lib/faastruby/cli/template.rb in faastruby-0.5.28 vs lib/faastruby/cli/template.rb in faastruby-0.5.29

- old
+ new

@@ -39,10 +39,16 @@ FaaStRuby::CLI.error("Could not clone repository #{repo} into #{local_dir}") unless system("git clone #{repo} #{local_dir}") end def install_from_folder(folder) + folder = File.expand_path(folder) + folder_exists = File.directory?(folder) + folder_exists ? install_from_folder_run(folder) : FaaStRuby::CLI.error("Could not find folder #{folder}") + end + + def install_from_folder_run(folder) if File.directory?(target) puts "! d #{@output_prefix}#{target}".yellow else FileUtils.mkdir_p(target) puts "+ d #{@output_prefix}#{target}".green @@ -51,11 +57,10 @@ full_source_path = "#{folder}/#{entry}" full_target_path = "#{target}/#{entry}" create_dir(full_target_path) if File.directory?(full_source_path) copy_file(source: full_source_path, destination: full_target_path) if File.file?(full_source_path) end - end def create_dir(dir) if File.directory?(dir) puts "! d #{@output_prefix}#{dir}".yellow @@ -85,6 +90,6 @@ def github? type == 'github' end end -end \ No newline at end of file +end