module Propro::Package
Constants
- EXTRACT_NAME_RE
- SORTED_NAMES
Public Instance Methods
resort!(ary)
click to toggle source
# File lib/propro/package.rb, line 70 def resort!(ary) ary.sort_by! { |source| SORTED_NAMES.index(source.name) } ary end
root()
click to toggle source
# File lib/propro/package.rb, line 43 def root File.join(Propro.root, 'ext/bash') end
source_files()
click to toggle source
# File lib/propro/package.rb, line 47 def source_files @source_files ||= Dir[File.join(root, '**/*.sh')] end
sources()
click to toggle source
# File lib/propro/package.rb, line 51 def sources @sources ||= begin names = SORTED_NAMES.dup source_files.each do |file| name = EXTRACT_NAME_RE.match(file)[1] names.push(name) unless names.include?(name) end names.map { |name| Source.new(name) } end end
sources_for_path(path)
click to toggle source
# File lib/propro/package.rb, line 62 def sources_for_path(path) resort! sources.select { |source| /\A#{path}/ =~ source.name } end
sources_for_paths(*paths)
click to toggle source
# File lib/propro/package.rb, line 66 def sources_for_paths(*paths) resort! paths.flatten.map { |path| sources_for_path(path) }.flatten end