semamore 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f100dde20e6743280ba73c80efa762df572a934c462fdc20379a1be985857a25
4
- data.tar.gz: 99528c7b1c77895f3c59bed8f3184d43fffdda2c923fc598c372d283c5b91c15
3
+ metadata.gz: 6aaa9e5c3063cec10a9a78cd2c9c6e3c88813fb20e5c92730ffd9ade25fe8aa8
4
+ data.tar.gz: d31d83457a02b65866e179bfd313d79231617f1c3d709f1d2f92940b040f0a8a
5
5
  SHA512:
6
- metadata.gz: 44a745707e1fb16ddf5012bc5bad335448e4f9662e8b866b8e2cafce8ba591dd216893704f3716c9fea657e14e71769e0c4018e23d0de3cfdfa85e0097c01158
7
- data.tar.gz: 1fe68d261e0c6ef547d9fdc05b3d5a5b0660b4355bacf8ce9e61626225bd8b58bc8a03ce0305b2ea5f238916b8c0e646bb1435d9e97b438210d8d9f77c12e448
6
+ metadata.gz: 95602a4803408a037df77741c9aa02a1db7d63f06aecdca64de0cebf0e934d91c3241b1caa75a98370d3e07b5eec92c8d21b135ab35ba0d064ce24414724aaae
7
+ data.tar.gz: 41b90a50be4e4bcb08092ee7a71cacaa2b7f2d340a750e5a0737bd66146bec68949b59122ee3d9e01accc32432430e76e30d5dc7b5d53f7d515cf1af1552558a
data/lib/semamore.rb CHANGED
@@ -4,15 +4,19 @@ require 'semamore_octo_client'
4
4
 
5
5
  class Semamore
6
6
  def initialize(token:, client_options: {})
7
+ p 'Starting semamore...'
7
8
  @client = ::SemamoreOctoClient.new(token, options: client_options)
8
9
  end
9
10
 
10
11
  def changed_files_guard(repo:, branch:, command:, pattern:)
12
+ p "Finding changed files on #{branch} that match #{pattern}..."
11
13
  files = client.current_pr_files(repo, branch)
12
14
 
13
15
  if has_matching_files?(pattern, files)
16
+ p "Found matching changed files, executing `#{command}`..."
14
17
  exec command
15
18
  else
19
+ p "No matching changed files found, skipping `#{command}`."
16
20
  exit 0
17
21
  end
18
22
  end
@@ -6,14 +6,17 @@ class SemamoreOctoClient
6
6
  end
7
7
 
8
8
  def current_pr_files(repo, branch)
9
+ p 'Fetching current PR changed files...'
9
10
  client.pull_request_files(repo, current_pr(repo, branch)[:number])
10
11
  end
11
12
 
12
13
  def current_pr(repo, branch)
14
+ p 'Selecting current PR...'
13
15
  open_prs(repo).select {|pr| pr[:head][:ref] == branch}.first
14
16
  end
15
17
 
16
18
  def open_prs(repo)
19
+ p 'Fetching open PRs...'
17
20
  client.pull_requests(repo, :state => "open")
18
21
  end
19
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semamore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Bennett