Module: Rubicon::File

Included in:
Version
Defined in:
lib/rubicon/file.rb

Instance Method Summary collapse

Instance Method Details

#readObject



11
12
13
14
15
16
# File 'lib/rubicon/file.rb', line 11

def read
  write unless ::File.exist?(version_file)

  ver = IO.read(version_file)
  ver.empty? ? '0.0.0' : IO.read(version_file)
end

#version_fileObject



7
8
9
# File 'lib/rubicon/file.rb', line 7

def version_file
  "#{Rails.root}/VERSION"
end

#write(version = '0.0.0') ⇒ Object



3
4
5
# File 'lib/rubicon/file.rb', line 3

def write(version = '0.0.0')
  ::File.open(version_file, 'w') { |f| f.write(version) }
end