Class: Bindep::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/bindep/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Item

Returns a new instance of Item.



6
7
8
# File 'lib/bindep/item.rb', line 6

def initialize(id)
  @id = id.to_sym
end

Instance Attribute Details

#aptObject

Returns the value of attribute apt.



4
5
6
# File 'lib/bindep/item.rb', line 4

def apt
  @apt
end

#brewObject

Returns the value of attribute brew.



4
5
6
# File 'lib/bindep/item.rb', line 4

def brew
  @brew
end

#commandObject

Returns the value of attribute command.



4
5
6
# File 'lib/bindep/item.rb', line 4

def command
  @command
end

#dependsObject

Returns the value of attribute depends.



4
5
6
# File 'lib/bindep/item.rb', line 4

def depends
  @depends
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/bindep/item.rb', line 3

def id
  @id
end

#install_commandObject

Get the installation commands for the current system as a single string. Return nil if there is no command that fits the current system.



21
22
23
# File 'lib/bindep/item.rb', line 21

def install_command
  @install_command
end

#npmObject

Returns the value of attribute npm.



4
5
6
# File 'lib/bindep/item.rb', line 4

def npm
  @npm
end

#rubygemObject

Returns the value of attribute rubygem.



4
5
6
# File 'lib/bindep/item.rb', line 4

def rubygem
  @rubygem
end

#yumObject

Returns the value of attribute yum.



4
5
6
# File 'lib/bindep/item.rb', line 4

def yum
  @yum
end

Instance Method Details

#local_command(reset = false) ⇒ Object

Get the command for the current system. Return nil if command is not available.



11
12
13
14
15
16
17
# File 'lib/bindep/item.rb', line 11

def local_command(reset = false)
  @local_command = nil if reset

  @local_command ||= [ command ].flatten.compact.find do |cmd|
    Helpers.command_exists? cmd
  end
end