Sha256: ea17f0be7f37c0dc6581c25ba9a8f9b6836e5334e112ad832455c5ec8354ac1e

Contents?: true

Size: 863 Bytes

Versions: 4

Compression:

Stored size: 863 Bytes

Contents

require 'yaml'

# MetaServices are collections of services
class Lurker::MetaService
  attr_reader :meta_service_dir

  def initialize(meta_service_dir)
    @meta_service_dir = File.expand_path(meta_service_dir)

    service_path = Dir["#{meta_service_dir}/*.lurker.meta"].first
    @schema = if service_path
      YAML.load_file(service_path)
    else
      {}
    end
  end

  def empty?
    @schema.empty?
  end

  def services
    @schema['services'].map do |path|
      service_path = if path.start_with?('/') || path.start_with?('~')
        path
      else
        File.join(meta_service_dir, path)
      end
      serv = Lurker::Service.new(service_path)
      serv.meta_service = self
      serv
    end
  end

  def name
    @schema['name']
  end

  def description
    @schema['description']
  end

  def discussion
    @schema['discussion']
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lurker-0.5.3 lib/lurker/meta_service.rb
lurker-0.5.2 lib/lurker/meta_service.rb
lurker-0.5.1 lib/lurker/meta_service.rb
lurker-0.5.0 lib/lurker/meta_service.rb