Module: FunWith::VersionStrings::API
- Included in:
- FunWith::VersionStrings
- Defined in:
- lib/version_strings/api.rb
Overview
methods that can be called directly upon the module FunWith::VersionStrings
Instance Method Summary collapse
-
#versionize(obj, version_string = nil) ⇒ Object
if no string is given, the given object is assumed to have a root path and to have a file “VERSION” immediately underneath that root.
Instance Method Details
#versionize(obj, version_string = nil) ⇒ Object
if no string is given, the given object is assumed to have a root path and to have a file “VERSION” immediately underneath that root. That’s standard for my gems.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/version_strings/api.rb', line 8 def versionize( obj, version_string = nil ) if obj.respond_to?(:version) warn( "FunWith::VersionStrings (warn): #{obj.to_s[0..100]} already responds to version(). Leaving alone.") return nil end if version_string.nil? if obj.respond_to?(:root) && obj.root.is_a?(FunWith::Files::FilePath) && obj.root("VERSION").file? version_string = obj.root("VERSION").read else raise "No version string specified, and cannot infer version from VERSION file." end end obj.extend( VersionizeExtender ) obj.version( version_string ) end |