Method: Roby::Application#needs_to_be_in_current_app

Defined in:
lib/roby/app.rb

#needs_to_be_in_current_app(allowed_outside: true) ⇒ Object

Call to check whether the current directory is within #app_dir. If not, raises

This is called by tools for which being in another app than the currently selected would be really too confusing



402
403
404
405
406
407
408
409
410
411
# File 'lib/roby/app.rb', line 402

def needs_to_be_in_current_app(allowed_outside: true)
    guessed_dir = self.class.guess_app_dir
    if guessed_dir && (@app_dir != guessed_dir)
        raise NotInCurrentApp,
              "#{@app_dir} is currently selected, " \
              "but the current directory is within #{guessed_dir}"
    elsif !guessed_dir && !allowed_outside
        raise NotInCurrentApp, "not currently within an app dir"
    end
end