# File lib/gem2rpm/rpm_file_list.rb, line 39 def main_entries self.class.new(entries.delete_if { |f| (f.doc? && !f.license?) || f.misc? || f.test? }) end
Returns a new file list created from the array of files (e.g. Gem2Rpm::Specification.files).
# File lib/gem2rpm/rpm_file_list.rb, line 9 def initialize(files) @items = files.map { |f| RpmFile.new(f) } end
Returns new list of files suitable for -doc subpackage.
# File lib/gem2rpm/rpm_file_list.rb, line 44 def doc_entries self.class.new(entries.delete_if { |f| !((f.doc? && !f.license?) || f.misc? || f.test?) }) end
Calls the given block once for each element in self, passing that element as a parameter. Returns the array itself. If no block is given, an Enumerator is returned.
# File lib/gem2rpm/rpm_file_list.rb, line 16 def each # Return Enumerator when called withoug block. return to_enum(__callee__) unless block_given? @items.each { |item| yield item } end
Returns new list of files suitable for main.
# File lib/gem2rpm/rpm_file_list.rb, line 39 def main_entries self.class.new(entries.delete_if { |f| (f.doc? && !f.license?) || f.misc? || f.test? }) end
Returns a new array containing the items in self for which the given block is not true. The ordering of non-rejected elements is maintained. If no block is given, an Enumerator is returned instead.
# File lib/gem2rpm/rpm_file_list.rb, line 26 def reject # Return Enumerator when called withoug block. return to_enum(__callee__) unless block_given? self.class.new(@items.reject { |item| yield item }) end
Returns string with all files from the list converted into entries suitable for RPM .spec file. Thise entries should include all necessary macros depending on file categorization.
# File lib/gem2rpm/rpm_file_list.rb, line 51 def to_rpm entries.map(&:to_rpm).join("\n") end
Returns a list of top level directories and files, omit all subdirectories.
# File lib/gem2rpm/rpm_file_list.rb, line 34 def top_level_entries self.class.new(entries.map { |f| f.gsub!(/([^\/]*).*/, '\1') }.uniq) end