def run(desc, &block)
puts "\n#{desc} start @ #{Time.now}"
block.call
if !$?.nil?
warn "#{desc} fail" unless $?.success?
puts "#{desc} #{$?.success? ? 'success' : 'fail'} @ #{Time.now}"
exit $?.exitstatus unless $?.success?
end
end
run "cd" do
system 'mkdir test' unless File.exist?('test')
system "cd test"
end
run "ls" do
system "ls"
end
其实主要是不知道block该怎么改写
1
ming2281 2015-04-07 00:19:26 +08:00
没有缩进,没有"食欲"啊
|