Class: Minfra::Cli::Project::ProjectInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/minfra/cli/commands/project.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_dir) ⇒ ProjectInfo

Returns a new instance of ProjectInfo.



15
16
17
18
19
# File 'lib/minfra/cli/commands/project.rb', line 15

def initialize(app_dir)
  @app_dir = app_dir
  @project_file_path = app_dir.join('project.json')
  @info = Hashie::Mash.new(JSON.parse(File.read(@project_file_path)))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



29
30
31
# File 'lib/minfra/cli/commands/project.rb', line 29

def method_missing(method)
  @info.send(method)
end

Instance Attribute Details

#app_dirObject (readonly)

Returns the value of attribute app_dir.



13
14
15
# File 'lib/minfra/cli/commands/project.rb', line 13

def app_dir
  @app_dir
end

Class Method Details

.load(app_dir) ⇒ Object



10
11
12
# File 'lib/minfra/cli/commands/project.rb', line 10

def self.load(app_dir)
  new(app_dir)
end

Instance Method Details

#inspectObject



33
34
35
# File 'lib/minfra/cli/commands/project.rb', line 33

def inspect
  @info.inspect
end

#nameObject



25
26
27
# File 'lib/minfra/cli/commands/project.rb', line 25

def name
  @info['project']
end

#repo_nameObject



21
22
23
# File 'lib/minfra/cli/commands/project.rb', line 21

def repo_name
  "#{docker.repo}/#{docker.name}"
end