Sha256: e8c699c6b95de40323b9fedda5bda6ddd609dd0a3dc2ea44e5340614a7d4231f

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true
require 'logcabin'

##
# Tool and DSL for checking expected vs actual state
module Prospectus
  DEFAULT_FILE = './.prospectus'.freeze

  class << self
    ##
    # Insert a helper .new() method for creating a new Cache object
    def new(*args)
      self::List.new(*args)
    end

    ##
    # Method for loading list from DSL
    def load_from_file(params = {})
      file = params[:file] || DEFAULT_FILE
      list = List.new(params)
      dsl = ListDSL.new(list, params)
      dsl.instance_eval(File.read(file), file)
      list
    end

    def modules
      @modules ||= LogCabin.new(load_path: load_path(:modules))
    end

    def helpers
      @helpers ||= LogCabin.new(load_path: load_path(:helpers))
    end

    def extra_dep(name, dep)
      require dep
    rescue LoadError
      raise("The #{name} module requires the #{dep} gem")
    end

    private

    def gem_dir
      Gem::Specification.find_by_name('prospectus').gem_dir
    end

    def load_path(type)
      File.join(gem_dir, 'lib', 'prospectus', type.to_s)
    end
  end
end

require 'prospectus/version'
require 'prospectus/list'
require 'prospectus/item'
require 'prospectus/state'

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
prospectus-0.2.0 lib/prospectus.rb
prospectus-0.1.1 lib/prospectus.rb
prospectus-0.1.0 lib/prospectus.rb
prospectus-0.0.15 lib/prospectus.rb
prospectus-0.0.13 lib/prospectus.rb
prospectus-0.0.12 lib/prospectus.rb
prospectus-0.0.11 lib/prospectus.rb
prospectus-0.0.10 lib/prospectus.rb
prospectus-0.0.9 lib/prospectus.rb
prospectus-0.0.8 lib/prospectus.rb