Method: Roby::Application#require_robot_file

Defined in:
lib/roby/app.rb

#require_robot_fileObject



2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
# File 'lib/roby/app.rb', line 2183

def require_robot_file
    p = find_file("config", "robots", "#{robot_name}.rb", order: :specific_first) ||
        find_file("config", "robots", "#{robot_type}.rb", order: :specific_first)

    if p
        @default_auto_load = false
        require p
        unless robot_type
            robot(robot_name, robot_name)
        end
    elsif !find_dir("config", "robots", order: :specific_first) || (robot_name == robots.default_robot_name) || !robots.strict?
        Roby.warn "#{robot_name}:#{robot_type} is selected as the robot, but there is"
        if robot_name == robot_type
            Roby.warn "no file named config/robots/#{robot_name}.rb"
        else
            Roby.warn "neither config/robots/#{robot_name}.rb nor config/robots/#{robot_type}.rb"
        end
        Roby.warn "run roby gen robot #{robot_name} in your app to create one"
        Roby.warn "initialization will go on, but this behaviour is deprecated and will be removed in the future"
    else
        raise NoSuchRobot, "cannot find config file for robot #{robot_name} of type #{robot_type} in config/robots/"
    end
end