class Shanty::Project

Public: Represents a project in the current repository.

Attributes

changed[RW]
changed?[RW]
name[RW]
options[RW]
parents_by_path[RW]
path[RW]

Public Class Methods

new(project_template) click to toggle source

Public: Initialise the Project instance.

project_template - An instance of ProjectTemplate from which to

instantiate this project.
# File lib/shanty/project.rb, line 18
def initialize(project_template)
  @name = project_template.name
  @path = project_template.path
  @options = project_template.options
  @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

Public Instance Methods

artifact_path() click to toggle source

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.

# File lib/shanty/project.rb, line 45
def artifact_path
  nil
end
externals_by_name() click to toggle source

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.

# File lib/shanty/project.rb, line 37
def externals_by_name
  []
end
inspect() click to toggle source

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.

# File lib/shanty/project.rb, line 63
def inspect
  {
    name: name,
    path: path,
    options: options
  }.inspect
end
to_s() click to toggle source

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.

# File lib/shanty/project.rb, line 54
def to_s
  "Name: #{name}, Type: #{self.class}"
end

Private Instance Methods

within_project_dir() { || ... } click to toggle source
# File lib/shanty/project.rb, line 73
def within_project_dir
  Dir.chdir(path) do
    yield
  end
end