squared 0.5.3 → 0.5.4
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/CHANGELOG.md +38 -0
- data/README.ruby.md +17 -13
- data/lib/squared/common/shell.rb +8 -3
- data/lib/squared/common/system.rb +3 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +11 -6
- data/lib/squared/workspace/project/base.rb +52 -35
- data/lib/squared/workspace/project/docker.rb +68 -52
- data/lib/squared/workspace/project/git.rb +213 -129
- data/lib/squared/workspace/project/node.rb +25 -14
- data/lib/squared/workspace/project/python.rb +40 -11
- data/lib/squared/workspace/project/ruby.rb +27 -19
- data/lib/squared/workspace/project/support/class.rb +64 -13
- data/lib/squared/workspace/repo.rb +47 -43
- metadata +2 -2
@@ -113,35 +113,17 @@ module Squared
|
|
113
113
|
def __repo__(**kwargs)
|
114
114
|
kwargs.delete(:parallel) if env('REPO_SYNC', ignore: '0')
|
115
115
|
|
116
|
-
namespace(
|
116
|
+
namespace(task_name('repo')) do |ns|
|
117
|
+
path = ns.scope.path
|
117
118
|
branch = env('REPO_MANIFEST') || Repo.read_manifest(root)
|
118
119
|
target = branch || manifest
|
120
|
+
cmd = nil
|
119
121
|
stage = nil
|
120
|
-
|
121
|
-
cmd = []
|
122
|
-
newline = ARGV.index { |val| val.start_with?('repo:') }.to_i > 0
|
123
|
-
parse_opts = lambda do |args|
|
124
|
-
args.to_a.each do |val|
|
125
|
-
case val
|
126
|
-
when 'no-fail'
|
127
|
-
failfast = false
|
128
|
-
when 'force'
|
129
|
-
cmd << '--force-checkout'
|
130
|
-
when 'rebase'
|
131
|
-
cmd << '--rebase'
|
132
|
-
when 'detach'
|
133
|
-
cmd << '--detach'
|
134
|
-
when 'gc'
|
135
|
-
cmd << '--auto-gc'
|
136
|
-
when 'no-update'
|
137
|
-
cmd << '--no-manifest-update'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
122
|
+
newline = ARGV.any?(/^repo:/)
|
141
123
|
desc = lambda do |val, alt = nil|
|
142
124
|
if (ver = branch || alt)
|
143
|
-
val = val.sub('{0}', 'opts*=force,rebase,detach,
|
144
|
-
task_desc(
|
125
|
+
val = val.sub('{0}', 'opts*=force,rebase,detach,fail,no-update,gc')
|
126
|
+
task_desc(path, val, ver)
|
145
127
|
else
|
146
128
|
task_desc 'inactive'
|
147
129
|
end
|
@@ -149,20 +131,22 @@ module Squared
|
|
149
131
|
|
150
132
|
desc.call('all[{0}]')
|
151
133
|
task 'all', [:opts] do |_, args|
|
152
|
-
|
134
|
+
cmd ||= repo_opts args
|
153
135
|
stage ||= 'all'
|
154
|
-
|
155
|
-
next if env('
|
136
|
+
ns['sync'].invoke
|
137
|
+
next if env('REPO_STAGE', equals: '1')
|
156
138
|
|
157
139
|
@project.select do |_, proj|
|
158
140
|
next unless proj.enabled?(proj.workspace.baseref)
|
159
141
|
|
160
142
|
proj.depend(sync: true) if proj.depend?
|
161
|
-
|
143
|
+
next if env('REPO_STAGE', equals: '2')
|
144
|
+
|
145
|
+
proj.build?
|
162
146
|
end
|
163
147
|
.each_value do |proj|
|
164
148
|
proj.build(sync: true)
|
165
|
-
next unless proj.dev? && proj.copy?
|
149
|
+
next unless proj.dev? && proj.copy? && !env('REPO_STAGE', equals: '3')
|
166
150
|
|
167
151
|
if (ws = proj.workspace).task_defined?(target = task_join(proj.name, 'copy'))
|
168
152
|
task_invoke(target, **ws.invokeargs)
|
@@ -174,38 +158,37 @@ module Squared
|
|
174
158
|
|
175
159
|
desc.call("init[manifest?=#{target},{0}]", target)
|
176
160
|
task 'init', [:manifest, :opts] do |_, args|
|
177
|
-
|
161
|
+
cmd = repo_opts args
|
178
162
|
stage = 'init'
|
179
163
|
puts if newline
|
180
164
|
Common::System.shell("repo init -u #{env('REPO_URL') || manifest_url} -m #{args.manifest || target}.xml",
|
181
165
|
chdir: root)
|
182
|
-
|
166
|
+
next if env('REPO_STAGE', equals: '0')
|
167
|
+
|
168
|
+
ns['all'].invoke
|
183
169
|
end
|
184
170
|
|
185
171
|
desc.call('sync[{0}]')
|
186
|
-
task 'sync', [:opts] do |
|
187
|
-
unless branch || stage == 'init'
|
188
|
-
|
189
|
-
end
|
190
|
-
parse_opts.call(args)
|
172
|
+
task 'sync', [:opts] do |t, args|
|
173
|
+
raise_error 'repo not initialized' unless branch || stage == 'init'
|
174
|
+
cmd ||= repo_opts args
|
191
175
|
cmd << "-j#{ENV.fetch('REPO_JOBS', Rake::CpuCounter.count)}"
|
192
|
-
|
193
|
-
puts if newline && stage != 'init'
|
176
|
+
puts unless !newline || stage == 'init'
|
194
177
|
begin
|
195
|
-
Common::System.shell("repo sync #{cmd.join(' ')}", chdir: root, exception:
|
178
|
+
Common::System.shell("repo sync #{cmd.join(' ')}", chdir: root, exception: cmd.include?('--fail-fast'))
|
196
179
|
rescue Errno::ENOENT => e
|
197
180
|
emphasize(e, title: root)
|
198
181
|
raise
|
199
182
|
rescue StandardError => e
|
200
|
-
emphasize(e, title: "rake stash #{
|
183
|
+
emphasize(e, title: "rake stash #{t.name}")
|
201
184
|
raise
|
202
185
|
end
|
203
186
|
end
|
204
187
|
|
205
188
|
series.sync.append(
|
206
|
-
task_join(
|
207
|
-
task_join(
|
208
|
-
task_join(
|
189
|
+
task_join(path, 'all'),
|
190
|
+
task_join(path, 'init'),
|
191
|
+
task_join(path, 'sync')
|
209
192
|
)
|
210
193
|
end
|
211
194
|
end
|
@@ -221,6 +204,27 @@ module Squared
|
|
221
204
|
)
|
222
205
|
end
|
223
206
|
|
207
|
+
def repo_opts(args)
|
208
|
+
ret = []
|
209
|
+
args.to_a.each do |val|
|
210
|
+
case val
|
211
|
+
when 'force'
|
212
|
+
ret << '--force-checkout'
|
213
|
+
when 'rebase'
|
214
|
+
ret << '--rebase'
|
215
|
+
when 'detach'
|
216
|
+
ret << '--detach'
|
217
|
+
when 'fail'
|
218
|
+
ret << '--fail-fast'
|
219
|
+
when 'no-update'
|
220
|
+
ret << '--no-manifest-update'
|
221
|
+
when 'gc'
|
222
|
+
ret << '--auto-gc'
|
223
|
+
end
|
224
|
+
end
|
225
|
+
ret
|
226
|
+
end
|
227
|
+
|
224
228
|
def repo?
|
225
229
|
!manifest_url.nil? && (repo_install? || @repo_override == true)
|
226
230
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.6.
|
128
|
+
rubygems_version: 3.6.7
|
129
129
|
specification_version: 4
|
130
130
|
summary: Rake task generator for managing multi-language workspaces.
|
131
131
|
test_files: []
|