Sha256: 4bc82f4931cd84481638adc328010b51e1a8960d8738e76706a2e1e62180be04
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
module LearnDoctor class HealthCheck class StepInstaller attr_reader :step, :title, :sudo, :password_required attr_accessor :file, :result def initialize(step) @step = step @title = step[:title] @sudo = step[:sudo] @password_required = step[:password] end def execute set_file run_install_for_step print_result unlink_file! self end private def set_file print "Installing #{title}..." self.file = LearnDoctor::HealthCheck::File.new(step, :install) end def run_install_for_step if password_required puts "Your password is required to install #{title}." print 'Password: ' password = gets.chomp self.result = `#{file.path} #{password}` else self.result = `#{sudo ? 'sudo ' : ''}#{file.path}`.strip end end def print_result if result.match(/Done/) puts 'done'.green else puts 'error'.red end end def unlink_file! file.unlink! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
learn-doctor-1.0.3 | lib/learn_doctor/health_check/step_installer.rb |
learn-doctor-1.0.2 | lib/learn_doctor/health_check/step_installer.rb |