Sha256: f54eafd3eb0e1bff88a8be52338f7728cd05db6ed27cb99672da4d335ef24db5

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 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('../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.6 lib/space/config.rb
space-0.0.5 lib/space/config.rb
space-0.0.4 lib/space/config.rb