class KPM::Utils

def get_plugin_name_from_file_path(file_path)

def get_plugin_name_from_file_path(file_path)
  base = File.basename(file_path).to_s
  ver = get_version_from_file_path(file_path)
  ext = File.extname(base)
  name = base.gsub(ext, '')
  if ver.nil?
    # this will remove SNAPSHOT and any dash that appear before it (ex --SNAPSHOT).
    name = name.gsub(/((-+){,1}SNAPSHOT){,1}/, '')
    last_dash = name.rindex('-')
    name = name[0..last_dash] unless last_dash.nil?
  else
    name = name.gsub(ver, '')
  end
  name = name[0..name.length - 2] if name[-1].match(/[a-zA-z]/).nil?
  name
end