Sha256: 5e8c6686975ac8a34f58c8d0810a82b178b076ec539cc72a67fa7b46b60dccba

Contents?: true

Size: 1.33 KB

Versions: 33

Compression:

Stored size: 1.33 KB

Contents

require 'simp/rake/build/constants'

module Simp; end
module Simp::Rake; end
module Simp::Rake::Build

  class Clean < ::Rake::TaskLib
    include Simp::Rake::Build::Constants

    def initialize( base_dir )
      init_member_vars( base_dir )
      define_tasks
    end

    def define_tasks
      ::CLEAN.include(
        "#{@dist_dir}/*",
        ".discinfo",
        @dvd_dir,
        "#{@build_dir}/SIMP",
        "#{@base_dir}/SIMP_ISO*"
      )

      ::CLOBBER.include(
        @dist_dir,
        "#{@build_dir}/build_keys/dev",
        "#{@build_dir}/yum_data/*/packages"
      )

      # This just abstracts the clean/clobber space in such a way that clobber can actally be used!
      def advanced_clean(type,args)
        fail "Type must be one of 'clean' or 'clobber'" unless ['clean','clobber'].include?(type)

        validate_in_mock_group?

        mock_dirs = Dir.glob("/var/lib/mock/*").map{|x| x = File.basename(x) }

        if not mock_dirs.empty? and not args.chroot then
          $stderr.puts "Notice: You must pass a Mock chroot to erase a specified build root."
        end

        Rake::Task["pkg:#{type}"].invoke(args.chroot)
      end

      task :clobber,[:chroot] do |t,args|
        advanced_clean('clobber',args)
      end

      task :clean,[:chroot] do |t,args|
        advanced_clean('clean',args)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
simp-rake-helpers-3.0.2 lib/simp/rake/build/clean.rb
simp-rake-helpers-3.0.1 lib/simp/rake/build/clean.rb
simp-rake-helpers-3.0.0 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.7 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.5 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.4 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.3 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.2 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.1 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.5.0 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.7 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.6 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.4 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.3 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.2 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.1 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.4.0 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.3.2 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.3.1 lib/simp/rake/build/clean.rb
simp-rake-helpers-2.3.0 lib/simp/rake/build/clean.rb