Files
chromebrew/packages/ruby_rubocop.rb
Satadru Pramanik af9e592d24 Ruby => 3.2.0 + update other gem packages (#7772)
* crew: Simplify + cleanup

* Bump version

* Express newlines in a more clear way

* Fix bugs

* Remove CREW_LA_RENAME_ENABLED logic completely

* Fix typo

* Add no_shrink to xwayland

* Add no_shrink to sommelier

* Use rmtree in lieu of rmdir

* Add crew change from ruby 3.2 PR.

* Need Dir.exist? in lieu of Dir.empty since dir may not exist

* rmdir is fine since we are checking for the dir, also check for empty dir before deleting the dir

* Make rubocop happy

* Handle SKIP package install failure

* merge conditionals

* Rubocop changes

* Allow for only ruby getting upgraded when it is in the upgrade list

* Revert filelist generation change as it creates a filelist with "/filelist" for empty packages like ruby_mdl

* remove trailing space

* Adjust messages when ruby is upgraded.

* Ruby => 3.2.0 + update other gem packages

* update rubocop

* adjust postinstall to avoid breakage during ruby upgrade

* remove binaries from some gem packages

* remove install section from no_compile_needed gems

* remove binaries from ruby_debug

* update rubocop config file setup

* simplify rubocop package further

* revert rubocop changes

* Use source_url for rubocop config

* suggested changes

* Fix paths for message and remove unnecessary rm from self.remove

Co-authored-by: supechicken <supechicken666@gmail.com>
2022-12-27 16:55:27 -06:00

47 lines
1.6 KiB
Ruby

# Adapted from Arch Linux ruby-rubocop PKGBUILD at:
# https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ruby-rubocop
require 'package'
class Ruby_rubocop < Package
description 'A Ruby static code analyzer and formatter'
homepage 'https://rubocop.org'
version '1.41.1-ruby-3.2'
compatibility 'all'
source_url 'https://github.com/chromebrew/chromebrew/raw/master/.rubocop.yml'
source_sha256 'c98e2a4bde8cbf658d226d71f1e84fc3e4ce071692e6253a7708c8c90af3f7b5'
depends_on 'libyaml'
depends_on 'ruby'
depends_on 'xdg_base'
no_fhs
no_compile_needed
def self.install
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/.config/rubocop"
FileUtils.install '.rubocop.yml', "#{CREW_DEST_PREFIX}/.config/rubocop/config.yml", mode: 0o644
end
def self.postinstall
@gem_name = name.sub('ruby_', '')
system "gem install -N #{@gem_name}", exception: false
puts "Chromebrew rubocop config file was installed at #{CREW_PREFIX}/.config/rubocop/config.yml".lightblue
puts 'This can be overridden by a ~/.rubocop.yml'.lightblue
end
def self.remove
@gem_name = name.sub('ruby_', '')
@gems_deps = `gem dependency ^#{@gem_name}\$ | awk '{print \$1}'`.chomp
# Delete the first line and convert to an array.
@gems = @gems_deps.split("\n").drop(1).append(@gem_name)
# bundler never gets uninstalled, though gem dependency lists it for
# every package, so delete it from the list.
@gems.delete('bundler')
@gems.each do |gem|
system "gem uninstall -Dx --force --abort-on-dependent #{gem}", exception: false
end
end
end