Last active
September 14, 2023 10:01
-
-
Save pelletencate/1e1b3dd1a3fafe0cb7df60feab36c2e3 to your computer and use it in GitHub Desktop.
Install Gemsets in Dash.app for all ruby gems in your bundle (without cooking your system resources)
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
#!/usr/bin/env ruby | |
require 'etc' | |
dependencies = `bundle show | grep '*' | awk '{print $2, $3}' | sed -e 's/(//' -e 's/)//'`.split("\n") | |
dependencies.each.with_index(1) do |dependency, i| | |
(gem_name, version) = dependency.split | |
next if /rails-assets/.match?(gem_name) | |
puts "Installing docs for #{gem_name} #{version} " | |
command = "open -g 'dash-install://repo_name=Ruby%20Docsets&entry_name=#{gem_name}&version=#{version}'" | |
system(command) | |
sleep 1 | |
while `pgrep rdocset | wc -l`.to_i >= Etc.nprocessors | |
sleep 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment