Class: Shanty::Project
- Inherits:
-
Object
- Object
- Shanty::Project
- Includes:
- Mixins::ActsAsLinkGraphNode, Mixins::Callbacks
- Defined in:
- lib/shanty/project.rb
Overview
Public: Represents a project in the current repository.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#changed ⇒ Object
(also: #changed?)
Returns the value of attribute changed.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#parents_by_path ⇒ Object
Returns the value of attribute parents_by_path.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#artifact_path ⇒ Object
Public: The absolute path to the artifact that would be created by this project when built, if any.
-
#externals_by_name ⇒ Object
Public: A list of the external dependencies this project has by name and version.
-
#initialize(project_template) ⇒ Project
constructor
Public: Initialise the Project instance.
-
#inspect ⇒ Object
Public: Overriden String conversion method to return a more detailed representation of this instance that doesn’t include the cyclic parent/children attributes as defined by the ActsAsLinkGraphNode mixin.
-
#to_s ⇒ Object
Public: Overriden String conversion method to return a simplified representation of this instance that doesn’t include the cyclic parent/children attributes as defined by the ActsAsLinkGraphNode mixin.
Methods included from Mixins::Callbacks
#callbacks, included, #publish, #subscribe
Methods included from Mixins::ActsAsLinkGraphNode
#add_child, #add_parent, #all_children, #all_parents, #children, included, #parents
Constructor Details
#initialize(project_template) ⇒ Project
Public: Initialise the Project instance.
project_template - An instance of ProjectTemplate from which to
instantiate this project.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shanty/project.rb', line 18 def initialize(project_template) @name = project_template.name @path = project_template.path @options = project_template. @parents_by_path = project_template.parents @changed = false project_template.plugins.each do |plugin| plugin.add_to_project(self) end instance_eval(&project_template.after_create) unless project_template.after_create.nil? end |
Instance Attribute Details
#changed ⇒ Object Also known as: changed?
Returns the value of attribute changed.
10 11 12 |
# File 'lib/shanty/project.rb', line 10 def changed @changed end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/shanty/project.rb', line 10 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/shanty/project.rb', line 10 def @options end |
#parents_by_path ⇒ Object
Returns the value of attribute parents_by_path.
10 11 12 |
# File 'lib/shanty/project.rb', line 10 def parents_by_path @parents_by_path end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/shanty/project.rb', line 10 def path @path end |
Instance Method Details
#artifact_path ⇒ Object
Public: The absolute path to the artifact that would be created by this project when built, if any. This is expected to be overriden in subclasses.
Returns a String representing the absolute path to the artifact.
45 46 47 |
# File 'lib/shanty/project.rb', line 45 def artifact_path nil end |
#externals_by_name ⇒ Object
Public: A list of the external dependencies this project has by name and version. This is used in dependency tree generation.
Returns an Array of Strings representing external dependencies by name and version.
37 38 39 |
# File 'lib/shanty/project.rb', line 37 def externals_by_name [] end |
#inspect ⇒ Object
Public: Overriden String conversion method to return a more detailed representation of this instance that doesn’t include the cyclic parent/children attributes as defined by the ActsAsLinkGraphNode mixin.
Returns more detailed String representation of this instance.
63 64 65 66 67 68 69 |
# File 'lib/shanty/project.rb', line 63 def inspect { name: name, path: path, options: }.inspect end |
#to_s ⇒ Object
Public: Overriden String conversion method to return a simplified representation of this instance that doesn’t include the cyclic parent/children attributes as defined by the ActsAsLinkGraphNode mixin.
Returns a simple String representation of this instance.
54 55 56 |
# File 'lib/shanty/project.rb', line 54 def to_s "Name: #{name}, Type: #{self.class}" end |