Sha256: e5956b139aea95ce49c7ecc11ea3cdcde84449385a0a0e5cee81829e7ab60bfc

Contents?: true

Size: 570 Bytes

Versions: 2

Compression:

Stored size: 570 Bytes

Contents

require "pathname"

module Manpages
  class ManFiles
    attr_reader :man_dir

    def initialize(gem_dir, target_dir)
      @target_dir = Pathname(target_dir)
      @man_dir = Pathname(File.join(gem_dir, "man"))
    end

    def manpages
      return [] unless man_dir.directory?

      man_dir.children(false).select do |file|
        file.extname =~ /.\d$/
      end.map {|file| man_dir.join(file) }
    end

    def man_file_path(file)
      man_section = file.extname.match(/\.(\d*)/)
      @target_dir.join("man#{man_section[1]}", file.basename)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
manpages-0.5.0 lib/manpages/man_files.rb
manpages-0.4.0 lib/manpages/man_files.rb