Module: Ready::CLI::RakeCommand

Included in:
Clobber, Compile, Up
Defined in:
lib/ready/cli/rake_command.rb

Overview

Shared behaviour for sub-commands that delegate to the project's Rakefile (up, clobber, and compile all).

Rake is run under the same Ruby that is running ready, inheriting whatever Bundler context exe/ready established: in a development checkout a Gemfile is present, so exe/ready has already required bundler/setup (propagated to the rake process and the ready compile sub-processes it spawns via RUBYOPT); in production there is no Gemfile, so the build runs bundler-free and resolves the installed gem through RubyGems.

Instance Method Summary collapse

Instance Method Details

#rake(*tasks) ⇒ Object

Runs the given rake task(s) in Ready.root and exits non-zero if rake fails.

Parameters:

  • tasks (Array<String>)

    The rake task name(s) to run.



23
24
25
26
27
28
29
# File 'lib/ready/cli/rake_command.rb', line 23

def rake(*tasks)
  return if system(RbConfig.ruby, "-S", "rake", *tasks, chdir: Ready.root.to_s)

  # Propagate rake's own exit status where we can; fall back to 1 if the
  # process could not be spawned at all ($? unset).
  exit($CHILD_STATUS&.exitstatus || 1)
end