squared 0.5.4 → 0.5.6
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 +149 -63
- data/README.md +662 -1273
- data/lib/squared/common/base.rb +1 -1
- data/lib/squared/common/format.rb +7 -4
- data/lib/squared/common/prompt.rb +1 -1
- data/lib/squared/common/shell.rb +7 -2
- data/lib/squared/common/system.rb +1 -1
- data/lib/squared/config.rb +8 -8
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +29 -9
- data/lib/squared/workspace/project/base.rb +104 -27
- data/lib/squared/workspace/project/docker.rb +109 -68
- data/lib/squared/workspace/project/git.rb +156 -127
- data/lib/squared/workspace/project/node.rb +18 -19
- data/lib/squared/workspace/project/python.rb +36 -19
- data/lib/squared/workspace/project/ruby.rb +100 -55
- data/lib/squared/workspace/project/support/class.rb +81 -4
- data/lib/squared/workspace/repo.rb +72 -36
- data/squared.gemspec +2 -2
- metadata +5 -6
- data/README.ruby.md +0 -728
@@ -113,16 +113,16 @@ 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
117
|
path = ns.scope.path
|
118
118
|
branch = env('REPO_MANIFEST') || Repo.read_manifest(root)
|
119
119
|
target = branch || manifest
|
120
|
-
cmd = nil
|
121
120
|
stage = nil
|
121
|
+
opts = %w[force rebase detach submodules fail no-update gc]
|
122
122
|
newline = ARGV.any?(/^repo:/)
|
123
123
|
desc = lambda do |val, alt = nil|
|
124
124
|
if (ver = branch || alt)
|
125
|
-
val = val.sub('{0}', '
|
125
|
+
val = val.sub('{0}', "opts*=#{opts.join(',')}")
|
126
126
|
task_desc(path, val, ver)
|
127
127
|
else
|
128
128
|
task_desc 'inactive'
|
@@ -130,10 +130,9 @@ module Squared
|
|
130
130
|
end
|
131
131
|
|
132
132
|
desc.call('all[{0}]')
|
133
|
-
task 'all'
|
134
|
-
cmd ||= repo_opts args
|
133
|
+
task 'all' do |_, args|
|
135
134
|
stage ||= 'all'
|
136
|
-
ns['sync'].invoke
|
135
|
+
ns['sync'].invoke(*args.to_a)
|
137
136
|
next if env('REPO_STAGE', equals: '1')
|
138
137
|
|
139
138
|
@project.select do |_, proj|
|
@@ -156,26 +155,60 @@ module Squared
|
|
156
155
|
end
|
157
156
|
end
|
158
157
|
|
159
|
-
desc.call("init[manifest?=#{target},{0}]", target)
|
160
|
-
task 'init'
|
161
|
-
|
158
|
+
desc.call("init[manifest?=#{target},groups?,{0}]", target)
|
159
|
+
task 'init' do |_, args|
|
160
|
+
args = args.to_a
|
161
|
+
u = env('REPO_URL') || manifest_url
|
162
|
+
m = args.first && !opts.include?(args.first) ? args.shift : target
|
163
|
+
g = args.first && !opts.include?(args.first) ? args.shift : nil
|
164
|
+
g = case (val = env('REPO_GROUPS'))
|
165
|
+
when '', NilClass
|
166
|
+
g
|
167
|
+
when '0', 'false'
|
168
|
+
nil
|
169
|
+
else
|
170
|
+
val
|
171
|
+
end
|
162
172
|
stage = 'init'
|
163
173
|
puts if newline
|
164
|
-
|
165
|
-
|
174
|
+
opts = repo_opts "-u #{u}", "-m #{m}.xml"
|
175
|
+
opts << "-g #{g}" if g
|
176
|
+
opts << '--submodules' if repo_submodules?(args.include?('submodules'))
|
177
|
+
repo_run "#{repo_bin} init #{opts.uniq.join(' ')}"
|
166
178
|
next if env('REPO_STAGE', equals: '0')
|
167
179
|
|
168
|
-
ns['all'].invoke
|
180
|
+
ns['all'].invoke(*args)
|
169
181
|
end
|
170
182
|
|
171
183
|
desc.call('sync[{0}]')
|
172
|
-
task 'sync'
|
173
|
-
|
174
|
-
|
175
|
-
|
184
|
+
task 'sync' do |t, args|
|
185
|
+
opts = if stage == 'init'
|
186
|
+
[]
|
187
|
+
else
|
188
|
+
raise_error 'repo not initialized' unless branch
|
189
|
+
repo_opts
|
190
|
+
end
|
191
|
+
args.to_a.each do |val|
|
192
|
+
case val
|
193
|
+
when 'force'
|
194
|
+
opts << '--force-checkout'
|
195
|
+
when 'rebase', 'detach'
|
196
|
+
opts << "--#{val}"
|
197
|
+
when 'submodules'
|
198
|
+
opts << '--fetch-submodules' if repo_submodules?(true)
|
199
|
+
when 'fail'
|
200
|
+
opts << '--fail-fast'
|
201
|
+
when 'no-update'
|
202
|
+
opts << '--no-manifest-update'
|
203
|
+
when 'gc'
|
204
|
+
opts << '--auto-gc'
|
205
|
+
end
|
206
|
+
end
|
207
|
+
opts << "-j#{ENV.fetch('REPO_JOBS', Rake::CpuCounter.count)}" unless opts.any?(/^--?j(?:obs)?/)
|
208
|
+
opts << '--fetch-submodules' if repo_submodules?
|
176
209
|
puts unless !newline || stage == 'init'
|
177
210
|
begin
|
178
|
-
|
211
|
+
repo_run("#{repo_bin} sync #{opts.uniq.join(' ')}", exception: opts.include?('--fail-fast'))
|
179
212
|
rescue Errno::ENOENT => e
|
180
213
|
emphasize(e, title: root)
|
181
214
|
raise
|
@@ -204,31 +237,34 @@ module Squared
|
|
204
237
|
)
|
205
238
|
end
|
206
239
|
|
207
|
-
def
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
ret << '--no-manifest-update'
|
221
|
-
when 'gc'
|
222
|
-
ret << '--auto-gc'
|
223
|
-
end
|
224
|
-
end
|
225
|
-
ret
|
240
|
+
def repo_run(cmd, exception: false)
|
241
|
+
puts log_message(Logger::INFO, cmd, subject: main, hint: root) if verbose
|
242
|
+
Common::System.shell(cmd, chdir: root, exception: exception)
|
243
|
+
end
|
244
|
+
|
245
|
+
def repo_bin
|
246
|
+
Common::Shell.shell_bin('repo')
|
247
|
+
end
|
248
|
+
|
249
|
+
def repo_opts(*args)
|
250
|
+
return args unless (n = ARGV.index('--'))
|
251
|
+
|
252
|
+
ARGV[(n + 1)..-1].concat(args)
|
226
253
|
end
|
227
254
|
|
228
255
|
def repo?
|
229
256
|
!manifest_url.nil? && (repo_install? || @repo_override == true)
|
230
257
|
end
|
231
258
|
|
259
|
+
def repo_submodules?(val = false)
|
260
|
+
case (s = env('REPO_SUBMODULES'))
|
261
|
+
when '0', 'false'
|
262
|
+
false
|
263
|
+
else
|
264
|
+
s ? true : val
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
232
268
|
def repo_install?(dir = root, parent: false)
|
233
269
|
return true if root?(dir, pass: ['.repo']) || dir.join('.repo').directory?
|
234
270
|
|
data/squared.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = %q{Rake task generator for managing multi-language workspaces.}
|
12
12
|
spec.description = %q{Rake task generator for managing multi-language workspaces.}
|
13
|
-
spec.homepage = "https://github.com/anpham6/squared"
|
13
|
+
spec.homepage = "https://github.com/anpham6/squared-ruby"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
15
15
|
spec.licenses = ["BSD-3-Clause"]
|
16
16
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata["documentation_uri"] = "https://squared.readthedocs.io"
|
20
20
|
|
21
21
|
spec.files = Dir["lib/**/*"] +
|
22
|
-
%w[CHANGELOG.md LICENSE README.md
|
22
|
+
%w[CHANGELOG.md LICENSE README.md squared.gemspec]
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = []
|
25
25
|
spec.require_paths = ["lib"]
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
@@ -75,7 +75,6 @@ files:
|
|
75
75
|
- CHANGELOG.md
|
76
76
|
- LICENSE
|
77
77
|
- README.md
|
78
|
-
- README.ruby.md
|
79
78
|
- lib/squared.rb
|
80
79
|
- lib/squared/app.rb
|
81
80
|
- lib/squared/common.rb
|
@@ -104,12 +103,12 @@ files:
|
|
104
103
|
- lib/squared/workspace/support/base.rb
|
105
104
|
- lib/squared/workspace/support/data.rb
|
106
105
|
- squared.gemspec
|
107
|
-
homepage: https://github.com/anpham6/squared
|
106
|
+
homepage: https://github.com/anpham6/squared-ruby
|
108
107
|
licenses:
|
109
108
|
- BSD-3-Clause
|
110
109
|
metadata:
|
111
|
-
homepage_uri: https://github.com/anpham6/squared
|
112
|
-
source_code_uri: https://github.com/anpham6/squared
|
110
|
+
homepage_uri: https://github.com/anpham6/squared-ruby
|
111
|
+
source_code_uri: https://github.com/anpham6/squared-ruby
|
113
112
|
documentation_uri: https://squared.readthedocs.io
|
114
113
|
rdoc_options: []
|
115
114
|
require_paths:
|
@@ -125,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
124
|
- !ruby/object:Gem::Version
|
126
125
|
version: '0'
|
127
126
|
requirements: []
|
128
|
-
rubygems_version: 3.6.
|
127
|
+
rubygems_version: 3.6.9
|
129
128
|
specification_version: 4
|
130
129
|
summary: Rake task generator for managing multi-language workspaces.
|
131
130
|
test_files: []
|