module Polisher::RPM::SpecGemFiles

Public Class Methods

included(base) click to toggle source
# File lib/polisher/rpm/spec/gem_files.rb, line 11
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

excluded_files() click to toggle source

Return list of files in upstream gem which have not been included

# File lib/polisher/rpm/spec/gem_files.rb, line 43
def excluded_files
  # TODO: also append files marked as %{exclude} (or handle elsewhere?)
  missing_files_for(upstream_gem)
end
excludes_file?(file) click to toggle source

Return boolean indicating if the specified file is on excluded list

# File lib/polisher/rpm/spec/gem_files.rb, line 49
def excludes_file?(file)
  excluded_files.include?(file)
end
extra_gem_files(gem = nil) click to toggle source

Return extra package file not in the specified gem

# File lib/polisher/rpm/spec/gem_files.rb, line 54
def extra_gem_files(gem = nil)
  gem ||= upstream_gem
  pkg_extra = {}
  pkg_files.each do |pkg, files|
    extra = files.select { |spec_file| !gem.has_file_satisfied_by?(spec_file) }
    pkg_extra[pkg] = extra unless extra.empty?
  end
  pkg_extra
end
missing_files_for(gem) click to toggle source

Return list of gem files for which we have no corresponding spec files

# File lib/polisher/rpm/spec/gem_files.rb, line 36
def missing_files_for(gem)
  # we check for files in the gem for which there are no spec files
  # corresponding to gem file or directory which it resides in
  gem.file_paths.select { |gem_file| missing_gem_file?(gem_file) }
end
missing_gem_file?(gem_file) click to toggle source

Return bool indicating if spec is missing specified gemfile.

# File lib/polisher/rpm/spec/gem_files.rb, line 31
def missing_gem_file?(gem_file)
  files.none? { |spec_file| self.class.file_satisfies?(spec_file, gem_file) }
end