Class: GUIXPackage

Inherits:
Struct
  • Object
show all
Defined in:
lib/upm/tools/guix.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



1
2
3
# File 'lib/upm/tools/guix.rb', line 1

def name
  @name
end

#outObject

Returns the value of attribute out

Returns:

  • (Object)

    the current value of out



1
2
3
# File 'lib/upm/tools/guix.rb', line 1

def out
  @out
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



1
2
3
# File 'lib/upm/tools/guix.rb', line 1

def path
  @path
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



1
2
3
# File 'lib/upm/tools/guix.rb', line 1

def version
  @version
end

Class Method Details

.avaialbleObject



10
11
12
# File 'lib/upm/tools/guix.rb', line 10

def self.avaialble
  @available_packages ||= IO.popen(["guix", "package", "--list-available"]) { |io| io.each_line.map { |line| GUIXPackage.from_line(line) } }
end

.from_line(line) ⇒ Object



2
3
4
# File 'lib/upm/tools/guix.rb', line 2

def self.from_line(line)
  new(*line.chomp.split)
end

.installedObject



6
7
8
# File 'lib/upm/tools/guix.rb', line 6

def self.installed
  @installed_packages ||= IO.popen(["guix", "package", "--list-installed"]) { |io| io.each_line.map { |line| GUIXPackage.from_line(line) } }
end

Instance Method Details

#installed?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/upm/tools/guix.rb', line 14

def installed?
  !!path[%r{^/gnu/store/}]
end