lib/roku_builder/controller.rb in roku_builder-3.11.0 vs lib/roku_builder/controller.rb in roku_builder-3.11.1

- old
+ new

@@ -26,16 +26,20 @@ # Load Config load_code, config, configs = ConfigManager.load_config(options: options, logger: logger) ErrorHandler.handle_load_codes(options: options, load_code: load_code, logger: logger) + # Check Configs + configs_code = validate_configs(configs: configs) + ErrorHandler.handle_configs_codes(configs_code: configs_code, logger: logger) + # Check devices device_code, configs = check_devices(options: options, config: config, configs: configs, logger: logger) ErrorHandler.handle_device_codes(device_code: device_code, logger: logger) # Run Commands - command_code = execute_commands(options: options, config: config, configs: configs, logger: logger) + command_code = execute_commands(options: options, configs: configs, logger: logger) ErrorHandler.handle_command_codes(command_code: command_code, logger: logger) end # Validates the user options # @param options [Hash] The options hash @@ -100,14 +104,25 @@ end VALID end private_class_method :validate_depricated_commands + # Validate config hash + # @param configs [Hash] The Configs hash + # @return [Integer] Status code for command validation + def self.validate_configs(configs:) + unless Dir.exist?(configs[:out][:folder]) + return MISSING_OUT_FOLDER + end + VALID + end + private_class_method :validate_configs + # Run commands # @param options [Hash] The options hash # @return [Integer] Return code for options handeling # @param logger [Logger] system logger - def self.execute_commands(options:, config:, configs:, logger:) + def self.execute_commands(options:, configs:, logger:) command = (commands & options.keys).first if ControllerCommands.simple_commands.keys.include?(command) params = ControllerCommands.simple_commands[command] params[:configs] = configs params[:logger] = logger