Sha256: f02c47857e7a8de9e63a8145e05b2366a59beb2ef677c574e04cc4684f62ad0a
Contents?: true
Size: 1.53 KB
Versions: 9
Compression:
Stored size: 1.53 KB
Contents
module Jack class VersionChecker REQUIRED_VERSION = "3.1.2" include Util def run leave(not_installed) if eb_bin == "" leave(version_too_low) unless check end def check major, minor, patch = version_parts(parsed_version) r_major, r_minor, r_patch = version_parts(REQUIRED_VERSION) (major > r_major) || (major == r_major && minor > r_minor) || (major == r_major && minor == r_minor && patch >= r_patch) end def get_version `#{eb_bin} --version` end def parsed_version @parsed_version ||= parse_version(get_version) end def parse_version(version) parsed = version.match(/EB CLI (\d+\.\d+\.\d+)/)[1] end def version_parts(parsed) parsed.split('.').collect(&:to_i) end def not_installed message = "Unable to detect an installation of the eb cli tool. Please install the eb tool.\n\n" message << install_instructions message end def version_too_low <<~EOS Unable to detect a version of the eb cli tool that works with jack. Detected version #{parsed_version}. #{install_instructions} EOS end def install_instructions if RUBY_PLATFORM =~ /darwin/ "You can install the eb tool via homebrew:\n\nbrew install awsebcli" else "Installation instructions: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html" end end # for specs def leave(message) puts(message) exit 0 end end end
Version data entries
9 entries across 9 versions & 1 rubygems