Sha256: e2c13927f2452765a4e72c5c4c4fb5d80beabf86435bdc534e72ae2bb84f31d1

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'fileutils'
require 'rscm/path_converter' #TODO: move safer_popen to popen_ext.rb
require 'damagecontrol/publisher/base'

module DamageControl

  class Build
    def execute_publisher_stdout
      File.expand_path("#{execute_publisher_dir}/stdout.log")
    end

    def execute_publisher_stderr
      File.expand_path("#{execute_publisher_dir}/stderr.log")
    end
    
    def execute_publisher_dir
      File.expand_path("#{dir}/execute_publisher")
    end
  end

  module Publisher
    class Execute < Base
      #register self
    
      ann :description => "Command line"
      ann :tip => "Stdout and stderr for the command will be made available on the build page. Don't redirect streams."
      attr_accessor :command_line

      ann :description => "Directory"
      ann :tip => "Relative directory (under checkout directory) where the command will be executed."
      attr_accessor :command_line

      def initialize
        @command_line = "echo \"The build label is $DAMAGECONTROL_BUILD_LABEL\""
      end

      def name
        "Execute"
      end    

      def publish(build)
        FileUtils.mkdir_p(build.execute_publisher_dir)
        safer_popen("{@command_line} > \"#{build.execute_publisher_stdout}\" 2> \"#{build.execute_publisher_stderr}\"") do |io|
          io.read
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
damagecontrol-0.5.0.1391 lib/damagecontrol/publisher/execute.rb
damagecontrol-0.5.0.1392 lib/damagecontrol/publisher/execute.rb
damagecontrol-0.5.0.1393 lib/damagecontrol/publisher/execute.rb
damagecontrol-0.5.0.1404 lib/damagecontrol/publisher/execute.rb