Class: Tetra::Pom
- Inherits:
-
Object
- Object
- Tetra::Pom
- Defined in:
- lib/tetra/pom.rb
Overview
encapsulates a pom.xml file
Instance Method Summary collapse
- #artifact_id ⇒ Object
- #description ⇒ Object
- #group_id ⇒ Object
-
#initialize(filename) ⇒ Pom
constructor
A new instance of Pom.
- #license_name ⇒ Object
- #modules ⇒ Object
- #name ⇒ Object
- #runtime_dependency_ids ⇒ Object
- #scm_connection ⇒ Object
- #scm_url ⇒ Object
- #url ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(filename) ⇒ Pom
Returns a new instance of Pom.
6 7 8 9 |
# File 'lib/tetra/pom.rb', line 6 def initialize(filename) content = open(filename).read if filename && File.file?(filename) @doc = REXML::Document.new(content) end |
Instance Method Details
#artifact_id ⇒ Object
15 16 17 |
# File 'lib/tetra/pom.rb', line 15 def artifact_id @doc.text("project/artifactId") || "" end |
#description ⇒ Object
27 28 29 |
# File 'lib/tetra/pom.rb', line 27 def description @doc.text("project/description") || "" end |
#group_id ⇒ Object
11 12 13 |
# File 'lib/tetra/pom.rb', line 11 def group_id @doc.text("project/groupId") || "" end |
#license_name ⇒ Object
35 36 37 |
# File 'lib/tetra/pom.rb', line 35 def license_name @doc.text("project/licenses/license/name") || "" end |
#modules ⇒ Object
47 48 49 |
# File 'lib/tetra/pom.rb', line 47 def modules @doc.get_elements("project/modules/module").map(&:text) end |
#name ⇒ Object
19 20 21 |
# File 'lib/tetra/pom.rb', line 19 def name @doc.text("project/name") || "" end |
#runtime_dependency_ids ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/tetra/pom.rb', line 39 def runtime_dependency_ids @doc.get_elements("project/dependencies/dependency[\ not(optional='true') and not(scope='provided') and not(scope='test') and not(scope='system')\ ]").map do |element| [element.text("groupId"), element.text("artifactId"), element.text("version")] end end |
#scm_connection ⇒ Object
51 52 53 |
# File 'lib/tetra/pom.rb', line 51 def scm_connection @doc.text("project/scm/connection") || "" end |
#scm_url ⇒ Object
55 56 57 |
# File 'lib/tetra/pom.rb', line 55 def scm_url @doc.text("project/scm/url") || "" end |
#url ⇒ Object
31 32 33 |
# File 'lib/tetra/pom.rb', line 31 def url @doc.text("project/url") || "" end |
#version ⇒ Object
23 24 25 |
# File 'lib/tetra/pom.rb', line 23 def version @doc.text("project/version") || "" end |