Class: EhbrsRubyUtils::Vg::Nds::Organizer
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Vg::Nds::Organizer
show all
- Defined in:
- lib/ehbrs_ruby_utils/vg/nds/organizer.rb,
lib/ehbrs_ruby_utils/vg/nds/organizer/pub_file.rb,
lib/ehbrs_ruby_utils/vg/nds/organizer/rom_file.rb,
lib/ehbrs_ruby_utils/vg/nds/organizer/base_file.rb,
lib/ehbrs_ruby_utils/vg/nds/organizer/save_file.rb,
lib/ehbrs_ruby_utils/vg/nds/organizer/file_manager.rb
Defined Under Namespace
Classes: BaseFile, FileManager, PubFile, RomFile, SaveFile
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
11
12
13
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 11
def errors
@errors
end
|
Instance Method Details
#add_files ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 15
def add_files
self.errors = {}
reset_cache(:file_manager)
::Find.find(roms_root) do |path|
pathname = path.to_pathname
next unless pathname.file?
file_manager.add_file(pathname).if_present do |error|
errors[pathname] = error
end
end
end
|
#clean_empty_directories ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 28
def clean_empty_directories
runner.infom 'Cleaning empty directories?'
return unless confirm?
roms_root.to_pathname.children.each do |child|
::EacFs::Utils.remove_empty_directories(child)
end
end
|
37
38
39
40
41
42
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 37
def perform
file_manager.to_change_files.each do |file|
file.show if show?
file.perform if confirm?
end
end
|
44
45
46
47
48
49
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 44
def perform_all
add_files
show_changes if show?
perform
clean_empty_directories
end
|
#show_changes ⇒ Object
51
52
53
54
|
# File 'lib/ehbrs_ruby_utils/vg/nds/organizer.rb', line 51
def show_changes
file_manager.to_change_files.each(&:show)
runner.infov 'To change files', file_manager.to_change_files.count
end
|