Class: Nutella::Install
- Inherits:
-
TemplateCommand
- Object
- Command
- TemplateCommand
- Nutella::Install
- Defined in:
- lib/commands/install.rb
Instance Method Summary collapse
Methods inherited from TemplateCommand
#validate_nutella_file_json, #validate_template
Instance Method Details
#run(args = nil) ⇒ Object
10 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 38 39 40 |
# File 'lib/commands/install.rb', line 10 def run(args=nil) # If the current directory is not a nutella application, return unless Nutella.current_app.exist? console.warn 'The current directory is not a nutella application' return end # Check args 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 # Extract application directory app_path =Dir.pwd # What kind of template are we handling? if is_template_a_local_dir? template add_local_template( template, template, app_path, destination_dir ) elsif is_template_a_git_repo? template add_remote_template( template, app_path, destination_dir) elsif is_template_in_db? template add_central_template( template, app_path, destination_dir) else console.warn 'The specified template is not a valid nutella template' end end |