module Pwrake::FileUtils
Public Instance Methods
bq(*cmd, &block)
click to toggle source
# File lib/pwrake/branch/file_utils.rb, line 29 def bq(*cmd, &block) options = (Hash === cmd.last) ? cmd.pop : {} unless block_given? show_command = cmd.join(" ") show_command = show_command[0,42] + "..." block = lambda { |ok, status| ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]" } end if RakeFileUtils.verbose_flag == :default options[:verbose] = true else options[:verbose] ||= RakeFileUtils.verbose_flag end options[:noop] ||= RakeFileUtils.nowrite_flag Rake.rake_check_options options, :noop, :verbose Rake.rake_output_message cmd.join(" ") if options[:verbose] unless options[:noop] res,status = Pwrake::FileUtils.pwrake_backquote(*cmd) block.call(res, status) end res end
pwrake_backquote(cmd)
click to toggle source
Pwrake
version of backquote command
# File lib/pwrake/branch/file_utils.rb, line 67 def pwrake_backquote(cmd) conn = Pwrake::Shell.current if conn.kind_of?(Pwrake::Shell) res = conn.backquote(*cmd) status = Rake::PseudoStatus.new(conn.status) else res = `#{cmd}` status = $? status = Rake::PseudoStatus.new(1) if status.nil? end [res,status] end
pwrake_system(*cmd)
click to toggle source
# File lib/pwrake/branch/file_utils.rb, line 53 def pwrake_system(*cmd) conn = Pwrake::Shell.current if conn.kind_of?(Pwrake::Shell) res = conn.system(*cmd) status = Rake::PseudoStatus.new(conn.status) else res = system(*cmd) status = $? status = Rake::PseudoStatus.new(1) if !res && status.nil? end [res,status] end
sh(*cmd, &block)
click to toggle source
# File lib/pwrake/branch/file_utils.rb, line 6 def sh(*cmd, &block) options = (Hash === cmd.last) ? cmd.pop : {} unless block_given? show_command = cmd.join(" ") show_command = show_command[0,42] + "..." block = lambda { |ok, status| ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]" } end if RakeFileUtils.verbose_flag == :default options[:verbose] = true else options[:verbose] ||= RakeFileUtils.verbose_flag end options[:noop] ||= RakeFileUtils.nowrite_flag Rake.rake_check_options options, :noop, :verbose Rake.rake_output_message cmd.join(" ") if options[:verbose] unless options[:noop] res,status = Pwrake::FileUtils.pwrake_system(*cmd) block.call(res, status) end end