multi_repo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/multi_repo/helpers/update_milestone.rb +7 -5
- data/lib/multi_repo/service/docker.rb +5 -2
- data/lib/multi_repo/service/github.rb +3 -3
- data/lib/multi_repo/version.rb +1 -1
- data/scripts/make_alumni +15 -4
- data/scripts/reenable_repo_workflows +3 -3
- data/scripts/update_milestone +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 569dd39745ef1ab573d95ef3c1724aed8c96afb4fddc72d09c7f24774acce7f8
|
4
|
+
data.tar.gz: 9272ee6b4996a0f28a5d5af60c9ed201845306cde7f4ceafb67aec473417733d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56011154b9371332679c7d46a78c0bf7c125acce711dcd5e36ecb0c2960c96b2136b103b51fc675a7b5bc6dec4d352794c7f4b77cf4816ea032e26e38d1cd988
|
7
|
+
data.tar.gz: d18605c473b2bc80bf3805bfa53048eae473f99488843b863fe697443df30a2239436021cd2901f038982c01dadc71170b361f99ee034890bdd6bc0d22ca0af1
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ MultiRepo is a tool for managing multiple git repositories.
|
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/multi_repo.svg)](http://badge.fury.io/rb/multi_repo)
|
6
6
|
[![CI](https://github.com/ManageIQ/multi_repo/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/multi_repo/actions/workflows/ci.yaml)
|
7
|
-
[![Code Climate](
|
7
|
+
[![Code Climate](https://codeclimate.com/github/ManageIQ/multi_repo.svg)](https://codeclimate.com/github/ManageIQ/multi_repo)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -15,18 +15,20 @@ module MultiRepo::Helpers
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
+
due_on_str = due_on.strftime("%Y-%m-%d").inspect
|
19
|
+
|
18
20
|
existing = github.find_milestone_by_title(repo_name, title)
|
19
21
|
if close
|
20
22
|
if existing
|
21
23
|
puts "Closing milestone #{title.inspect} (#{existing.number})"
|
22
|
-
github.close_milestone(
|
24
|
+
github.close_milestone(repo_name, title, existing.number)
|
23
25
|
end
|
24
26
|
elsif existing
|
25
|
-
puts "Updating milestone #{title.inspect} (#{existing.number}) with due date #{due_on_str
|
26
|
-
github.update_milestone(
|
27
|
+
puts "Updating milestone #{title.inspect} (#{existing.number}) with due date #{due_on_str}"
|
28
|
+
github.update_milestone(repo_name, existing.number, due_on)
|
27
29
|
else
|
28
|
-
puts "Creating milestone #{title.inspect} with due date #{due_on_str
|
29
|
-
github.create_milestone(
|
30
|
+
puts "Creating milestone #{title.inspect} with due date #{due_on_str}"
|
31
|
+
github.create_milestone(repo_name, title, due_on)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -44,14 +44,15 @@ module MultiRepo::Service
|
|
44
44
|
exit($?.exitstatus) unless system?(command, **kwargs)
|
45
45
|
end
|
46
46
|
|
47
|
-
attr_accessor :registry, :cache, :dry_run
|
47
|
+
attr_accessor :registry, :default_headers, :cache, :dry_run
|
48
48
|
|
49
|
-
def initialize(registry: self.class.registry, cache: true, dry_run: false)
|
49
|
+
def initialize(registry: self.class.registry, default_headers: nil, cache: true, dry_run: false)
|
50
50
|
require "rest-client"
|
51
51
|
require "fileutils"
|
52
52
|
require "json"
|
53
53
|
|
54
54
|
@registry = registry
|
55
|
+
@default_headers = default_headers
|
55
56
|
|
56
57
|
@cache = cache
|
57
58
|
@dry_run = dry_run
|
@@ -135,6 +136,8 @@ module MultiRepo::Service
|
|
135
136
|
def request(verb, path, body: nil, headers: {}, verbose: true)
|
136
137
|
path = File.join(registry, path)
|
137
138
|
|
139
|
+
headers = default_headers.merge(headers) if default_headers
|
140
|
+
|
138
141
|
if dry_run && %i[delete put post patch].include?(verb)
|
139
142
|
puts "+ dry_run: #{verb.to_s.upcase} #{path}".light_black if verbose
|
140
143
|
{}
|
@@ -71,12 +71,12 @@ module MultiRepo::Service
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def self.team_ids_by_name(org)
|
74
|
-
@
|
75
|
-
@
|
74
|
+
@team_ids_by_name ||= {}
|
75
|
+
@team_ids_by_name[org] ||= client.org_teams(org).map { |t| [t.slug, t.id] }.sort.to_h
|
76
76
|
end
|
77
77
|
|
78
78
|
def self.team_names(org)
|
79
|
-
|
79
|
+
team_ids_by_name(org).keys
|
80
80
|
end
|
81
81
|
|
82
82
|
def self.disabled_workflows(repo_name)
|
data/lib/multi_repo/version.rb
CHANGED
data/scripts/make_alumni
CHANGED
@@ -14,7 +14,7 @@ opts = Optimist.options do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class MultiRepo::MakeAlumni
|
17
|
-
attr_reader :org, :dry_run
|
17
|
+
attr_reader :org, :dry_run, :github
|
18
18
|
|
19
19
|
def initialize(org:, dry_run:, **_)
|
20
20
|
@org = org
|
@@ -23,13 +23,14 @@ class MultiRepo::MakeAlumni
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run(user)
|
26
|
-
progress = MultiRepo.progress_bar(teams.size + repos.size)
|
26
|
+
progress = MultiRepo::CLI.progress_bar(teams.size + repos.size)
|
27
27
|
|
28
28
|
github.add_team_membership(org, "alumni", user)
|
29
29
|
progress.increment
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
teams.each do |team|
|
32
|
+
next if team == "alumni"
|
33
|
+
|
33
34
|
github.remove_team_membership(org, team, user)
|
34
35
|
progress.increment
|
35
36
|
end
|
@@ -41,6 +42,16 @@ class MultiRepo::MakeAlumni
|
|
41
42
|
|
42
43
|
progress.finish
|
43
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def teams
|
49
|
+
@teams ||= github.team_names(org)
|
50
|
+
end
|
51
|
+
|
52
|
+
def repos
|
53
|
+
@repos ||= github.client.org_repos(org).reject(&:archived?).map(&:full_name).sort
|
54
|
+
end
|
44
55
|
end
|
45
56
|
|
46
57
|
make_alumni = MultiRepo::MakeAlumni.new(**opts)
|
@@ -11,7 +11,7 @@ opts = Optimist.options do
|
|
11
11
|
opt :extra_repos, "Extra repos to reenable workflows in", :type => :strings, :default => []
|
12
12
|
|
13
13
|
MultiRepo::CLI.common_options(self, :only => :dry_run)
|
14
|
-
|
14
|
+
end
|
15
15
|
|
16
16
|
github = MultiRepo::Service::Github.new(**opts.slice(:dry_run))
|
17
17
|
|
@@ -19,11 +19,11 @@ repos = (github.org_repo_names(opts[:org]) + opts[:extra_repos]).sort
|
|
19
19
|
repos.each do |repo_name|
|
20
20
|
puts MultiRepo::CLI.header(repo_name)
|
21
21
|
|
22
|
-
disabled_workflows = github.disabled_workflows
|
22
|
+
disabled_workflows = github.disabled_workflows(repo_name)
|
23
23
|
if disabled_workflows.any?
|
24
24
|
disabled_workflows.each do |w|
|
25
25
|
puts "** Enabling #{w.html_url} (#{w.id})"
|
26
|
-
github.enable_workflow(
|
26
|
+
github.enable_workflow(repo_name, w.id)
|
27
27
|
end
|
28
28
|
else
|
29
29
|
puts "** No disabled workflows found"
|
data/scripts/update_milestone
CHANGED
@@ -14,7 +14,7 @@ opts = Optimist.options do
|
|
14
14
|
MultiRepo::CLI.common_options(self)
|
15
15
|
end
|
16
16
|
Optimist.die(:due_on, "is required") if !opts[:close] && !opts[:due_on]
|
17
|
-
Optimist.die(:due_on, "must be a date format") if opts[:due_on] && !MultiRepo::Service::
|
17
|
+
Optimist.die(:due_on, "must be a date format") if opts[:due_on] && !MultiRepo::Service::Github.valid_milestone_date?(opts[:due_on])
|
18
18
|
|
19
19
|
MultiRepo::CLI.each_repo(**opts) do |repo|
|
20
20
|
MultiRepo::Helpers::UpdateMilestone.new(repo.name, **opts).run
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|