Sha256: f3ddf2bef3f3f1d687cf9dc65a4c0fd35ea2d72361af1d5cf9350b3b549796a9

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'erb'
require 'fileutils'


module Bourdain
  module Checks
    class Check < Bourdain::Resource
    protected
      def work_tree repo
        "--work-tree=#{File.join(Dir.pwd, repo)}"
      end

      def git_dir repo
        "--git-dir=#{File.join(Dir.pwd, repo, '.git')}"
      end

      def youre_behind? repo
        `git #{git_dir repo} log ..origin/master --oneline`.split("\n").length > 0
      end

      def youre_ahead? repo
        `git #{git_dir repo} log origin/master.. --oneline`.split("\n").length > 0
      end

      def youre_dirty? repo
        `git #{git_dir repo} #{work_tree repo} diff HEAD --numstat`.split("\n").length > 0
      end
    end
  end
end

require_relative 'checks/chef'
require_relative 'checks/hooks'
require_relative 'checks/bourdain'
require_relative 'checks/cookbooks'
require_relative 'checks/ssh_config'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bourdain-1.2.14 lib/bourdain/resources/checks.rb
bourdain-1.2.13 lib/bourdain/resources/checks.rb