Class: GitHooks::Hook::Manifest
Instance Method Summary collapse
-
#files ⇒ Object
rubocop:disable Metrics/AbcSize.
- #filter(limiters) ⇒ Object
-
#initialize(hook) ⇒ Manifest
constructor
A new instance of Manifest.
- #repository ⇒ Object
Constructor Details
#initialize(hook) ⇒ Manifest
Returns a new instance of Manifest.
168 169 170 |
# File 'lib/githooks/hook.rb', line 168 def initialize(hook) @hook = hook end |
Instance Method Details
#files ⇒ Object
rubocop:disable Metrics/AbcSize
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/githooks/hook.rb', line 176 def files # rubocop:disable Metrics/AbcSize @files ||= begin = { staged: hook.staged, tracked: hook.tracked, untracked: hook.untracked } if %w[ commit-msg pre-push ].include? hook.phase begin if (parent_sha = repository.last_unpushed_commit_parent) .merge!(ref: parent_sha) end rescue Error::RemoteNotSet # remote not set yet, so let's only focus on what's tracked for now [:tracked] = true [:untracked] = false [:staged] = false end end repository.manifest() end end |
#filter(limiters) ⇒ Object
201 202 203 204 205 206 207 208 |
# File 'lib/githooks/hook.rb', line 201 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 ⇒ Object
172 173 174 |
# File 'lib/githooks/hook.rb', line 172 def repository @hook.repository end |