Class: Dependencies::Apt

Inherits:
VersionedDependency show all
Defined in:
lib/dependencies/apt.rb

Constant Summary

Constants inherited from VersionedDependency

VersionedDependency::VERSION_SEPARATOR

Constants inherited from Dependency

Dependency::DESCRIPTION_TYPE_WIDTH

Instance Attribute Summary

Attributes inherited from Dependency

#name

Instance Method Summary collapse

Methods inherited from VersionedDependency

#dep_name, #dep_version, #versioned?

Methods inherited from Dependency

#always_act?, #exit_code, #initialize, #output, #success?, #type

Constructor Details

This class inherits a constructor from Dependency

Instance Method Details

#meetObject


16
17
18
19
20
21
22
# File 'lib/dependencies/apt.rb', line 16

def meet
	if versioned?
		execute("#{sudo_string}apt-get install -y #{dep_name}=#{dep_version}")
	else
		execute("#{sudo_string}apt-get install -y #{name}")
	end
end

#met?Boolean

Returns:

  • (Boolean)

8
9
10
11
12
13
14
# File 'lib/dependencies/apt.rb', line 8

def met?
	if versioned?
		apt_cache_policy.installed_version == dep_version
	else
		apt_cache_policy.installed?
	end
end

#should_meet?Boolean

Returns:

  • (Boolean)

29
30
31
# File 'lib/dependencies/apt.rb', line 29

def should_meet?
	`uname`.chomp == "Linux" && system("which apt-get", out: File::NULL, err: File::NULL)
end

#unmeetObject


24
25
26
27
# File 'lib/dependencies/apt.rb', line 24

def unmeet
	# do nothing; we don't want to uninstall packages and reinstall them every time
	true
end