class MacSetup::Plugins::Asdf

Constants

TOOL_VERSIONS_FILE

Public Class Methods

add_requirements(config) click to toggle source
# File lib/mac_setup/plugins/asdf.rb, line 7
def add_requirements(config)
  config.require_value(:asdf)
  config.add(:brews, :asdf)
end
run(config, _status) click to toggle source
# File lib/mac_setup/plugins/asdf.rb, line 12
def run(config, _status)
  install_missing_plugins(config)
  install_missing_versions
end

Private Class Methods

install_missing_plugins(config) click to toggle source
# File lib/mac_setup/plugins/asdf.rb, line 19
def install_missing_plugins(config)
  (config.asdf - installed_plugins).each do |plugin|
    Shell.run("asdf", "plugin-add", plugin)
  end
end
install_missing_versions() click to toggle source
# File lib/mac_setup/plugins/asdf.rb, line 25
def install_missing_versions
  tool_versions = TOOL_VERSIONS_FILE.read.split("\n")

  tool_versions.each do |line|
    plugin, version = line.split(" ")

    Shell.run("asdf", "install", plugin, version)
  end
end
installed_plugins() click to toggle source
# File lib/mac_setup/plugins/asdf.rb, line 35
def installed_plugins
  @installed_plugins ||= Shell.result("asdf", "plugin-list").split("\n")
end