Sha256: 37164a333576fcb5a5fdb0f3297bd252d25d22fd1b7506e141e0494aed567b0c

Contents?: true

Size: 1.09 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
xezat-0.3.1 lib/xezat/command/bump/file.rb
xezat-0.3.0 lib/xezat/command/bump/file.rb
xezat-0.2.3 lib/xezat/command/bump/file.rb
xezat-0.2.2 lib/xezat/command/bump/file.rb
xezat-0.2.1 lib/xezat/command/bump/file.rb