11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/core/commands/install.rb', line 11
def run(args=nil)
return unless Nutella.current_project.exist?
if args.empty?
console.warn 'You need to specify a template name, directory or URL'
return
end
template = args[0]
destination_dir = args.length==2 ? args[1] : nil
prj_dir = Nutella.current_project.dir
if is_template_a_local_dir? template
add_local_template( template, template, prj_dir, destination_dir )
elsif is_template_a_git_repo? template
add_remote_template( template, prj_dir, destination_dir)
elsif is_template_in_db? template
add_central_template( template, prj_dir, destination_dir)
else
console.warn 'The specified template is not a valid nutella template'
end
end
|