Sha256: 2c5af203dc47378188e94b584f94a08d39e10cca1b4817c5c13225445797e8b8

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 Bytes

Contents

module Space
  class Config < Hashr
    class << self
      def load(name)
        new(YAML.load(File.read(path(name))))
      end

      private

        def path(name)
          path = paths(name).detect { |path| File.exists?(path) }
          path || raise("Could not find #{name}.yml at either of ~/.space/#{name}.yml and ./.space/#{name}.yml")
        end

        def paths(name)
          %w(. ~).map { |path| File.expand_path("#{path}/.space/#{name}.yml") }
        end
    end

    define :template_dir => File.expand_path('../view/templates', __FILE__)

    def paths
      @paths ||= repositories.map { |path| base_dir ? "#{base_dir}/#{path}" : path }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
space-0.0.9 lib/space/config.rb
space-0.0.8 lib/space/config.rb
space-0.0.7 lib/space/config.rb