Class: Stronglyboards::LockFile
- Inherits:
-
Object
- Object
- Stronglyboards::LockFile
- Defined in:
- lib/stronglyboards/lock_file.rb
Instance Method Summary collapse
- #contents ⇒ Object
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(project_file) ⇒ LockFile
constructor
A new instance of LockFile.
- #update(options) ⇒ Object
Constructor Details
#initialize(project_file) ⇒ LockFile
Returns a new instance of LockFile.
4 5 6 |
# File 'lib/stronglyboards/lock_file.rb', line 4 def initialize(project_file) @path = File.dirname(project_file) + '/' + LOCK_FILE_NAME end |
Instance Method Details
#contents ⇒ Object
8 9 10 11 12 |
# File 'lib/stronglyboards/lock_file.rb', line 8 def contents # Load the lock file containing configuration file = File.open(@path, 'r') YAML::load(file) end |
#delete ⇒ Object
21 22 23 |
# File 'lib/stronglyboards/lock_file.rb', line 21 def delete File.delete(@path) end |
#exists? ⇒ Boolean
25 26 27 |
# File 'lib/stronglyboards/lock_file.rb', line 25 def exists? File.exists?(@path) end |
#update(options) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/stronglyboards/lock_file.rb', line 14 def update() puts "Writing lock file at #{@path}" File.open(@path, 'w+') do |file| file.write(YAML::dump()) end end |