class Itamae::Plugin::Resource::AurPackage
Public Instance Methods
action_install(action_options)
click to toggle source
# File lib/itamae/plugin/resource/aur_package.rb, line 46 def action_install(action_options) if run_specinfra(:check_package_is_installed, attributes.name, attributes.version) return end yay_executable = run_command('which yay', error: false).exit_status == 0 if yay_executable run_command("yay -S --noconfirm #{attributes.options} #{attributes.name}") else name = attributes.name tmp_dir = "/tmp/itamae-plugin-resource-aur_package-#{name}-#{Time.now.to_f}" run_command("mkdir #{tmp_dir}") run_command("curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/#{name}.tar.gz", cwd: tmp_dir) run_command("tar -xvf #{name}.tar.gz", cwd: tmp_dir) run_command("makepkg -si --noconfirm #{attributes.options}", cwd: "#{tmp_dir}/#{name}" ) run_command("rm -rf #{tmp_dir}") end updated! end
action_remove(action_options)
click to toggle source
# File lib/itamae/plugin/resource/aur_package.rb, line 66 def action_remove(action_options) if run_specinfra(:check_package_is_installed, attributes.name, nil) run_specinfra(:remove_package, attributes.name, attributes.options) updated! end end
pre_action()
click to toggle source
# File lib/itamae/plugin/resource/aur_package.rb, line 29 def pre_action case @current_action when :install attributes.installed = true when :remove attributes.installed = false end end
run()
click to toggle source
Calls superclass method
# File lib/itamae/plugin/resource/aur_package.rb, line 22 def run os = backend.instance_variable_get(:@backend).os_info raise NotSupportedError.new(os) unless os[:family] == 'arch' super end
set_current_attributes()
click to toggle source
# File lib/itamae/plugin/resource/aur_package.rb, line 38 def set_current_attributes current.installed = run_specinfra(:check_package_is_installed, attributes.name) if current.installed current.version = run_specinfra(:get_package_version, attributes.name).stdout.strip end end