Sha256: 3fcf33fcbc8475cf2171c0ec53ef32f62e16766c7d17ccacf36274e1430a4175

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

module Evertils
  module Common
    module Entity
      class Stack < Entity::Base
        def create_from_yml(full_path)
          begin
            nb = Notebook.new

            if File.exist? full_path
              conf = YAML::load(File.open(full_path))
              required = %w(name children)

              if has_required_fields(conf, required)
                if !conf["children"].nil?
                  conf["children"].each do |name|
                    nb.create(name, conf["name"])
                  end
                end
              else
                raise ArgumentError, 'Configuration file is missing some required fields'
              end
            else
              raise ArgumentError, "File not found: #{full_path}"
            end
          rescue ArgumentError => e
            puts e.message
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evertils-common-0.3.2 lib/evertils/common/entity/stack.rb