Class: Nutella::Project
- Inherits:
-
Object
- Object
- Nutella::Project
- Includes:
- Singleton
- Defined in:
- lib/config/project.rb
Instance Method Summary collapse
-
#config ⇒ Object
Returns the value for an entry in the project configuration file.
-
#dir ⇒ Object
Returns current project directory.
-
#exist? ⇒ Boolean
Check that the current directory is actually a nutella project.
Instance Method Details
#config ⇒ Object
Returns the value for an entry in the project configuration file
29 30 31 32 33 34 35 36 |
# File 'lib/config/project.rb', line 29 def config @prj_dir = Dir.pwd if File.exist? "#{@prj_dir}/conf/project.json" return ConfigHash.new "#{@prj_dir}/conf/project.json" else console.error "The current directory is not a Nutella project! Impossible to get project configuration file" end end |
#dir ⇒ Object
Returns current project directory
39 40 41 |
# File 'lib/config/project.rb', line 39 def dir Dir.pwd end |
#exist? ⇒ Boolean
Check that the current directory is actually a nutella project
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/config/project.rb', line 13 def exist? @prj_dir = Dir.pwd if File.exist?("#{@prj_dir}/conf/project.json") conf = JSON.parse( IO.read("#{@prj_dir}/conf/project.json") ) if conf["nutella_version"].nil? console.warn "The current directory is not a Nutella project" return false end else console.warn "The current directory is not a Nutella project" return false end return true end |