class GemHadar

def version_show_task

then outputs a message indicating whether the versions match or not.
compares it with the version specified in the GemHadar configuration. It
reads the version from the generated version file in the lib directory and
This method creates a :version:show task under the Rake namespace that

version of the gem.
The version_show_task method defines a Rake task that displays the current
def version_show_task
  namespace :version do
    desc "Displaying the current version"
    task :show do
      require path_name
      dir = File.join('lib', path_name)
      version_file = File.join(dir, 'version.rb')
      m = Module.new
      m.instance_eval File.read(version_file)
      version_rb   = m.const_get(
        [ path_module, 'VERSION' ] * '::'
      )
      equal        = version == version_rb ? '==' : '!='
      puts "version.rb=#{version_rb} #{equal} VERSION=#{version}"
    end
  end
end