Class: ProjectConfiguration
- Inherits:
-
Object
- Object
- ProjectConfiguration
- Defined in:
- lib/almirah/project_configuration.rb
Instance Attribute Summary collapse
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#project_root_directory ⇒ Object
Returns the value of attribute project_root_directory.
Instance Method Summary collapse
- #get_design_inputs ⇒ Object
-
#initialize(path) ⇒ ProjectConfiguration
constructor
A new instance of ProjectConfiguration.
- #is_spec_db_shall_be_created ⇒ Object
- #load_project_file ⇒ Object
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
#parameters ⇒ Object
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/almirah/project_configuration.rb', line 6 def parameters @parameters end |
#project_root_directory ⇒ Object
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_inputs ⇒ Object
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_created ⇒ Object
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_file ⇒ Object
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.}" rescue Errno::ENOENT puts "Project file not found: project.yml" end end |