class GitHooks::Hook::Manifest
Attributes
hook[R]
Public Class Methods
new(hook)
click to toggle source
# File lib/githooks/hook.rb, line 171 def initialize(hook) @hook = hook end
Public Instance Methods
files()
click to toggle source
# File lib/githooks/hook.rb, line 179 def files # rubocop:disable AbcSize,MethodLength @files ||= begin options = { staged: hook.staged, tracked: hook.tracked, untracked: hook.untracked } if %w[ commit-msg pre-push ].include? hook.phase begin parent_sha = repository.last_unpushed_commit_parent_sha || \ repository.branch_point_sha options.merge!(ref: parent_sha) if parent_sha rescue Error::RemoteNotSet STDERR.puts 'Couldn\'t find starting reference point for push ' \ 'manifest generation. Falling back to all tracked files.' # remote not set yet, so let's only focus on what's tracked for now options[:tracked] = true options[:untracked] = false options[:staged] = false end end repository.manifest(options) end end
filter(limiters)
click to toggle source
# File lib/githooks/hook.rb, line 206 def filter(limiters) files.dup.tap do |files| limiters.each do |type, limiter| STDERR.puts "Limiter [#{type}] -> (#{limiter.only.inspect}) match against: " if GitHooks.debug? limiter.limit(files) end end end
repository()
click to toggle source
# File lib/githooks/hook.rb, line 175 def repository @hook.repository end