Class: Henitai::GitDiffAnalyzer
- Inherits:
-
Object
- Object
- Henitai::GitDiffAnalyzer
- Defined in:
- lib/henitai/git_diff_analyzer.rb
Overview
Shells out to git to discover changed files between two refs.
By default the analyzer runs in the current working directory. Callers can pass dir: to point it at another repository root without changing cwd.
Instance Method Summary collapse
- #changed_files(from:, to:, dir: Dir.pwd) ⇒ Object
- #changed_methods(from:, to:, dir: Dir.pwd) ⇒ Object
Instance Method Details
#changed_files(from:, to:, dir: Dir.pwd) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/henitai/git_diff_analyzer.rb', line 14 def changed_files(from:, to:, dir: Dir.pwd) stdout, stderr, status = git_diff(dir, "--name-only", from, to) raise GitDiffError, stderr.strip unless status.success? stdout.split("\n").reject(&:empty?) end |
#changed_methods(from:, to:, dir: Dir.pwd) ⇒ Object
22 23 24 25 26 |
# File 'lib/henitai/git_diff_analyzer.rb', line 22 def changed_methods(from:, to:, dir: Dir.pwd) changed_files(from:, to:, dir:).flat_map do |path| changed_methods_in_file(path, from:, to:, dir:) end end |