module Diffend::LatestVersion
Verify if we are running latest version of the plugin
Public Class Methods
call(config)
click to toggle source
Verify if we are running latest version of the plugin
@param config [Diffend::Config]
# File lib/diffend/latest_version.rb, line 10 def call(config) return if config.development? return if installed_version == Diffend::VERSION print_message(config, installed_version) exit 2 end
Private Class Methods
build_message(version)
click to toggle source
@param version [Hash] installed version
@return [String]
# File lib/diffend/latest_version.rb, line 42 def build_message(version) <<~MSG \nYou are running an outdated version (#{version}) of the plugin, which will lead to issues. \nPlease upgrade to the latest one (#{Diffend::VERSION}) by executing "rm -rf .bundle/plugin".\n MSG end
installed_version()
click to toggle source
@return [String] installed plugin version
# File lib/diffend/latest_version.rb, line 22 def installed_version ::Bundler::Plugin .index .plugin_path('diffend') .basename .to_s .split('-') .last end
print_message(config, version)
click to toggle source
@param config [Diffend::Config] @param version [Hash] installed version
# File lib/diffend/latest_version.rb, line 34 def print_message(config, version) build_message(version) .tap(&config.logger.method(:error)) end