Sha256: 6543c743c77732fb13a2e424bfd9baa1bbe7db7f1c790cd444bf41363c4d19ed

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'xezat'

module Xezat
  class IllegalStateError < StandardError
  end

  module Command
    class Bump
      def get_files(variables)
        Xezat.logger.debug('Collect files')
        pkg2files = {}
        variables[:pkg_name].each do |pkg_name|
          Xezat.logger.debug("  Collect #{pkg_name}")
          lst_file = File.expand_path(File.join(variables[:T], ".#{pkg_name}.lst"))
          raise IllegalStateError, "No such file: #{lst_file}" unless FileTest.readable?(lst_file)

          lines = File.readlines(lst_file)
          lines.delete_if do |path|
            path.strip!
            path[-1] == File::SEPARATOR # ignore directory
          end
          lines.map! do |path|
            File::SEPARATOR + path
          end
          if variables[:PN] == pkg_name
            readme = File::SEPARATOR + File.join('usr', 'share', 'doc', 'Cygwin', "#{pkg_name}.README")
            lines << readme.strip unless lines.include?(readme)
          end
          pkg2files[pkg_name.intern] = lines.sort
        end
        pkg2files
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xezat-0.2.0 lib/xezat/command/bump/file.rb
xezat-0.1.2 lib/xezat/command/bump/file.rb