Class: Tetra::Package
- Inherits:
-
Object
- Object
- Tetra::Package
- Extended by:
- Forwardable
- Includes:
- Scriptable, Speccable
- Defined in:
- lib/tetra/packages/package.rb
Overview
represents a Java project packaged in tetra
Instance Attribute Summary collapse
-
#patches ⇒ Object
readonly
Returns the value of attribute patches.
Instance Method Summary collapse
- #artifact_ids ⇒ Object
- #cleanup_description(raw, max_length) ⇒ Object
-
#description ⇒ Object
a long summary from the POM.
-
#initialize(project, pom_path = nil, filter = nil, patches = []) ⇒ Package
constructor
A new instance of Package.
-
#outputs ⇒ Object
files produced by this package.
-
#summary ⇒ Object
a short summary from the POM.
- #to_script ⇒ Object
- #to_spec ⇒ Object
Methods included from Scriptable
Methods included from Speccable
Methods included from Generatable
Constructor Details
#initialize(project, pom_path = nil, filter = nil, patches = []) ⇒ Package
Returns a new instance of Package.
22 23 24 25 26 27 28 |
# File 'lib/tetra/packages/package.rb', line 22 def initialize(project, pom_path = nil, filter = nil, patches = []) @project = project @kit = Tetra::KitPackage.new(project) @pom = Tetra::Pom.new(pom_path) @filter = filter @patches = patches.map { |f| File.basename(f) } end |
Instance Attribute Details
#patches ⇒ Object (readonly)
Returns the value of attribute patches.
10 11 12 |
# File 'lib/tetra/packages/package.rb', line 10 def patches @patches end |
Instance Method Details
#artifact_ids ⇒ Object
30 31 32 |
# File 'lib/tetra/packages/package.rb', line 30 def artifact_ids @pom.modules.any? ? @pom.modules : [@pom.artifact_id] end |
#cleanup_description(raw, max_length) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/tetra/packages/package.rb', line 51 def cleanup_description(raw, max_length) raw .gsub(/[\s]+/, " ") .strip .slice(0..max_length - 1) .sub(/\s\w+$/, "") .sub(/\.+$/, "") end |
#description ⇒ Object
a long summary from the POM
40 41 42 |
# File 'lib/tetra/packages/package.rb', line 40 def description cleanup_description(@pom.description, 1500) end |
#outputs ⇒ Object
files produced by this package
45 46 47 48 49 |
# File 'lib/tetra/packages/package.rb', line 45 def outputs @project.produced_files.select do |file| File.fnmatch?(@filter, File.basename(file)) end end |
#summary ⇒ Object
a short summary from the POM
35 36 37 |
# File 'lib/tetra/packages/package.rb', line 35 def summary cleanup_description(@pom.description, 60) end |
#to_script ⇒ Object
64 65 66 |
# File 'lib/tetra/packages/package.rb', line 64 def to_script _to_script(@project) end |
#to_spec ⇒ Object
60 61 62 |
# File 'lib/tetra/packages/package.rb', line 60 def to_spec _to_spec(@project, name, "package.spec", @project.packages_dir) end |