Last active
January 8, 2021 16:25
-
-
Save ovidiubite/fef079db62120fbcccf9508e0820aad3 to your computer and use it in GitHub Desktop.
rubocop_installer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
gems = Bundler::LockfileParser.new(Bundler.read_file("Gemfile.lock")) | |
rubocop_dependencies = gems.specs.map{|e| [e.name,e.version.to_s]}.select{|e| e.first.include?('rubocop') } | |
rubocop_dependencies.each do |gem| | |
gem_ver = "#{gem[0]} -v #{gem[1]}" | |
puts "executing: #{gem_ver}" | |
abort("Failed to install: #{gem_ver}") unless system("gem install #{gem_ver}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment