Class: Roby::CLI::Main
Class Method Summary collapse
Instance Method Summary collapse
- #add_robot(robot_name) ⇒ Object
- #check(app_dir = nil, *extra_files) ⇒ Object
- #console(*extra_files) ⇒ Object
- #init(*dir) ⇒ Object
- #quit ⇒ Object
- #wait ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
11 12 13 |
# File 'lib/roby/cli/main.rb', line 11 def self.exit_on_failure? true end |
Instance Method Details
#add_robot(robot_name) ⇒ Object
17 18 19 |
# File 'lib/roby/cli/main.rb', line 17 def add_robot(robot_name) gen("robot", robot_name) end |
#check(app_dir = nil, *extra_files) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/roby/cli/main.rb', line 192 def check(app_dir = nil, *extra_files) app = Roby.app app.app_dir = app_dir if app_dir app.require_app_dir app.setup_robot_names_from_config_dir app.robot(*[:robot].split(",")) app.single if [:single] [:set].each do |v| app.argv_set << v Roby::Application.apply_conf_from_argv(v) end begin app.setup extra_files.each do |path| app.require(File.(path)) end ensure app.cleanup end end |
#console(*extra_files) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/roby/cli/main.rb', line 221 def console(*extra_files) require "pry" app = Roby.app app.require_app_dir app.setup_robot_names_from_config_dir app.robot(*[:robot].split(",")) app.single if [:single] [:set].each do |v| app.argv_set << v Roby::Application.apply_conf_from_argv(v) end begin app.setup extra_files.each do |path| app.require(File.(path)) end pry # rubocop:disable Lint/Debugger ensure app.cleanup end end |
#init(*dir) ⇒ Object
23 24 25 |
# File 'lib/roby/cli/main.rb', line 23 def init(*dir) gen("app", *dir) end |
#quit ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/roby/cli/main.rb', line 142 def quit timeout = [:retry] if [:retry] != 0 interface = setup_interface( retry_connection: !![:retry], timeout: timeout) Robot.info "connected" interface.quit begin Robot.info "waiting for remote app to terminate" display_notifications(interface) rescue Roby::Interface::ComError Robot.info "closed communication" rescue Interrupt Robot.info "CTRL+C detected, forcing remote quit. Press CTRL+C once more to terminate this script" interface.quit display_notifications(interface) end ensure interface.close if interface && !interface.closed? end |
#wait ⇒ Object
173 174 175 176 177 178 179 |
# File 'lib/roby/cli/main.rb', line 173 def wait interface = setup_interface( retry_connection: true, timeout: [:timeout]) ensure interface.close if interface && !interface.closed? end |