Sha256: 38ec1614b4dc2cf01a5e5e0151ce3ef60ebe3318dcb738b243caa26f414455c6
Contents?: true
Size: 1.89 KB
Versions: 5
Compression:
Stored size: 1.89 KB
Contents
module Bourdain module Checks class HooksCheck < Check usage :check, <<-END Check the local copy of the Kitchen Hooks hooks END def initialize _ super [] return unless require_chef! check_hooks! end private def check_hooks! # Ensure we have an up-to-date copy of the Kitchen Hooks hooks = File.join('utils', 'hooks') ahead_of_remote = false unless Dir.exists? hooks log.warn "Hm, I don't see a copy of the Kitchen Hooks. I'll fix that for you..." %x| git clone git@git.bluejeansnet.com:kitchen-hooks.git #{hooks} | log.info "Your copy of the Kitchen Hooks is now up-to-date." else if youre_dirty? hooks log.warn "Your copy of the Kitchen Hooks is dirty." elsif youre_ahead? hooks log.warn "Your copy of the Kitchen Hooks is ahead of the remote." ahead_of_remote = true elsif youre_behind? hooks log.warn "Hey, looks like your copy of the Kitchen Hooks is out-of-date. I'll fix that for you..." Dir.chdir(bourdain) { %x| git pull | } log.info "Your copy of the Kitchen Hooks is now up-to-date." else log.info "Your copy of the Kitchen Hooks looks up-to-date." end end local_version = gemfile_version 'kitchen_hooks' latest_version = rubygems_version 'kitchen_hooks' if latest_version == local_version log.info 'Your Kitchen is bundled with the latest Kitchen Hooks.' elsif local_version < latest_version log.error 'Your Kitchen is bundled with older Kitchen Hooks. Try "bundle update kitchen_hooks".' error! else log.warn "You appear to have unreleased Kitchen Hooks. I hope you know what you're doing..." end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems