Class: Yadecli::Command::Project::ProjectUninstallCommand

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

Instance Method Summary collapse

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/yadecli/command/project/project_uninstall_command.rb', line 20

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

  project = project_client.project_by_name(self.project_name)

  unless project.installed?
    puts "The project with name #{self.project_name} is not installed"
    exit 1
  end

  if options[:yes]
    really_uninstall = true
  else
    prompt = TTY::Prompt.new
    really_uninstall = prompt.yes?("Do you really want to uninstall the project #{project.name} and all it's modules? ")
  end

  FileUtils.rm_rf(project.home) if really_uninstall

  "Yade project #{project.name} successfully uninstalled from #{project.home}"
end