Class: Gjp::PackageSpecAdapter
- Inherits:
-
Object
- Object
- Gjp::PackageSpecAdapter
- Defined in:
- lib/gjp/package_spec_adapter.rb
Overview
encapsulates details of a package needed by the spec file retrieving them from other objects
Instance Attribute Summary collapse
-
#artifact_id ⇒ Object
readonly
Returns the value of attribute artifact_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#group_id ⇒ Object
readonly
Returns the value of attribute group_id.
-
#license ⇒ Object
readonly
Returns the value of attribute license.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#project_version ⇒ Object
readonly
Returns the value of attribute project_version.
-
#runtime_dependency_ids ⇒ Object
readonly
Returns the value of attribute runtime_dependency_ids.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #cleanup_description(raw, max_length) ⇒ Object
- #get_binding ⇒ Object
-
#initialize(project, package_name, pom, filter) ⇒ PackageSpecAdapter
constructor
A new instance of PackageSpecAdapter.
Constructor Details
#initialize(project, package_name, pom, filter) ⇒ PackageSpecAdapter
Returns a new instance of PackageSpecAdapter.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gjp/package_spec_adapter.rb', line 21 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 |
Instance Attribute Details
#artifact_id ⇒ Object (readonly)
Returns the value of attribute artifact_id.
15 16 17 |
# File 'lib/gjp/package_spec_adapter.rb', line 15 def artifact_id @artifact_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
18 19 20 |
# File 'lib/gjp/package_spec_adapter.rb', line 18 def description @description end |
#group_id ⇒ Object (readonly)
Returns the value of attribute group_id.
14 15 16 |
# File 'lib/gjp/package_spec_adapter.rb', line 14 def group_id @group_id end |
#license ⇒ Object (readonly)
Returns the value of attribute license.
9 10 11 |
# File 'lib/gjp/package_spec_adapter.rb', line 9 def license @license end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/gjp/package_spec_adapter.rb', line 7 def name @name end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
19 20 21 |
# File 'lib/gjp/package_spec_adapter.rb', line 19 def outputs @outputs end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
12 13 14 |
# File 'lib/gjp/package_spec_adapter.rb', line 12 def project_name @project_name end |
#project_version ⇒ Object (readonly)
Returns the value of attribute project_version.
13 14 15 |
# File 'lib/gjp/package_spec_adapter.rb', line 13 def project_version @project_version end |
#runtime_dependency_ids ⇒ Object (readonly)
Returns the value of attribute runtime_dependency_ids.
17 18 19 |
# File 'lib/gjp/package_spec_adapter.rb', line 17 def runtime_dependency_ids @runtime_dependency_ids end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
10 11 12 |
# File 'lib/gjp/package_spec_adapter.rb', line 10 def summary @summary end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/gjp/package_spec_adapter.rb', line 11 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/gjp/package_spec_adapter.rb', line 8 def version @version end |
Instance Method Details
#cleanup_description(raw, max_length) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/gjp/package_spec_adapter.rb', line 48 def cleanup_description(raw, max_length) raw .gsub(/[\s]+/, " ") .strip .slice(0..max_length -1) .sub(/\s\w+$/, "") .sub(/\.+$/, "") end |
#get_binding ⇒ Object
44 45 46 |
# File 'lib/gjp/package_spec_adapter.rb', line 44 def get_binding binding end |