Sha256: c7c2c0c60249f782b4354dae7e146fb8b83401776c5df59168ffe30501c726d0

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'logcabin'

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

  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 = {})
      params[:file] ||= DEFAULT_FILE
      list = List.new(params)
      dsl = ListDSL.new(list, params)
      dsl.instance_eval(File.read(params[:file]), params[: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

4 entries across 4 versions & 1 rubygems

Version Path
prospectus-0.0.5 lib/prospectus.rb
prospectus-0.0.4 lib/prospectus.rb
prospectus-0.0.3 lib/prospectus.rb
prospectus-0.0.2 lib/prospectus.rb