Sha256: a844245488211b5f8af3c15b7553734a015742fa18f4656d2488f2eb40f4ab7f

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

require 'yaml'
require 'erb'

require 'rails/service/core_ext/deep_struct'

module Rails
  module Service
    module Manifest
      module_function

      def new(options = {})
        path = options.fetch(:path)
        logger = options.fetch(:logger)

        path = Rails.root.join(path)
        if File.exist?(path)
          file = File.read(path)
          logger.info("loading manifest file: #{path}")
          DeepStruct.new(YAML.load(ERB.new(file).result))
        else
          logger.warn("manifest file not found: #{path}")
          nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-service-0.2.0 lib/rails/service/manifest.rb
rails-service-0.1.0 lib/rails/service/manifest.rb