Sha256: e3eab4ef8701a8b563a77b64597f3d29bc1ec6211f363711610504eba902ded1

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

# encoding: UTF-8

require "nokogiri"

# encapsulates a pom.xml file
class Pom
  def initialize(filename)
    @doc = Nokogiri::XML(File.read(filename))
    @doc.remove_namespaces!
  end
  
  def connection_address
    connection_nodes = @doc.xpath("//scm/connection/text()")    
    if connection_nodes.any?
      connection_nodes.first.to_s.sub(/^scm:/, "")
    end
  end
  
  def group_id
    @doc.xpath("project/groupId/text()").to_s
  end
  
  def artifact_id
    @doc.xpath("project/artifactId/text()").to_s
  end
  
  def version
    @doc.xpath("project/version/text()").to_s
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gjp-0.6.0 lib/gjp/pom.rb
gjp-0.5.0 lib/gjp/pom.rb