Class: Semamore
- Inherits:
-
Object
- Object
- Semamore
- Defined in:
- lib/semamore.rb
Instance Method Summary collapse
- #changed_files_guard(repo:, branch:, command:, pattern:) ⇒ Object
-
#initialize(token:, client_options: {}) ⇒ Semamore
constructor
A new instance of Semamore.
Constructor Details
#initialize(token:, client_options: {}) ⇒ Semamore
Returns a new instance of Semamore.
6 7 8 9 |
# File 'lib/semamore.rb', line 6 def initialize(token:, client_options: {}) p 'Starting semamore...' @client = ::SemamoreOctoClient.new(token, options: ) end |
Instance Method Details
#changed_files_guard(repo:, branch:, command:, pattern:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/semamore.rb', line 11 def changed_files_guard(repo:, branch:, command:, pattern:) p "Finding changed files on #{branch} that match #{pattern}..." files = client.current_pr_files(repo, branch) if has_matching_files?(pattern, files) p "Found matching changed files, executing `#{command}`..." exec command else p "No matching changed files found, skipping `#{command}`." exit 0 end end |