Sha256: 43a99179793af29c0a43f4665f3cc6c6a1988a8593482add8d76dcf486fdfc1b

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module PsmDeadSimpleDeploymentTools
  module Utils
    # nodoc
    module RunCommandAsSudo
      def run_command_as_sudo(cmd)
        run_command = RunCommandAsSudo.sudo_installed? ? "sudo #{cmd}" : cmd

        system(run_command)
      end

      class << self
        def sudo_installed?
          return @sudo_installed if defined? @sudo_installed

          @sudo_installed = !`which sudo`.nil?
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
psm_dead_simple_deployment_tools-0.1.1 lib/psm_dead_simple_deployment_tools/utills/run_command_as_sudo.rb