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
- #get_repositories ⇒ 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.
6 7 8 9 10 |
# File 'lib/almirah/project_configuration.rb', line 6 def initialize(path) @project_root_directory = path @parameters = {} load_project_file end |
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters.
4 5 6 |
# File 'lib/almirah/project_configuration.rb', line 4 def parameters @parameters end |
#project_root_directory ⇒ Object
Returns the value of attribute project_root_directory.
4 5 6 |
# File 'lib/almirah/project_configuration.rb', line 4 def project_root_directory @project_root_directory end |
Instance Method Details
#get_design_inputs ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/almirah/project_configuration.rb', line 20 def get_design_inputs if (@parameters.key? 'specifications') and (@parameters['specifications'].key? 'input') return @parameters['specifications']['input'] end [] end |
#get_repositories ⇒ Object
28 29 30 31 32 |
# File 'lib/almirah/project_configuration.rb', line 28 def get_repositories return @parameters['repositories'] if @parameters.key? 'repositories' [] end |
#is_spec_db_shall_be_created ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/almirah/project_configuration.rb', line 34 def is_spec_db_shall_be_created if @parameters.key? 'output' @parameters['output'].each do |p| return true if p == 'specifications_db' end end false end |
#load_project_file ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/almirah/project_configuration.rb', line 12 def load_project_file @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 |