Class: Yadecli::Command::Module::ModuleInstallCommand

Inherits:
Mutations::Command
  • Object
show all
Defined in:
lib/yadecli/command/module/module_install_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/yadecli/command/module/module_install_command.rb', line 23

def execute
  project_client = Yade::Project::Rest::Client::ProjectClient.new
  project_module_client = Yade::Project::Rest::Client::ProjectModuleClient.new

  project = project_client.project_by_name(project_name)

  if options[:all]
    project_modules = project_module_client.modules_for_project(project.id)

    project_modules.each do |project_module|
      install_module(project_module, options)
    end
  else
    self.module_names.each do |module_name|
      project_module = project_module_client.module_for_project(project.id, module_name)

      install_module(project_module, options)
    end
  end
  puts ''

  "Module(s) installed successfully"
end