Class: Gigawatt::ProjectFile
- Inherits:
-
Object
- Object
- Gigawatt::ProjectFile
- Defined in:
- lib/gigawatt/project_file.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.filename ⇒ Object
30 31 32 |
# File 'lib/gigawatt/project_file.rb', line 30 def self.filename ".88miles" end |
.write(project) ⇒ Object
26 27 28 |
# File 'lib/gigawatt/project_file.rb', line 26 def self.write(project) File.write(File.join(Dir.pwd, ProjectFile.filename), project.to_hash.to_yaml) end |
Instance Method Details
#find_the_dotfile(dir = Dir.pwd) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gigawatt/project_file.rb', line 3 def find_the_dotfile(dir = Dir.pwd) file = File.join(dir, ProjectFile.filename) if File.exists?(file) return File.join(file) else parts = dir.split(File::SEPARATOR)[0..-2] if parts.length == 0 return nil else return find_the_dotfile(File.join(parts)) end end end |
#project ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gigawatt/project_file.rb', line 17 def project dotfile = find_the_dotfile if dotfile YAML.load_file(dotfile) else nil end end |