Class: MutatorRails::Cleanup

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/mutator_rails/cleanup.rb

Instance Method Summary collapse

Constructor Details

#initializeCleanup

Returns a new instance of Cleanup.



10
11
12
13
14
# File 'lib/mutator_rails/cleanup.rb', line 10

def initialize(*)
  excluded_files
  @guide = Guide.new
  @guide_keys = guide.guides.keys
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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