class MutatorRails::Cleanup
Attributes
guide[R]
guide_keys[R]
Public Class Methods
new(*)
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 10 def initialize(*) excluded_files @guide = Guide.new @guide_keys = guide.guides.keys end
Public Instance Methods
call()
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 16 def call Dir .glob(APP_BASE + '**/*.rb') .each do |file| next if exclude?(file) check(file) end guide_keys.each do |file| File.delete(file) if File.exist?(file) puts "removing #{file}" guide.remove(file) end end
Private Instance Methods
check(file)
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 34 def check(file) log = file.sub(APP_BASE, Config.configuration.logroot).sub('.rb','.log') if guide_keys.include?(log) guide_keys.delete(log) end end
exclude?(file)
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 54 def exclude?(file) excluded_files.include?(file) end
excluded_files()
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 42 def excluded_files @exclusions ||= load_exclusions end
load_exclusions()
click to toggle source
# File lib/mutator_rails/cleanup.rb, line 46 def load_exclusions MutatorRails::Config .configuration .exclusions .compact .flat_map { |exclusion| Dir.glob(exclusion) } end