lib/rush/dir.rb in rush-0.1 vs lib/rush/dir.rb in rush-0.2

- old
+ new

@@ -116,29 +116,39 @@ files.select do |file| !file.hidden? end end + # Run a bash command starting in this directory. + def bash(command) + box.bash "cd #{full_path} && #{command}" + end + + # Destroy all of the contents of the directory, leaving it fresh and clean. + def purge + connection.purge full_path + end + # Text output of dir listing, equivalent to the regular unix shell's ls command. def ls out = [ "#{self}" ] nonhidden_dirs.each do |dir| - out << " #{dir.name}+" + out << " #{dir.name}/" end nonhidden_files.each do |file| out << " #{file.name}" end out.join("\n") end # Run rake within this dir. def rake(*args) - system "cd #{full_path}; rake #{args.join(' ')}" + bash "rake #{args.join(' ')}" end # Run git within this dir. def git(*args) - system "cd #{full_path}; git #{args.join(' ')}" + bash "git #{args.join(' ')}" end include Rush::Commands def entries