module Capistrano::MB::Compatibility

Public Class Methods

check() click to toggle source
# File lib/capistrano/mb/compatibility.rb, line 4
def self.check
  check_capistrano_and_rake_are_loaded
  check_blacklisted_capistrano_version
end
check_blacklisted_capistrano_version() click to toggle source
# File lib/capistrano/mb/compatibility.rb, line 18
def self.check_blacklisted_capistrano_version
  return unless defined?(Capistrano::VERSION)
  return unless Capistrano::VERSION == "3.2.0"

  warn "Capistrano 3.2.0 has a critical bug that prevents "\
       "capistrano-mb from working as intended:\n"\
       "https://github.com/capistrano/capistrano/issues/1004"
end
check_capistrano_and_rake_are_loaded() click to toggle source
# File lib/capistrano/mb/compatibility.rb, line 9
def self.check_capistrano_and_rake_are_loaded
  return if defined?(Capistrano::VERSION) && defined?(Rake)

  warn "capistrano/mb must be loaded by Capistrano in order "\
       "to work.\nRequire this gem by using Capistrano's Capfile, "\
       "as described here:\n"\
       "https://github.com/mattbrictson/capistrano-mb#installation"
end
warn(message) click to toggle source

We can't really rely on anything being loaded at this point, so define our own basic colorizing helper.

# File lib/capistrano/mb/compatibility.rb, line 29
def self.warn(message)
  return $stderr.puts("WARNING: #{message}") unless $stderr.tty?
  $stderr.puts("\e[0;31;49mWARNING: #{message}\e[0m")
end