Class: RubyDebugHook
- Inherits:
-
RubyGitHooks::Hook
- Object
- RubyGitHooks::Hook
- RubyDebugHook
- Defined in:
- lib/ruby_git_hooks/ruby_debug.rb
Overview
This hook looks for source files that include ruby-debug and fails if any do. It exists primarily for testing. It’s functional, but not necessarily useful.
Constant Summary
Constants inherited from RubyGitHooks::Hook
RubyGitHooks::Hook::HOOK_INFO, RubyGitHooks::Hook::HOOK_TYPE_SETUP
Instance Method Summary collapse
Methods inherited from RubyGitHooks::Hook
get_hooks_to_run, initial_setup, register, run, run_as_specific_githook, #setup, shell!
Instance Method Details
#check ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby_git_hooks/ruby_debug.rb', line 10 def check bad_files = [] file_diffs.each do |file, diff| if diff.include? "require 'ruby-debug'" bad_files << file end end return true if bad_files.empty? puts "You left requires of ruby-debug in the following files:\n" puts bad_files.join("\n") false end |