def METHOD_NAME(ctx):
    packager_folder = "/packager/"
    rb_file_path = ctx.files.rb_files[0].path
    pos = rb_file_path.find(packager_folder)
    final_dirsep = rb_file_path.find("/", pos + len(packager_folder))
    test_directory = rb_file_path[0:final_dirsep]
    ctx.actions.write(
        output = ctx.outputs.executable,
        content = _GEN_PACKAGE_RUNNER_SCRIPT.format(
            runner = ctx.executable._runner.short_path,
            test_directory = test_directory,
        ),
    )
    runfiles = ctx.runfiles(ctx.files.rb_files)
    runfiles = runfiles.merge(ctx.attr._runner[DefaultInfo].default_runfiles)
    return [DefaultInfo(runfiles = runfiles)]