Class: Foobara::Monorepo::Project
- Inherits:
-
Object
- Object
- Foobara::Monorepo::Project
- Defined in:
- foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb
Overview
TODO: make this MonorepoProject and have a more generic Project so that other projects outside of the repo can have things like reset_all called on th.
Instance Attribute Summary collapse
-
#project_path ⇒ Object
Returns the value of attribute project_path.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(symbol, project_path: nil) ⇒ Project
constructor
TODO: we should move these concepts out of “Monorepo” and maybe into Foobara because we sometimes need to be able to install!/reset foobara code that’s been extracted into a gem.
- #install! ⇒ Object
- #load ⇒ Object
- #module ⇒ Object
- #module_name ⇒ Object
- #new_project_added(project) ⇒ Object
- #require_path ⇒ Object
- #reset_all ⇒ Object
Constructor Details
#initialize(symbol, project_path: nil) ⇒ Project
TODO: we should move these concepts out of “Monorepo” and maybe into Foobara because we sometimes need to be able to install!/reset foobara code that’s been extracted into a gem
10 11 12 13 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 10 def initialize(symbol, project_path: nil) self.symbol = symbol self.project_path = project_path || "#{__dir__}/../../../../../projects/#{symbol}" end |
Instance Attribute Details
#project_path ⇒ Object
Returns the value of attribute project_path.
6 7 8 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 6 def project_path @project_path end |
#symbol ⇒ Object
Returns the value of attribute symbol.
6 7 8 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 6 def symbol @symbol end |
Instance Method Details
#install! ⇒ Object
32 33 34 35 36 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 32 def install! if self.module.respond_to?(:install!) self.module.install! end end |
#load ⇒ Object
27 28 29 30 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 27 def load require require_path Util.require_directory("#{project_path}/src") end |
#module ⇒ Object
23 24 25 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 23 def module Foobara.const_get(module_name) end |
#module_name ⇒ Object
19 20 21 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 19 def module_name Util.classify(symbol) end |
#new_project_added(project) ⇒ Object
44 45 46 47 48 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 44 def new_project_added(project) if self.module.respond_to?(:new_project_added) self.module.new_project_added(project) end end |
#require_path ⇒ Object
15 16 17 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 15 def require_path "foobara/#{symbol}" end |
#reset_all ⇒ Object
38 39 40 41 42 |
# File 'foobara-0.0.110/projects/monorepo/lib/foobara/monorepo/project.rb', line 38 def reset_all if self.module.respond_to?(:reset_all) self.module.reset_all end end |