Class: Dnf

Inherits:
Thor
  • Object
show all
Defined in:
lib/pkg/pkgm/dnf.rb

Instance Method Summary collapse

Instance Method Details

#add_repo(repo) ⇒ Object



7
8
9
10
11
12
# File 'lib/pkg/pkgm/dnf.rb', line 7

def add_repo(repo)
  system 'sudo', 'dnf', 'install', '-y', 'dnf-plugins-core'
  success = system 'sudo', 'dnf', 'config-manager', '--add-repo', repo

  PkgConfig.add(self.class.name, ConfigOptions::REPOS, repo, success)
end

#install(package, *args) ⇒ Object



33
34
35
36
37
# File 'lib/pkg/pkgm/dnf.rb', line 33

def install(package, *args)
  success = system 'sudo', 'dnf', 'install', *args, package

  PkgConfig.add(self.class.name, ConfigOptions::PACKAGES, package, success)
end

#list_reposObject



23
24
25
# File 'lib/pkg/pkgm/dnf.rb', line 23

def list_repos
  system 'dnf', 'repolist', 'enabled'
end

#remove_repo(repo, url) ⇒ Object



15
16
17
18
19
20
# File 'lib/pkg/pkgm/dnf.rb', line 15

def remove_repo(repo, url)
  system 'sudo', 'dnf', 'install', '-y', 'dnf-plugins-core'
  success = system 'sudo', 'dnf', 'config-manager', '--set-disabled', repo

  PkgConfig.remove(self.class.name, ConfigOptions::REPOS, url, success)
end

#uninstall(package, *args) ⇒ Object



45
46
47
48
49
# File 'lib/pkg/pkgm/dnf.rb', line 45

def uninstall(package, *args)
  success = system 'sudo', 'dnf', 'remove', *args, package

  PkgConfig.remove(self.class.name, ConfigOptions::PACKAGES, package, success)
end

#update(*args) ⇒ Object



40
41
42
# File 'lib/pkg/pkgm/dnf.rb', line 40

def update(*args)
  system 'sudo', 'dnf', 'update', *args
end