class GNOME2::Rake::ExternalPackage - glib2-3.1.8 Documentation

# class GNOME2::Rake::ExternalPackage

### Public Class Methods

new(properties) click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 38
    def initialize(properties)
      super()
      properties.each do |key, value|
        send("#{key}=", value)
      end
    end

### Public Instance Methods

archive_base_name() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 53
    def archive_base_name
      resolve_value(super) || "#{base_name}.tar.#{compression_method}"
    end

archive_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 57
    def archive_url
      "#{download_base_url}/#{archive_base_name}"
    end

base_dir_in_package() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 77
    def base_dir_in_package
      resolve_value(super) || "."
    end

base_name() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 49
    def base_name
      resolve_value(super) || "#{name}-#{version}"
    end

bundled_packages() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 97
    def bundled_packages
      super || []
    end

compression_method() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 45
    def compression_method
      resolve_value(super) || "gz"
    end

download_base_url() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 61
    def download_base_url
      resolve_value(super) || download_site_base_url
    end

latest_version() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 101
    def latest_version
      case download_site
      when :gnome
        latest_version_gnome
      when :freedesktop
        latest_version_freedesktop
      when :freedesktop_gstreamer
        latest_version_freedesktop_gstreamer
      when :gnu
        latest_version_gnu
      when :webkitgtk
        latest_version_webkitgtk
      when :icu
        latest_version_icu
      else
        nil
      end
    end

native() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 89
    def native
      super || NativeConfiguration.new({})
    end

native=(properties) click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 93
    def native=(properties)
      super(NativeConfiguration.new(properties))
    end

need_autogen?() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 69
    def need_autogen?
      need_autogen
    end

need_autoreconf?() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 73
    def need_autoreconf?
      need_autoreconf
    end

patches() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 65
    def patches
      super || []
    end

windows() click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 81
    def windows
      super || WindowsConfiguration.new({})
    end

windows=(properties) click to toggle source
Calls superclass method

    # File lib/gnome2/rake/external-package.rb, line 85
    def windows=(properties)
      super(WindowsConfiguration.new(properties))
    end

### Private Instance Methods

development_minor_version_gnome?(minor_version) click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 214
    def development_minor_version_gnome?(minor_version)
      minor_version.split(".").last.to_i.odd?
    end

development_version_freedesktop_gstreamer?(version) click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 252
    def development_version_freedesktop_gstreamer?(version)
      version.split(".")[1].to_i.odd?
    end

download_site_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 129
    def download_site_base_url
      case download_site
      when :gnome
        base_url = gnome_base_url
        release_series = version.gsub(/\A(\d+\.\d+)(?:[^\d].*)?\z/, '\1')
        base_url << "/#{name}/#{release_series}"
      when :freedesktop
        base_url = freedesktop_base_url
        base_url << "/#{name}/release"
      when :freedesktop_gstreamer
        base_url = freedesktop_gstreamer_base_url
        base_url << "/#{name}"
      when :gnu
        base_url = gnu_base_url
        base_url << "/#{name}"
      when :webkitgtk
        base_url = webkitgtk_base_url
      when :icu
        base_url = "#{icu_base_url}/#{version}"
      else
        base_url = nil
      end
      base_url
    end

freedesktop_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 158
    def freedesktop_base_url
      "https://www.freedesktop.org/software"
    end

freedesktop_gstreamer_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 162
    def freedesktop_gstreamer_base_url
      "https://gstreamer.freedesktop.org/src"
    end

gnome_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 154
    def gnome_base_url
      "http://ftp.gnome.org/pub/gnome/sources"
    end

gnu_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 166
    def gnu_base_url
      "https://ftp.gnu.org/pub/gnu"
    end

icu_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 174
    def icu_base_url
      "http://download.icu-project.org/files/icu4c"
    end

latest_version_freedesktop() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 218
    def latest_version_freedesktop
      base_url = "#{freedesktop_base_url}/#{name}/release"
      versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="#{Regexp.escape(name)}-
                      (\d+(?:\.\d+)*)
                      \.tar\.#{Regexp.escape(compression_method)}"/x
            versions << $1
          end
        end
      end
      sort_versions(versions).last
    end

latest_version_freedesktop_gstreamer() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 234
    def latest_version_freedesktop_gstreamer
      base_url = "#{freedesktop_gstreamer_base_url}/#{name}"
      versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="#{Regexp.escape(name)}-
                      (\d+(?:\.\d+)*)
                      \.tar\.#{Regexp.escape(compression_method)}"/x
            version = $1
            next if development_version_freedesktop_gstreamer?(version)
            versions << version
          end
        end
      end
      sort_versions(versions).last
    end

latest_version_gnome() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 184
    def latest_version_gnome
      base_url = "#{gnome_base_url}/#{name}"
      minor_versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="(\d+(?:\.\d+)*)\/?"/
            minor_version = $1
            next if development_minor_version_gnome?(minor_version)
            minor_versions << minor_version
          end
        end
      end
      return nil if minor_versions.empty?

      latest_minor_version = sort_versions(minor_versions).last
      versions = []
      open("#{base_url}/#{latest_minor_version}") do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="#{Regexp.escape(name)}-
                      (\d+(?:\.\d+)*)
                      \.tar\.#{Regexp.escape(compression_method)}"/x
            versions << $1
          end
        end
      end
      sort_versions(versions).last
    end

latest_version_gnu() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 256
    def latest_version_gnu
      base_url = "#{gnu_base_url}/#{name}"
      versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="#{Regexp.escape(name)}-
                      (\d+(?:\.\d+)*)
                      \.tar\.#{Regexp.escape(compression_method)}"/x
            version = $1
            versions << version
          end
        end
      end
      sort_versions(versions).last
    end

latest_version_icu() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 289
    def latest_version_icu
      base_url = icu_base_url
      versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="(\d+(?:\.\d+)+)\/"/x
            versions << $1
          end
        end
      end
      sort_versions(versions).last
    end

latest_version_webkitgtk() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 273
    def latest_version_webkitgtk
      base_url = webkitgtk_base_url
      versions = []
      open(base_url) do |index|
        index.read.scan(/<a (.+?)>/) do |content,|
          case content
          when /href="#{Regexp.escape(name)}-
                      (\d+(?:\.\d+)*)
                      \.tar\.#{Regexp.escape(compression_method)}"/x
            versions << $1
          end
        end
      end
      sort_versions(versions).last
    end

resolve_value(value) click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 121
    def resolve_value(value)
      if value.respond_to?(:call)
        value.call(self)
      else
        value
      end
    end

sort_versions(versions) click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 178
    def sort_versions(versions)
      versions.sort_by do |version|
        version.split(".").collect(&:to_i)
      end
    end

webkitgtk_base_url() click to toggle source

    # File lib/gnome2/rake/external-package.rb, line 170
    def webkitgtk_base_url
      "https://webkitgtk.org/releases"
    end