Class: Inspec::Resources::AptRepository
- Inherits:
- 
      Object
      
        - Object
- Inspec::Resources::AptRepository
 
- Defined in:
- lib/inspec/resources/apt.rb
Direct Known Subclasses
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #exists? ⇒ Boolean
- 
  
    
      #initialize(ppa_name)  ⇒ AptRepository 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of AptRepository. 
- #to_s ⇒ Object
Constructor Details
#initialize(ppa_name) ⇒ AptRepository
Returns a new instance of AptRepository.
| 41 42 43 44 45 46 47 48 49 50 | # File 'lib/inspec/resources/apt.rb', line 41 def initialize(ppa_name) @deb_url = nil # check if the os is ubuntu or debian if inspec.os.debian? @deb_url = determine_ppa_url(ppa_name) else # this resource is only supported on ubuntu and debian skip_resource "The `apt` resource is not supported on your OS yet." end end | 
Instance Method Details
#enabled? ⇒ Boolean
| 56 57 58 59 60 61 62 | # File 'lib/inspec/resources/apt.rb', line 56 def enabled? return false if find_repo.count == 0 actives = find_repo.map { |repo| repo[:active] } actives = actives.uniq actives.size == 1 && actives[0] = true end | 
#exists? ⇒ Boolean
| 52 53 54 | # File 'lib/inspec/resources/apt.rb', line 52 def exists? find_repo.count > 0 end | 
#to_s ⇒ Object
| 64 65 66 | # File 'lib/inspec/resources/apt.rb', line 64 def to_s "Apt Repository #{@deb_url}" end |