Sha256: 841ec1f9e3a0ef8689646ab4922a267c83023d4037889cb140823c0944110670

Contents?: true

Size: 786 Bytes

Versions: 11

Compression:

Stored size: 786 Bytes

Contents

module PkgForge
  ##
  # Add patch methods to Forge
  class Forge
    attr_writer :patches

    Contract None => ArrayOf[String]
    def patches
      @patches ||= []
    end

    Contract String => nil
    def run_patch(file)
      run "patch -d #{tmpdir(:build)} -p1 < patches/#{file}"
    end

    private

    Contract None => nil
    def patch_source!
      patches.each { |patch| run_patch(patch) }
      nil
    end
  end

  module DSL
    ##
    # Add patch methods to Forge DSL
    class Forge
      Contract String => nil
      def patch(file)
        @forge.patches << file
        nil
      end
    end

    ##
    # Add patch methods to Build DSL
    class Build
      Contract String => nil
      def patch(file)
        @forge.run_patch(file)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pkgforge-0.29.1 lib/pkgforge/components/patch.rb
pkgforge-0.29.0 lib/pkgforge/components/patch.rb
pkgforge-0.28.0 lib/pkgforge/components/patch.rb
pkgforge-0.27.0 lib/pkgforge/components/patch.rb
pkgforge-0.26.0 lib/pkgforge/components/patch.rb
pkgforge-0.25.1 lib/pkgforge/components/patch.rb
pkgforge-0.25.0 lib/pkgforge/components/patch.rb
pkgforge-0.24.1 lib/pkgforge/components/patch.rb
pkgforge-0.24.0 lib/pkgforge/components/patch.rb
pkgforge-0.23.2 lib/pkgforge/components/patch.rb
pkgforge-0.23.1 lib/pkgforge/components/patch.rb