Method: Dply::Release.find_installed_name

Defined in:
lib/dply/release.rb

.find_installed_name(**kwargs) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/dply/release.rb', line 20

def self.find_installed_name(**kwargs)
  branch = kwargs.fetch(:branch).to_s.tr('-/', '__')
  app_name = kwargs.fetch(:app_name).to_s.tr('-/', '__')
  revision = kwargs.fetch(:revision)

  name_without_ts = "#{revision}-#{app_name}-#{branch}-"
  latest = Dir["releases/#{name_without_ts}*"].sort_by { |x, y| File.mtime(x) }.first
  latest ? File.basename(latest) : nil
end