Sha256: 0a43376e3dc8c22c77345ff5e9b29ddaa9956ff1fe9790f7a65c9e5cac173656

Contents?: true

Size: 800 Bytes

Versions: 16

Compression:

Stored size: 800 Bytes

Contents

require 'yaml'

module Rundock
  module Builder
    class TaskBuilder < Base
      DEFAULT_TASKS_FILE_PATH = './tasks.yml'

      def build(scenario_tasks)
        tasks = {} unless scenario_tasks

        return scenario_tasks unless @options[:tasks]
        if FileTest.exist?(@options[:tasks])
          tasks.merge!(YAML.load_file(@options[:tasks]).deep_symbolize_keys)
          Logger.info("merged tasks file #{@options[:tasks]}")
        elsif FileTest.exist?(DEFAULT_TASKS_FILE_PATH)
          Logger.warn("tasks file is not found. use #{DEFAULT_TASKS_FILE_PATH}")
          tasks.merge!(YAML.load_file(DEFAULT_TASKS_FILE_PATH).deep_symbolize_keys)
        else
          Logger.warn("Task path is not available. (#{@options[:tasks]})")
        end

        tasks
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rundock-1.1.5 lib/rundock/builder/task_builder.rb
rundock-1.1.4 lib/rundock/builder/task_builder.rb
rundock-1.1.3 lib/rundock/builder/task_builder.rb
rundock-1.1.2 lib/rundock/builder/task_builder.rb
rundock-1.1.1 lib/rundock/builder/task_builder.rb
rundock-1.1.0 lib/rundock/builder/task_builder.rb
rundock-1.0.8 lib/rundock/builder/task_builder.rb
rundock-1.0.7 lib/rundock/builder/task_builder.rb
rundock-1.0.6 lib/rundock/builder/task_builder.rb
rundock-1.0.5 lib/rundock/builder/task_builder.rb
rundock-1.0.4 lib/rundock/builder/task_builder.rb
rundock-1.0.2 lib/rundock/builder/task_builder.rb
rundock-1.0.1 lib/rundock/builder/task_builder.rb
rundock-1.0.0 lib/rundock/builder/task_builder.rb
rundock-0.5.8 lib/rundock/builder/task_builder.rb
rundock-0.5.7 lib/rundock/builder/task_builder.rb