Sha256: 7481f537fd29fa9501af78b5bb470c7b8d7b35d9a0557012fb1716d18e8c9bbc

Contents?: true

Size: 1.47 KB

Versions: 14

Compression:

Stored size: 1.47 KB

Contents

  # encoding: UTF-8

module Gjp
  # encapsulates details of a package needed by the spec file
  # retrieving them from other objects
  class PackageSpecAdapter
    attr_reader :name
    attr_reader :version
    attr_reader :license
    attr_reader :summary
    attr_reader :url
    attr_reader :project_name
    attr_reader :project_version
    attr_reader :group_id
    attr_reader :artifact_id
    attr_reader :version
    attr_reader :runtime_dependency_ids
    attr_reader :description
    attr_reader :outputs

    def initialize(project, package_name, pom, filter)
      @name = package_name
      @version = pom.version
      @license = if pom.license_name != ""
        pom.license_name
      else
        "Apache-2.0"
      end
      @summary = cleanup_description(pom.description, 60)
      @url = pom.url
      @project_name = project.name
      @project_version = project.version
      @group_id = pom.group_id
      @artifact_id = pom.artifact_id
      @version = pom.version
      @runtime_dependency_ids = pom.runtime_dependency_ids
      @description = cleanup_description(pom.description, 1500)

      @outputs = project.get_produced_files(package_name).select do |file|
        File.fnmatch? filter, File.basename(file)
      end
    end

    def get_binding
      binding
    end

    def cleanup_description(raw, max_length)
      raw
        .gsub(/[\s]+/, " ")
        .strip
        .slice(0..max_length -1)
        .sub(/\s\w+$/, "")
        .sub(/\.+$/, "")
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gjp-0.36.0 lib/gjp/package_spec_adapter.rb
gjp-0.35.0 lib/gjp/package_spec_adapter.rb
gjp-0.34.0 lib/gjp/package_spec_adapter.rb
gjp-0.33.0 lib/gjp/package_spec_adapter.rb
gjp-0.32.0 lib/gjp/package_spec_adapter.rb
gjp-0.31.0 lib/gjp/package_spec_adapter.rb
gjp-0.30.0 lib/gjp/package_spec_adapter.rb
gjp-0.29.0 lib/gjp/package_spec_adapter.rb
gjp-0.28.0 lib/gjp/package_spec_adapter.rb
gjp-0.27.0 lib/gjp/package_spec_adapter.rb
gjp-0.26.0 lib/gjp/package_spec_adapter.rb
gjp-0.25.0 lib/gjp/package_spec_adapter.rb
gjp-0.24.0 lib/gjp/package_spec_adapter.rb
gjp-0.23.0 lib/gjp/package_spec_adapter.rb