cimas 0.1.3 → 0.3.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/.github/workflows/rake.yml +18 -0
- data/.github/workflows/release.yml +31 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +29 -0
- data/CLAUDE.md +56 -0
- data/README.adoc +467 -14
- data/bin/console +1 -1
- data/bin/rspec +29 -0
- data/cimas.gemspec +4 -5
- data/exe/cimas +9 -201
- data/lib/cimas/cli/command.rb +837 -245
- data/lib/cimas/cli/error.rb +8 -0
- data/lib/cimas/cli/runner.rb +239 -0
- data/lib/cimas/cli.rb +7 -0
- data/lib/cimas/github.rb +47 -0
- data/lib/cimas/orphan_files.rb +37 -0
- data/lib/cimas/patch.rb +25 -0
- data/lib/cimas/release_preflight.rb +140 -0
- data/lib/cimas/repository.rb +33 -0
- data/lib/cimas/version.rb +1 -1
- data/lib/cimas/working_copy.rb +136 -0
- data/lib/cimas.rb +29 -2
- data/plans/cimas-revival-and-release-workflow-realignment.md +2158 -0
- metadata +40 -12
- data/Gemfile.lock +0 -86
data/exe/cimas
CHANGED
|
@@ -1,208 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require 'optparse'
|
|
5
|
-
|
|
6
|
-
require_relative '../lib/cimas/cli/command'
|
|
7
|
-
|
|
8
|
-
options = {
|
|
9
|
-
'repos_path' => Pathname.getwd + 'repos',
|
|
10
|
-
'config_file_path' => Pathname.getwd + 'ci.yml',
|
|
11
|
-
'config_master_path' => Pathname.getwd + 'config'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
top_help = <<HELP
|
|
15
|
-
Commonly used command are:
|
|
16
|
-
sync : do update ci configurations for all repos described in config
|
|
17
|
-
#lint : do lint for ci configurations
|
|
18
|
-
pull : do pull for repos
|
|
19
|
-
push : do push changes to repote server
|
|
20
|
-
open-prs : do PR for Github with hub utility
|
|
21
|
-
See 'cimas COMMAND --help' for more information on a specific command.
|
|
22
|
-
HELP
|
|
23
|
-
|
|
24
|
-
def validate_config_path(config_path)
|
|
25
|
-
if config_path.nil? || !config_path.exist?
|
|
26
|
-
raise OptionParser::MissingArgument, "-c/--config-path path is not set or does not exist"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
config_path
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
global = OptionParser.new do |opts|
|
|
33
|
-
opts.banner = "Usage: cimas [options] [subcommand [options]]"
|
|
34
|
-
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
|
35
|
-
options['verbose'] = v
|
|
36
|
-
end
|
|
37
|
-
opts.on("-d", "--dry-run", "Run verbosely") do |v|
|
|
38
|
-
options['dry_run'] = v
|
|
39
|
-
end
|
|
40
|
-
opts.separator ""
|
|
41
|
-
opts.separator top_help
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
subcommands = {
|
|
45
|
-
'setup' => OptionParser.new do |opts|
|
|
46
|
-
opts.banner = "Usage: cimas setup [options]"
|
|
47
|
-
|
|
48
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
49
|
-
options['repos_path'] = Pathname.getwd + path
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
53
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
54
|
-
end
|
|
55
|
-
end,
|
|
56
|
-
'sync' => OptionParser.new do |opts|
|
|
57
|
-
opts.banner = "Usage: cimas sync [options]"
|
|
58
|
-
|
|
59
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
60
|
-
options['repos_path'] = Pathname.getwd + path
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
64
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
opts.on("-d CONFIG_MASTER_DIR_PATH", "--master-path=CONFIG_MASTER_DIR_PATH", "Config master path") do |path|
|
|
68
|
-
options['config_master_path'] = validate_config_path(Pathname.getwd + path)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
72
|
-
options['groups'] = groups
|
|
73
|
-
end
|
|
74
|
-
end,
|
|
75
|
-
'diff' => OptionParser.new do |opts|
|
|
76
|
-
opts.banner = "Usage: cimas diff [options]"
|
|
77
|
-
|
|
78
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
79
|
-
options['repos_path'] = Pathname.getwd + path
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
83
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
opts.on("-d CONFIG_MASTER_DIR_PATH", "--master-path=CONFIG_MASTER_DIR_PATH", "Config master path") do |path|
|
|
87
|
-
options['config_master_path'] = validate_config_path(Pathname.getwd + path)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
91
|
-
options['groups'] = groups
|
|
92
|
-
end
|
|
93
|
-
end,
|
|
94
|
-
'lint' => OptionParser.new do |opts|
|
|
95
|
-
opts.banner = "Usage: cimas lint [options]"
|
|
96
|
-
|
|
97
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
98
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
opts.on("-d CONFIG_MASTER_DIR_PATH", "--master-path=CONFIG_MASTER_DIR_PATH", "Config master path") do |path|
|
|
102
|
-
options['config_master_path'] = validate_config_path(Pathname.getwd + path)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
opts.on("-a", "--appveyor-bearer=APPVEYOR_BEARER", "Appveyor API Bearer token") do |token|
|
|
106
|
-
options['appveyor_token'] = token
|
|
107
|
-
end
|
|
108
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
109
|
-
options['groups'] = groups
|
|
110
|
-
end
|
|
111
|
-
end,
|
|
112
|
-
'pull' => OptionParser.new do |opts|
|
|
113
|
-
opts.banner = "Usage: cimas pull [options]"
|
|
114
|
-
|
|
115
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
116
|
-
options['repos_path'] = Pathname.getwd + path
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
120
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
opts.on("-b BRANCH", "--pull-branch=BRANCH", "Branch to pull in all repos") do |branch|
|
|
124
|
-
options['pull_branch'] = branch
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
128
|
-
options['groups'] = groups
|
|
129
|
-
end
|
|
130
|
-
end,
|
|
131
|
-
'push' => OptionParser.new do |opts|
|
|
132
|
-
opts.banner = "Usage: cimas push [options]"
|
|
133
|
-
|
|
134
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
135
|
-
options['repos_path'] = Pathname.getwd + path
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
139
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
opts.on("-b BRANCH", "--push-branch=BRANCH", "Branch to push in all repos") do |branch|
|
|
143
|
-
options['push_to_branch'] = branch
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
opts.on("-m MESSAGE", "--message=MESSAGE", "Commit message") do |message|
|
|
147
|
-
options['commit_message'] = message
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
151
|
-
options['groups'] = groups
|
|
152
|
-
end
|
|
153
|
-
# TODO: implement
|
|
154
|
-
# opts.on("--force", "Force push (with commit amend)") do |force|
|
|
155
|
-
# options['force_push'] = force
|
|
156
|
-
# end
|
|
157
|
-
end,
|
|
158
|
-
'open-prs' => OptionParser.new do |opts|
|
|
159
|
-
opts.banner = "Usage: cimas open-pr [options]"
|
|
160
|
-
|
|
161
|
-
opts.on("-r REPOS_PATH", "--repo-path=REPOS_PATH", "Repo root dir path") do |path|
|
|
162
|
-
options['repos_path'] = Pathname.getwd + path
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
opts.on("-f CONFIG_FILE_PATH", "--config-path=CONFIG_FILE_PATH", "Config file path") do |path|
|
|
166
|
-
options['config_file_path'] = validate_config_path(Pathname.getwd + path)
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
opts.on("-w REVIEWERS", "--reviewers=REVIEWERS", "A comma-separated list (no spaces around the comma) of GitHub handles to request a review from") do |reviewers|
|
|
170
|
-
options['reviewers'] = reviewers
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
opts.on("-b BRANCH", "--merge-branch=BRANCH", "PR branch to merge into target") do |branch|
|
|
174
|
-
options['merge_branch'] = branch
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
opts.on("-m MESSAGE", "--message=MESSAGE", "Commit message") do |message|
|
|
178
|
-
options['pr_message'] = message
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
opts.on("-a ASSIGNMENTS", "--assign=ASSIGNMENTS", "A comma-separated list (no spaces around the comma) of GitHub handles to assign to this pull request.") do |assignees|
|
|
182
|
-
options['assignees'] = assignees
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
opts.on("-g GROUP1,GROUP2,GROUPX", Array, "Groups to update") do |groups|
|
|
186
|
-
options['groups'] = groups
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
global.order!
|
|
192
|
-
command = ARGV.shift
|
|
193
|
-
|
|
194
|
-
if command.nil?
|
|
195
|
-
command = 'sync'
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
subcommands[command].order!
|
|
3
|
+
require_relative '../lib/cimas'
|
|
199
4
|
|
|
200
5
|
begin
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
6
|
+
Cimas::Cli::Runner.start(ARGV)
|
|
7
|
+
rescue Cimas::Cli::Error, Thor::Error => e
|
|
8
|
+
# Expected user errors (bad options, refused scope): a clean message,
|
|
9
|
+
# no backtrace.
|
|
10
|
+
warn "Error: #{e.message}"
|
|
11
|
+
exit 1
|
|
204
12
|
rescue => e
|
|
205
|
-
|
|
206
|
-
|
|
13
|
+
warn "Error: #{e.message}"
|
|
14
|
+
warn e.backtrace
|
|
207
15
|
exit 1
|
|
208
16
|
end
|