nya_pr 0.3.0 → 0.4.0
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/README.md +1 -0
- data/lib/nya_pr/cli/command.rb +5 -0
- data/lib/nya_pr/config/global.rb +15 -1
- data/lib/nya_pr/repository/collector.rb +25 -5
- data/lib/nya_pr/repository/config.rb +4 -2
- data/lib/nya_pr/version.rb +1 -1
- 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: 29ee2a7a39ef6c0643bf8fd4c29e75ace604a36112958a08d5a2ad21f7dd6d51
|
|
4
|
+
data.tar.gz: 8390d9f7533c7c1d9abd9f2588548152d520d9e624c62ec841a9e57181b2a88c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b290bc4f56e97ab8770f044aed6dc7c90a2ac8125f7899e43b53e31a481fc58b6fcbe60308ffb8087c07746456412fc6d5add5bbffbb2fd1ff5a04660d8c05b
|
|
7
|
+
data.tar.gz: a99c47b8e324b2f5b005b93fe1f7a657e07ce6e88bc1e1bd9566aa15e33009131129a375c52f7c22358f609b3029be6f4c1c2a9fa2c1c4913809b4657470dd36
|
data/README.md
CHANGED
|
@@ -303,6 +303,7 @@ Logs are written to `stderr`, while actual pull request output goes to `stdout`.
|
|
|
303
303
|
--skip-archived Ignore archived repositories
|
|
304
304
|
--skip-drafts Ignore draft pull requests
|
|
305
305
|
--[no-]progress Show or hide progress bars
|
|
306
|
+
--exclude-repos Repositories to exclude, in owner/name format
|
|
306
307
|
--log-level LEVEL Logging level
|
|
307
308
|
-w, --workers Number of repository scan workers
|
|
308
309
|
-v, --version Show NyaPr version
|
data/lib/nya_pr/cli/command.rb
CHANGED
|
@@ -44,6 +44,11 @@ module NyaPr
|
|
|
44
44
|
type: :boolean,
|
|
45
45
|
desc: 'Ignore draft pull requests'
|
|
46
46
|
|
|
47
|
+
option :exclude_repositories,
|
|
48
|
+
aliases: ['--exclude-repos'],
|
|
49
|
+
type: :array,
|
|
50
|
+
desc: 'Repositories to exclude, in owner/name format'
|
|
51
|
+
|
|
47
52
|
option :progress,
|
|
48
53
|
type: :boolean,
|
|
49
54
|
desc: 'Show progress bars'
|
data/lib/nya_pr/config/global.rb
CHANGED
|
@@ -12,6 +12,7 @@ module NyaPr
|
|
|
12
12
|
:refresh,
|
|
13
13
|
:skip_archived,
|
|
14
14
|
:skip_drafts,
|
|
15
|
+
:exclude_repositories,
|
|
15
16
|
:progress,
|
|
16
17
|
:log_level,
|
|
17
18
|
:workers
|
|
@@ -35,7 +36,8 @@ module NyaPr
|
|
|
35
36
|
skip_drafts: false,
|
|
36
37
|
progress: true,
|
|
37
38
|
log_level: 'info',
|
|
38
|
-
workers: Repository::Config::DEFAULT_WORKERS
|
|
39
|
+
workers: Repository::Config::DEFAULT_WORKERS,
|
|
40
|
+
exclude_repositories: []
|
|
39
41
|
}.freeze
|
|
40
42
|
|
|
41
43
|
BOOLEAN_KEYS = %i[
|
|
@@ -65,6 +67,9 @@ module NyaPr
|
|
|
65
67
|
limit: normalize_positive_integer(attributes[:limit], :limit),
|
|
66
68
|
workers: normalize_positive_integer(attributes[:workers], :workers),
|
|
67
69
|
log_level: normalize_log_level(attributes[:log_level]),
|
|
70
|
+
exclude_repositories: normalize_repositories(
|
|
71
|
+
attributes[:exclude_repositories]
|
|
72
|
+
),
|
|
68
73
|
**normalize_booleans(attributes)
|
|
69
74
|
)
|
|
70
75
|
|
|
@@ -79,6 +84,15 @@ module NyaPr
|
|
|
79
84
|
username
|
|
80
85
|
end
|
|
81
86
|
|
|
87
|
+
def normalize_repositories(repositories)
|
|
88
|
+
Array(repositories).
|
|
89
|
+
flat_map { |repository| repository.to_s.split(',') }.
|
|
90
|
+
map(&:strip).
|
|
91
|
+
reject(&:empty?).
|
|
92
|
+
map(&:downcase).
|
|
93
|
+
uniq
|
|
94
|
+
end
|
|
95
|
+
|
|
82
96
|
def normalize_booleans(attributes)
|
|
83
97
|
BOOLEAN_KEYS.to_h do |key|
|
|
84
98
|
[key, normalize_boolean(attributes[key], key)]
|
|
@@ -22,9 +22,13 @@ module NyaPr
|
|
|
22
22
|
def load_cached
|
|
23
23
|
NyaPr.logger.info("Loading repositories from #{store.path}")
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
repositories = store.read
|
|
26
|
+
repositories = reject_archived(repositories)
|
|
27
|
+
repositories = reject_excluded(repositories)
|
|
28
|
+
|
|
29
|
+
repositories.tap do |result|
|
|
26
30
|
NyaPr.logger.info(
|
|
27
|
-
"Loaded #{
|
|
31
|
+
"Loaded #{result.size} repositories from cache"
|
|
28
32
|
)
|
|
29
33
|
end
|
|
30
34
|
end
|
|
@@ -38,9 +42,9 @@ module NyaPr
|
|
|
38
42
|
new(client, config).
|
|
39
43
|
repositories_for
|
|
40
44
|
|
|
41
|
-
repositories =
|
|
42
|
-
|
|
43
|
-
)
|
|
45
|
+
repositories = reject_archived(repositories)
|
|
46
|
+
repositories = reject_excluded(repositories)
|
|
47
|
+
repositories = filter_contributed(repositories)
|
|
44
48
|
|
|
45
49
|
store.write(repositories)
|
|
46
50
|
|
|
@@ -73,6 +77,22 @@ module NyaPr
|
|
|
73
77
|
filtered
|
|
74
78
|
end
|
|
75
79
|
|
|
80
|
+
def reject_excluded(repositories)
|
|
81
|
+
return repositories if config.exclude_repositories.empty?
|
|
82
|
+
|
|
83
|
+
filtered = repositories.reject do |repository|
|
|
84
|
+
config.exclude_repositories.include?(
|
|
85
|
+
repository.fetch('full_name').downcase
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
NyaPr.logger.info(
|
|
90
|
+
"Skipped #{repositories.size - filtered.size} excluded repositories"
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
filtered
|
|
94
|
+
end
|
|
95
|
+
|
|
76
96
|
def repository_owner(repository)
|
|
77
97
|
repository.dig('owner', 'login').to_s
|
|
78
98
|
end
|
|
@@ -9,7 +9,8 @@ module NyaPr
|
|
|
9
9
|
:skip_archived,
|
|
10
10
|
:progress_enabled,
|
|
11
11
|
:workers,
|
|
12
|
-
:repositories_csv
|
|
12
|
+
:repositories_csv,
|
|
13
|
+
:exclude_repositories
|
|
13
14
|
)
|
|
14
15
|
DEFAULT_WORKERS = 10
|
|
15
16
|
|
|
@@ -21,7 +22,8 @@ module NyaPr
|
|
|
21
22
|
skip_archived: config.skip_archived,
|
|
22
23
|
progress_enabled: config.progress,
|
|
23
24
|
workers: config.workers,
|
|
24
|
-
repositories_csv: config.repositories_csv
|
|
25
|
+
repositories_csv: config.repositories_csv,
|
|
26
|
+
exclude_repositories: config.exclude_repositories
|
|
25
27
|
)
|
|
26
28
|
end
|
|
27
29
|
end
|
data/lib/nya_pr/version.rb
CHANGED