The base class which all commands subclass to obtain services from.
# File lib/piston/command.rb, line 11 def initialize(non_options, options) @args = non_options # Because the Windows shell does not process wildcards, we must do it # here ourselves @args.collect! do |arg| next arg unless arg =~ /[*?]/ Dir[arg] end options.each do |option, value| self.send("#{option}=", value) end end
# File lib/piston/command.rb, line 57 def find_targets targets = Array.new svn(:propget, '--recursive', Piston::ROOT).each_line do |line| next unless line =~ /^([^ ]+)\s-\s.*$/ targets << $1 end targets end
Returns an IO-like object to which all information should be logged.
# File lib/piston/command.rb, line 48 def logging_stream @logging_stream ||= $stdout end
# File lib/piston/command.rb, line 52 def skip(dir, msg, header=true) logging_stream.print "Skipping '#{dir}': " if header logging_stream.puts msg end
Run a Subversion command using the shell. If the Subversion command returns an existstatus different from zero, a RuntimeError is raised.
# File lib/piston/command.rb, line 28 def svn(*args) args = args.flatten.compact.map do |arg| if arg.to_s =~ /[ *?@]/ then %("#{arg}") else arg end end command = "svn #{args.join(' ')}" logging_stream.puts command if verbose return if dry_run ENV['LANGUAGE'] = 'en_US' result = `#{command}` logging_stream.puts result if verbose raise "Command #{command} resulted in an error:\n\n#{result}" unless $?.exitstatus.zero? result end
Generated with the Darkfish Rdoc Generator 2.