Sha256: 0e2a486c9596f6898ad8d0c460407573c624fea79292d09c195b275e3d1bcd6e

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

# encoding: UTF-8

module Tetra
  # encapsulates a pom.xml file
  class Pom
    def initialize(filename)
      @doc = Nokogiri::XML(open(filename).read)
      @doc.remove_namespaces!
    end

    def group_id
      @doc.xpath("project/groupId").text || ""
    end

    def artifact_id
      @doc.xpath("project/artifactId").text || ""
    end

    def name
      @doc.xpath("project/name").text || ""
    end

    def version
      @doc.xpath("project/version").text || ""
    end

    def description
      @doc.xpath("project/description").text || ""
    end

    def url
      @doc.xpath("project/url").text || ""
    end

    def license_name
      @doc.xpath("project/licenses/license/name").text || ""
    end

    def runtime_dependency_ids
      @doc.xpath("project/dependencies/dependency[\
        not(optional='true') and not(scope='provided') and not(scope='test') and not(scope='system')\
      ]").map do |element|
        [element.xpath("groupId").text, element.xpath("artifactId").text, element.xpath("version").text]
      end
    end

    def scm_connection
      @doc.xpath("project/scm/connection").text || ""
    end

    def scm_url
      @doc.xpath("project/scm/url").text || ""
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tetra-0.48.0 lib/tetra/pom.rb
tetra-0.46.0 lib/tetra/pom.rb
tetra-0.45.0 lib/tetra/pom.rb
tetra-0.44.0 lib/tetra/pom.rb
tetra-0.43.0 lib/tetra/pom.rb
tetra-0.42.0 lib/tetra/pom.rb
tetra-0.41.0 lib/tetra/pom.rb
tetra-0.40.0 lib/tetra/pom.rb