lib/scide/screen.rb in scide-0.0.7 vs lib/scide/screen.rb in scide-0.0.8

- old
+ new

@@ -12,38 +12,38 @@ # Options for this screen. attr_accessor :options # Returns a screen configuration for the given project. # - # ==== Arguments + # == Arguments # * <tt>project</tt> - The project. # * <tt>options</tt> - Screen-specific options (see below). # - # ==== Options + # == Options # * <tt>binary</tt> - Screen binary (defaults to <tt>screen</tt>). # * <tt>args</tt> - Command-line arguments that will be given to screen (e.g. <tt>-U</tt> for unicode). - # * <tt>hardstatus</tt> - Hardstatus line configuration (defaults to #DEFAULT_HARDSTATUS). + # * <tt>hardstatus</tt> - Hardstatus line configuration (defaults to {DEFAULT_HARDSTATUS}). def initialize project, options raise ArgumentError, 'screen configuration must be a hash' unless options.nil? or options.kind_of?(Hash) @project = project @options = options.try(:dup) || {} end # Returns the command that will be used to run screen with this configuration. # - # ==== Arguments + # == Arguments # * <tt>tmp_file</tt> - The temporary file in which the configuration will be stored. # (Optional for dry-run.) def to_command tmp_file = 'TEMPORARY_FILE' [ "cd #{@project.path} &&", binary, args, "-c #{tmp_file}" ].select(&:present?).join(' ') end # Verifies that the screen binary is there. If not, causes scide - # to fail with a <tt>screen_not_found</tt> error (see Scide#fail}. + # to fail with a <tt>screen_not_found</tt> error (see {Scide.fail}). def check_binary - Scide.fail :screen_not_found, "ERROR: #{binary} not found" unless system("which #{binary}", { [ :out, :err ] => :close }) + Scide.fail :screen_not_found, "ERROR: #{binary} not found" unless system("which #{binary} &>/dev/null") end # Returns a representation of this configuration as a string. def to_s String.new.tap do |s| @@ -54,10 +54,10 @@ s << @project.to_screen end end # Returns the screen hardstatus line given as option, or - # the default #DEFAULT_HARDSTATUS. + # the default {DEFAULT_HARDSTATUS}. def hardstatus @options[:hardstatus].try(:to_s) || DEFAULT_HARDSTATUS end # Returns the screen binary given as option, or the