Method: Roby::Application.guess_app_dir

Defined in:
lib/roby/app.rb

.guess_app_dirString?

Guess the app directory based on the current directory

Returns:

  • (String, nil)

    the base of the app, or nil if the current directory is not within an app



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/roby/app.rb', line 348

def self.guess_app_dir
    if (test_dir = ENV["ROBY_APP_DIR"])
        unless Application.is_app_dir?(test_dir)
            raise InvalidRobyAppDirEnv,
                  "the ROBY_APP_DIR envvar is set to #{test_dir}, but this "\
                  "is not a valid Roby application path"
        end

        return test_dir
    end

    path = Pathname.new(Dir.pwd).find_matching_parent do |candidate|
        Application.is_app_dir?(candidate.to_s)
    end
    path&.to_s
end