Provide run_rake method in commands

Overview

The following discussion from !4350 (merged) should be addressed:

  • @splattael started a discussion:

    Question Thoughts on making this feature more generic for all commands?

We have multiple places where we want to execute a rake task from commands and want to get a boolean true/false whether the task was successful.

Implementation plan

Let’s add a generic run_rake method in lib/gdk/command/base_command.rb and use it in commands where we have run_rake_* methods already.

def run_rake(name, **args)
  Rake::Task[name].invoke(**args)
  true
rescue RuntimeError => e
  out.error(e.message)
  false
end