require 'package'

class Gitkraken < Package
  description 'The legendary Git GUI for Windows, Mac and Linux'
  homepage 'https://www.gitkraken.com/git-client'
  version '6.5.4'
  license 'Gitkracken-EULA'
  compatibility 'x86_64'
  source_url 'https://release.gitkraken.com/linux/gitkraken-amd64.tar.gz'
  source_sha256 '9b885d9668379693dc69ce589b3c7c4788695d03fea91f35433bfd3d29591d89'

  binary_url({
    x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/gitkraken/6.5.4_x86_64/gitkraken-6.5.4-chromeos-x86_64.tar.xz'
  })
  binary_sha256({
    x86_64: '71213a6e8a542787c455e2480a78ba7463be1573263bdfcef8fc499b61355b4a'
  })

  depends_on 'gtk3'
  depends_on 'libgit2'
  depends_on 'sommelier'

  def self.install
    FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
    FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share"
    FileUtils.mv Dir.pwd, "#{CREW_DEST_PREFIX}/share"
    FileUtils.ln_s "#{CREW_PREFIX}/share/gitkraken/gitkraken", "#{CREW_DEST_PREFIX}/bin/gitkraken"
  end
end
