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 +4 -4
- data/lib/semamore.rb +4 -0
- data/lib/semamore_octo_client.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aaa9e5c3063cec10a9a78cd2c9c6e3c88813fb20e5c92730ffd9ade25fe8aa8
|
4
|
+
data.tar.gz: d31d83457a02b65866e179bfd313d79231617f1c3d709f1d2f92940b040f0a8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/semamore_octo_client.rb
CHANGED
@@ -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
|
|