multi_repo 0.1.1 → 0.2.0
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/git_mirror.rb +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: b2f8e962cb396736c017c1dd641f20503dde65b5dadaf20d38bb98a1811d3f4c
|
4
|
+
data.tar.gz: da90a0d13d0e8c999e80a40979627470f64551d55b89f2a08b629040e07130ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa32e47da1036891d73af604b0ddc1bd9f02d1ab053c1b84c6ba4604ca52ef6c842cb214636020ed1f79e2d6a4d50bc47ffdbd40e22e787a9e2eddce659284f
|
7
|
+
data.tar.gz: '055905a0eb895e8cfd4377d5f73018465911d3a3a72e88e052acae945619f000b05cfb8264a105b1fada75087c96343ea0aafe860221b37eaee995007418b77a'
|
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
|
|
@@ -164,7 +164,7 @@ module MultiRepo::Helpers
|
|
164
164
|
|
165
165
|
success =
|
166
166
|
system("git checkout -B #{dest_name} #{start_point}") &&
|
167
|
-
system("git pull --rebase
|
167
|
+
system("git pull --no-rebase #{source_remote} #{source_name}") &&
|
168
168
|
system("git push -f #{dest_remote} #{dest_name}")
|
169
169
|
|
170
170
|
if backup_remote_defined?
|
@@ -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.
|
4
|
+
version: 0.2.0
|
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-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|