class Classifile::Execute
execute
Public Instance Methods
classify(dsl_path, from_paths, to_path)
click to toggle source
copy(dsl_path, from_paths, to_path)
click to toggle source
Classify
the files by DSL. However, the original file will remain.
# File lib/classifile/execute.rb, line 29 def copy(dsl_path, from_paths, to_path) classify(dsl_path, from_paths, to_path).each do |ft| FileTools.move(ft.from, ft.to, copy: true) ft.after_save_procs.each(&:call) end end
move(dsl_path, from_paths, to_path)
click to toggle source
Classify
the files by DSL.
# File lib/classifile/execute.rb, line 19 def move(dsl_path, from_paths, to_path) classify(dsl_path, from_paths, to_path).each do |ft| FileTools.move(ft.from, ft.to) ft.after_save_procs.each(&:call) end end
test(dsl_path, from_paths, to_path)
click to toggle source
Classify
the files by DSL. However, it does not actually move the file, but outputs the mv command as a string.
# File lib/classifile/execute.rb, line 11 def test(dsl_path, from_paths, to_path) classify(dsl_path, from_paths, to_path).each do |ft| puts "mv \"#{ft.from}\" \"#{ft.to}\" " end end
Private Instance Methods
_classify(dsl, from_path, to_path)
click to toggle source
# File lib/classifile/execute.rb, line 50 def _classify(dsl, from_path, to_path) arr = [] cfy = Classify.new FileTools.get_file_list(from_path).each do |from_file| result = cfy.run(TargetFile.build_by_file(from_file), File.expand_path(to_path)) do eval dsl # rubocop:disable all end arr << result if result end arr end