require_relative 'base' namespace :version do desc 'show version of library' task :show do raw_version = File.open(version_file, "r").readlines.grep(/VERSION/).first if raw_version version = raw_version.chomp.match(/VERSION\s+=\s+["']([^'"]+)["']/) { $1 } puts version else warn "Could not parse version file \"#{version_file}\"" end end end