Class: Maintainer::PIPInstall
- Inherits:
-
I_Instructions
- Object
- I_Instructions
- Maintainer::PIPInstall
- Defined in:
- lib/maintainer_core/instructions.rb
Instance Method Summary collapse
- #crash_on_error! ⇒ Object
- #error_message! ⇒ Object
-
#initialize(pkg, msg_success, msg_error, should_crash) ⇒ PIPInstall
constructor
A new instance of PIPInstall.
- #run! ⇒ Object
- #success_message! ⇒ Object
Constructor Details
#initialize(pkg, msg_success, msg_error, should_crash) ⇒ PIPInstall
Returns a new instance of PIPInstall.
41 42 43 44 45 46 |
# File 'lib/maintainer_core/instructions.rb', line 41 def initialize(pkg, msg_success, msg_error, should_crash) @package = pkg @msg_success = msg_success @msg_error = msg_error @should_crash = should_crash end |
Instance Method Details
#crash_on_error! ⇒ Object
65 66 67 |
# File 'lib/maintainer_core/instructions.rb', line 65 def crash_on_error!() return false end |
#error_message! ⇒ Object
76 77 78 79 80 81 |
# File 'lib/maintainer_core/instructions.rb', line 76 def () if not @msg_error or @msg_error.empty? return "[Error] #{@package}" end return "#{@msg_error}" end |
#run! ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/maintainer_core/instructions.rb', line 48 def run!() # Check if pip is installed if not InstallPIP.installed! # Install PIP CommandRunner.execute( command: Commands::Pip::Install, error: nil ) end # pip is installed CommandRunner.execute( command: "pip3 install #{@package}", error: nil ) return true end |
#success_message! ⇒ Object
69 70 71 72 73 74 |
# File 'lib/maintainer_core/instructions.rb', line 69 def () if not @msg_success or @msg_success.empty? return "[Installed] #{@package}" end return "#{@msg_success}" end |