Class: Bindep::Item
- Inherits:
-
Object
- Object
- Bindep::Item
- Defined in:
- lib/bindep/item.rb
Instance Attribute Summary collapse
-
#apt ⇒ Object
Returns the value of attribute apt.
-
#brew ⇒ Object
Returns the value of attribute brew.
-
#command ⇒ Object
Returns the value of attribute command.
-
#depends ⇒ Object
Returns the value of attribute depends.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#install_command ⇒ Object
Get the installation commands for the current system as a single string.
-
#npm ⇒ Object
Returns the value of attribute npm.
-
#rubygem ⇒ Object
Returns the value of attribute rubygem.
-
#yum ⇒ Object
Returns the value of attribute yum.
Instance Method Summary collapse
-
#initialize(id) ⇒ Item
constructor
A new instance of Item.
-
#local_command(reset = false) ⇒ Object
Get the command for the current system.
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
#apt ⇒ Object
Returns the value of attribute apt.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def apt @apt end |
#brew ⇒ Object
Returns the value of attribute brew.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def brew @brew end |
#command ⇒ Object
Returns the value of attribute command.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def command @command end |
#depends ⇒ Object
Returns the value of attribute depends.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def depends @depends end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/bindep/item.rb', line 3 def id @id end |
#install_command ⇒ Object
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 |
#npm ⇒ Object
Returns the value of attribute npm.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def npm @npm end |
#rubygem ⇒ Object
Returns the value of attribute rubygem.
4 5 6 |
# File 'lib/bindep/item.rb', line 4 def rubygem @rubygem end |
#yum ⇒ Object
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 |