Class: GitV
- Inherits:
-
Object
- Object
- GitV
- Defined in:
- lib/gitv/gitv.rb
Instance Method Summary collapse
- #cache ⇒ Object
-
#initialize(src_root = nil, version_file = nil) ⇒ GitV
constructor
A new instance of GitV.
- #version ⇒ Object
Constructor Details
#initialize(src_root = nil, version_file = nil) ⇒ GitV
Returns a new instance of GitV.
2 3 4 5 6 |
# File 'lib/gitv/gitv.rb', line 2 def initialize(src_root = nil, version_file = nil) @src_root = src_root || Dir.pwd @version_file = version_file || File.join( 'lib', 'data', 'version' ) @abs_version_file = File.join( @src_root, @version_file ) end |
Instance Method Details
#cache ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gitv/gitv.rb', line 12 def cache FileUtils.rm_rf( @abs_version_file ) FileUtils.mkdir_p( File.dirname( @abs_version_file ) ) File.write( @abs_version_file, version ) @version_file end |
#version ⇒ Object
8 9 10 |
# File 'lib/gitv/gitv.rb', line 8 def version @ver ||= retrieve_info end |