Class: Yadecli::Command::Composer::ComposerUninstallCommand

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

Instance Method Summary collapse

Instance Method Details

#executeObject



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

def execute
  composer_project_client = Yade::Composer::Rest::Client::ComposerProjectClient.new

  composer_project = composer_project_client.get_by_name(project_name)

  answer = false
  unless options[:yes]
    prompt = TTY::Prompt.new
    answer = prompt.yes?("Do you really want to uninstall the #{composer_project.project_name} composer project?".colorize(:mode => :bold))
  end

  if options[:yes] || answer
    FileUtils.rm_rf(composer_project.install_dir)
  else
    puts 'There is nothing more I can do for you. Bye.'
    exit(1)
  end

  'Composer project successfully uninstalled'
end