Class: Manifold::API::Project
- Inherits:
-
Object
- Object
- Manifold::API::Project
- Defined in:
- lib/manifold/api/project.rb
Overview
Projects API
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(name, logger: Logger.new($stdout), directory: Pathname.pwd.join(name)) ⇒ Project
constructor
A new instance of Project.
- #vectors_directory ⇒ Object
- #workspaces ⇒ Object
- #workspaces_directory ⇒ Object
Constructor Details
#initialize(name, logger: Logger.new($stdout), directory: Pathname.pwd.join(name)) ⇒ Project
Returns a new instance of Project.
9 10 11 12 13 |
# File 'lib/manifold/api/project.rb', line 9 def initialize(name, logger: Logger.new($stdout), directory: Pathname.pwd.join(name)) @name = name @logger = logger @directory = Pathname(directory) end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
7 8 9 |
# File 'lib/manifold/api/project.rb', line 7 def directory @directory end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/manifold/api/project.rb', line 7 def logger @logger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/manifold/api/project.rb', line 7 def name @name end |
Class Method Details
.create(name, directory: Pathname.pwd.join(name)) ⇒ Object
15 16 17 18 19 |
# File 'lib/manifold/api/project.rb', line 15 def self.create(name, directory: Pathname.pwd.join(name)) new(name, directory:).tap do |project| [project.workspaces_directory, project.vectors_directory].each(&:mkpath) end end |
Instance Method Details
#generate ⇒ Object
25 26 27 |
# File 'lib/manifold/api/project.rb', line 25 def generate workspaces.each(&:generate) end |
#vectors_directory ⇒ Object
33 34 35 |
# File 'lib/manifold/api/project.rb', line 33 def vectors_directory directory.join("vectors") end |
#workspaces ⇒ Object
21 22 23 |
# File 'lib/manifold/api/project.rb', line 21 def workspaces @workspaces ||= workspace_directories.map { |dir| Workspace.from_directory(dir, logger:) } end |
#workspaces_directory ⇒ Object
29 30 31 |
# File 'lib/manifold/api/project.rb', line 29 def workspaces_directory directory.join("workspaces") end |