class EySecrets::Git
Public Class Methods
repository(path)
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 3 def self.repository(path) new(path).repository end
Public Instance Methods
repository()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 7 def repository Repository.new(remotes, files, in_sync?) end
Private Instance Methods
clean?()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 33 def clean? Dir.chdir(path) do `git status --porcelain` == '' end end
files()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 19 def files Dir[File.join(path, '**', '*')].map do |file| file.gsub(%r'^\./', '') end end
git_revision_diff_count()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 39 def git_revision_diff_count Dir.chdir(path) do `git fetch && git rev-list HEAD..origin/master --count`.to_i + `git rev-list origin/master..HEAD --count`.to_i end end
in_sync?()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 25 def in_sync? in_sync_with_origin? && clean? end
in_sync_with_origin?()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 29 def in_sync_with_origin? git_revision_diff_count == 0 end
remotes()
click to toggle source
# File lib/ey_secrets/adapters/git.rb, line 13 def remotes Dir.chdir(path) do @remotes ||= `git remote -v`.scan(/\t[^\s]+\s/).map { |c| c.strip }.uniq end end