23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/blocks/fileutil.rb', line 23
def run
Dir.chdir(@projectDir) do
if @type == :touch
puts "Touching #{@arg1}" if @echo
FileUtils.touch(@arg1)
elsif @type == :move
puts "Moving #{@arg1} to #{@arg2}" if @echo
Dir.glob(@arg1).each {|f| FileUtils.mv(f, @arg2)}
elsif @type == :copy
puts "Copying #{@arg1} to #{@arg2}" if @echo
Dir.glob(@arg1).each {|f| FileUtils.cp_r(f, @arg2)}
elsif @type == :remove
puts "Removing #{@arg1}" if @echo
Dir.glob(@arg1).each {|f| FileUtils.rm_rf(f)}
elsif @type == :makedir
puts "Making #{@arg1}" if @echo
FileUtils.mkdir_p(@arg1)
end
end
return true
end
|