Sha256: 647199b2ce5ff21c1ec922ffbe296fd806d5991281535c7079d5fbb095083759

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/hash/keys'
require 'erb'
require 'yaml'

module Mikoshi
  class Plan
    class Base
      attr_reader :data, :client

      def initialize(yaml_path: nil, client: nil)
        raise ArgumentError, 'Yaml file path is required.' if yaml_path.nil?
        raise ArgumentError, 'client is required.' if client.nil?

        @data = YAML.safe_load(ERB.new(File.new(yaml_path).read).result).deep_symbolize_keys
        @client = client
      end

      def invoke_hooks(hooks)
        hooks.each do |hook|
          system hook
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mikoshi-0.2.0 lib/mikoshi/plan.rb