Module: Indexer::Importer::VersionImportation
- Included in:
- Indexer::Importer
- Defined in:
- lib/indexer/importer/version.rb
Overview
Build mixin for Bundler's Gemfile.
Instance Method Summary collapse
-
#import(source) ⇒ Object
If the source file is a Gemfile, import it.
Instance Method Details
#import(source) ⇒ Object
If the source file is a Gemfile, import it.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/indexer/importer/version.rb', line 11 def import(source) case source when 'VERSION.txt', 'Version.txt' vers = File.read(source).strip .version = vers when 'VERSION', 'Version' text = File.read(source).strip if yaml?(text) # don't really like this style b/c it's too subjective hash = YAML.load(text) hash = hash.inject{ |h,(k,v)| h[k.to_sym] = v; h } vers = hash.values_at(:major,:minor,:patch,:build).compact else vers = File.read(source).strip end .version = vers else super(source) if defined?(super) end end |