Sha256: 1144bdab1194f0382d3d33b429d2e5aa15a3746e3efec1e95ee99f90729c049d

Contents?: true

Size: 792 Bytes

Versions: 18

Compression:

Stored size: 792 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_local "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

18 entries across 18 versions & 1 rubygems

Version Path
pkgforge-0.23.0 lib/pkgforge/components/patch.rb
pkgforge-0.22.0 lib/pkgforge/components/patch.rb
pkgforge-0.21.0 lib/pkgforge/components/patch.rb
pkgforge-0.20.0 lib/pkgforge/components/patch.rb
pkgforge-0.19.0 lib/pkgforge/components/patch.rb
pkgforge-0.18.0 lib/pkgforge/components/patch.rb
pkgforge-0.17.0 lib/pkgforge/components/patch.rb
pkgforge-0.16.1 lib/pkgforge/components/patch.rb
pkgforge-0.16.0 lib/pkgforge/components/patch.rb
pkgforge-0.15.1 lib/pkgforge/components/patch.rb
pkgforge-0.15.0 lib/pkgforge/components/patch.rb
pkgforge-0.14.0 lib/pkgforge/components/patch.rb
pkgforge-0.13.4 lib/pkgforge/components/patch.rb
pkgforge-0.13.2 lib/pkgforge/components/patch.rb
pkgforge-0.13.1 lib/pkgforge/components/patch.rb
pkgforge-0.13.0 lib/pkgforge/components/patch.rb
pkgforge-0.12.5 lib/pkgforge/components/patch.rb
pkgforge-0.12.4 lib/pkgforge/components/patch.rb