module Reviser::Helpers::Project
Provide useful methods for projects evaluation as well as a naming module for custom regexes
@author Renan Strauss @author Yann Prono
Public Instance Methods
files()
click to toggle source
@return all the files in the project’s folder
# File lib/reviser/helpers/project.rb, line 63 def files Dir.glob("**/*").select { |f| (File.file?(f)) } end
manufacture(&block)
click to toggle source
Yields a new Result
for the criteria to define an out value for each format
# File lib/reviser/helpers/project.rb, line 78 def manufacture &block format = Result.new block.call format format end
missing_files()
click to toggle source
Check if the project has all files needed
# File lib/reviser/helpers/project.rb, line 43 def missing_files dir = Dir['*'] # # Check if there is any regexp # If it's the case, if any file # matches, we delete the entry # for diff to work properly # Cfg[:required_files].each_with_index do |e, i| if dir.any? { |f| (e.respond_to?(:match)) && (e =~ f) } Cfg[:required_files].delete_at i end end Cfg[:required_files] - dir end
prepare()
click to toggle source
For interpreted languages We only check for missing files
# File lib/reviser/helpers/project.rb, line 38 def prepare missing_files.empty? && 'None' || res end
sources()
click to toggle source
@return all the files matching the project’s language extension(s)
# File lib/reviser/helpers/project.rb, line 70 def sources files.select { |f| Cfg[:extension].include? File.extname(f) } end