Sha256: 90bc980bbcfe1c2a7b0d7d9bf6d654daa20d7f39d283261f0e64e93f4953b5b6

Contents?: true

Size: 1.91 KB

Versions: 3

Compression:

Stored size: 1.91 KB

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Bootstrap.rb 24394 2006-07-10T07:38:58.276210Z ertai  $


module Uttk

  module Strategies

    # Run the bootstrap(.sh)? script or a classic autoreconf. This strategy is
    # used by the _Package_ strategy in case of the tested package does use
    # the _autotools_ or not.
    class Bootstrap < Strategy
      include Concrete

      BOOTSTRAP = /bootstrap(\.sh)?/
      AUTORECONF = 'autoreconf -fvi'

      def prologue
        super
        @runner = mk_system_runner
        cmd = self.class.have_bootstrap? @dir
        if cmd.nil? and Configure.have_configure_input? @dir
          cmd = AUTORECONF
        end
        if cmd.nil? or Configure.have_configure? @dir
          @bootstrap = nil
        else
          @bootstrap = cmd.to_ocmd
          @bootstrap.dir = @dir
        end
      end
      protected :prologue


      def run_impl
        skip_pass if @bootstrap.nil?
        @my_data = @bootstrap.run @runner
      end
      protected :run_impl


      def assertion
        assert_cmd UM::StreamMatcher, @my_data,
                   :exit => 0, :error => nil, :output => nil
        pass
      end
      protected :assertion


      def abort_hook
        @runner.abort @my_data if @runner and defined? @my_data
        super
      end
      protected :abort_hook


      def epilogue
        @my_data.clean if defined? @my_data
        super
      end
      protected :epilogue


      def dir= ( dir )
        @dir = Pathname.new(dir)
      end


      def self.have_bootstrap? ( dir=Pathname.new('.') )
        res = dir.entries.find { |ent| ent.to_s =~ BOOTSTRAP }
        (res.nil?) ? nil : dir + res
      end

      attribute :dir, 'bootstrap directory', :mandatory

    end # class Bootstrap

  end # module Strategies

end # module Uttk

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.4.6.1 lib/uttk/strategies/Bootstrap.rb
uttk-0.4.5.0 lib/uttk/strategies/Bootstrap.rb
uttk-0.4.6.2 lib/uttk/strategies/Bootstrap.rb