Class: ProjectConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/almirah/project_configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ProjectConfiguration

Returns a new instance of ProjectConfiguration.



8
9
10
11
12
# File 'lib/almirah/project_configuration.rb', line 8

def initialize(path)
    @project_root_directory = path
    @parameters = {}
    load_project_file()
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



6
7
8
# File 'lib/almirah/project_configuration.rb', line 6

def parameters
  @parameters
end

#project_root_directoryObject

Returns the value of attribute project_root_directory.



5
6
7
# File 'lib/almirah/project_configuration.rb', line 5

def project_root_directory
  @project_root_directory
end

Instance Method Details

#get_design_inputsObject



24
25
26
27
28
29
# File 'lib/almirah/project_configuration.rb', line 24

def get_design_inputs
    if (@parameters.key? 'specifications') and (@parameters['specifications'].key? 'input')
        return @parameters['specifications']['input']
    end
    return []
end

#is_spec_db_shall_be_createdObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/almirah/project_configuration.rb', line 31

def is_spec_db_shall_be_created
    if (@parameters.key? 'output')
        @parameters['output'].each do |p|
           if p == 'specifications_db'
            return true
           end
        end
    end
    return false
end

#load_project_fileObject



14
15
16
17
18
19
20
21
22
# File 'lib/almirah/project_configuration.rb', line 14

def load_project_file
    begin
        @parameters = YAML.load_file(@project_root_directory + '/project.yml') 
    rescue Psych::SyntaxError => e
        puts "YAML syntax error: #{e.message}"
      rescue Errno::ENOENT
        puts "Project file not found: project.yml"
    end
end