lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb in fusuma-plugin-appmatcher-0.4.0 vs lib/fusuma/plugin/appmatcher/gnome_extensions/installer.rb in fusuma-plugin-appmatcher-0.5.0
- old
+ new
@@ -7,25 +7,27 @@
module Plugin
module Appmatcher
module GnomeExtensions
# Install Gnome Extension
class Installer
+ include UserSwitcher
+
EXTENSION = "./appmatcher@iberianpig.dev"
def install
- pid = UserSwitcher.new.as_user(proctitle: self.class.name.underscore) do |user|
+ pid = as_user(proctitle: self.class.name.underscore) do |user|
FileUtils.cp_r(source_path, user_extension_dir(user.username))
puts "Installed Appmatcher Gnome Shell Extension to #{user_extension_dir(user.username)}"
puts "Restart your session, then activate Appmatcher on gnome-extensions-app"
end
Process.waitpid(pid)
end
def uninstall
return puts "Appmatcher Gnome Shell Extension is not installed in #{user_extension_dir}/" unless installed?
- pid = UserSwitcher.new.as_user(proctitle: self.class.name.underscore) do |user|
+ pid = as_user(proctitle: self.class.name.underscore) do |user|
FileUtils.rm_r(install_path(user.username))
puts "Uninstalled Appmatcher Gnome Shell Extension from #{install_path(user.username)}"
end
Process.waitpid(pid)
end
@@ -47,10 +49,10 @@
def source_path
File.expand_path(EXTENSION, __dir__)
end
def login_username
- UserSwitcher.new.login_user.username
+ UserSwitcher.login_user.username
end
end
end
end
end