Files
chromebrew/packages/cheat.rb
Satadru Pramanik, DO, MPH, MEng 5621163c84 Refactor ruby gems in packages, crew cleanup of debugging, install.sh refactor for gems (#10294)
* Some ruby gem updates and cleanup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* bump version

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* move gem installs to core install

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add webkitgtk_6 binaries for x86_64, add librsvg binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add rebuilt librsvg binary for x86_64.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rename gem function internals to make more sense

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust webkitgtk_6 deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update ruby gem packages, add a ruby gem package update script to tools

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild parted

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add parted binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* refactor ruby buildsystem

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add libsdl2, freerdp binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* sync crew function to lib/fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* shellcheck fix

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add const for CREW_UPDATE_CHECK_INTERVAL

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move time_difference into function for neatness.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes from @uberhacker

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* @Zopolis4 suggested change: Use git last update time

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add .blank? usage to downloader to avoid undefined method `empty?' for nil (NoMethodError)

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-08-13 11:25:39 -05:00

46 lines
1.6 KiB
Ruby

require 'package'
class Cheat < Package
description 'Create and view interactive cheatsheets on the command-line.'
homepage 'https://github.com/cheat/cheat'
version '4.2.3'
license 'MIT'
compatibility 'all'
source_url 'SKIP'
depends_on 'xdg_base'
def self.install
case ARCH
when 'aarch64', 'armv7l'
url = 'https://github.com/cheat/cheat/releases/download/4.2.3/cheat-linux-arm7.gz'
sha256 = '4ac2fea19ff1dd063f7fa7e76b5329babeaee8c10756eeeffa8fafecd8c8dabc'
when 'i686'
url = 'https://github.com/cheat/cheat/releases/download/4.2.3/cheat-linux-386.gz'
sha256 = 'faca842f1b5b200558f899c2730cadec00a261cdabbb9fad8638f2487bed8059'
when 'x86_64'
url = 'https://github.com/cheat/cheat/releases/download/4.2.3/cheat-linux-amd64.gz'
sha256 = '899e7d88d9441b9a32034b0c4b6761157e7977131932a2abc13a382794e7ea6c'
end
downloader url, sha256, 'cheat.gz'
Zlib::GzipReader.open('cheat.gz') { |gz| File.write('cheat', gz.read) }
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
FileUtils.install 'cheat', "#{CREW_DEST_PREFIX}/bin/cheat", mode: 0o755
end
def self.postremove
config_dir = "#{HOME}/.config/cheat"
if Dir.exist? config_dir
puts 'WARNING: This will remove all cheat config!'.orange
print "Would you like to remove the #{config_dir} directory? [y/N] "
case $stdin.gets.chomp.downcase
when 'y', 'yes'
FileUtils.rm_rf config_dir
puts "#{config_dir} removed.".lightgreen
else
puts "#{config_dir} saved.".lightgreen
end
end
end
end