Class: Foobara::Project

Inherits:
Object
  • Object
show all
Defined in:
foobara-0.5.8/projects/typesystem/projects/project/src/project.rb,
foobara-0.5.8/projects/typesystem/projects/project/lib/foobara/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, project_path: nil) ⇒ Project

Returns a new instance of Project.



5
6
7
8
# File 'projects/typesystem/projects/project/src/project.rb', line 5

def initialize(symbol, project_path: nil)
  self.symbol = symbol
  self.project_path = project_path || "#{__dir__}/../../#{symbol}"
end

Instance Attribute Details

#project_pathObject

Returns the value of attribute project_path.



3
4
5
# File 'projects/typesystem/projects/project/src/project.rb', line 3

def project_path
  @project_path
end

#symbolObject

Returns the value of attribute symbol.



3
4
5
# File 'projects/typesystem/projects/project/src/project.rb', line 3

def symbol
  @symbol
end

Instance Method Details

#install!Object



32
33
34
35
36
# File 'projects/typesystem/projects/project/src/project.rb', line 32

def install!
  if self.module.respond_to?(:install!)
    self.module.install!
  end
end

#loadObject



22
23
24
25
26
27
28
29
30
# File 'projects/typesystem/projects/project/src/project.rb', line 22

def load
  require require_path

  src_dir = "#{project_path}/src"

  if Dir.exist?(src_dir)
    Util.require_directory(src_dir)
  end
end

#moduleObject



18
19
20
# File 'projects/typesystem/projects/project/src/project.rb', line 18

def module
  Foobara.const_get(module_name)
end

#module_nameObject



14
15
16
# File 'projects/typesystem/projects/project/src/project.rb', line 14

def module_name
  Util.classify(symbol)
end

#new_project_added(project) ⇒ Object



46
47
48
49
50
# File 'projects/typesystem/projects/project/src/project.rb', line 46

def new_project_added(project)
  if self.module.respond_to?(:new_project_added)
    self.module.new_project_added(project)
  end
end

#require_pathObject



10
11
12
# File 'projects/typesystem/projects/project/src/project.rb', line 10

def require_path
  "foobara/#{symbol}"
end

#reset_allObject



38
39
40
41
42
43
44
# File 'projects/typesystem/projects/project/src/project.rb', line 38

def reset_all
  Foobara.raise_if_production!("reset_all")

  if self.module.respond_to?(:reset_all)
    self.module.reset_all
  end
end