squared 0.4.1 → 0.4.2
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 +11 -0
- data/lib/squared/common/format.rb +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/project/base.rb +1 -1
- data/lib/squared/workspace/project/docker.rb +11 -10
- data/lib/squared/workspace/project/git.rb +3 -3
- data/lib/squared/workspace/project/python.rb +62 -24
- 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: 41bec81d0daef581416b2c3c7a6cefc66da439794df530c5b2e9c65f7feba6ae
|
4
|
+
data.tar.gz: 8b74836f62055cc6d173148753420ac2bb621e951f1d339cae60ed35357c6f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f042541b80121e9ef547066105a6148a21c790cf50ef0931097ee1506f75fd0a154323671585ec4c86fce33ac2c4c3d8d52d380550091d88932992fc79491466
|
7
|
+
data.tar.gz: 3fc67865ab3499416cac65f06652206af9dd762f898c561924b19f7c50c5430f640da0e03249ac1cdc39c0a2de1b0ba4125b8e2813805fa65259e5d285d44f79
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.2] - 2025-03-28
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Python command build and publish with Poetry was implemented.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Docker image command list did not display ID when empty.
|
12
|
+
|
3
13
|
## [0.4.1] - 2025-03-20
|
4
14
|
|
5
15
|
### Added
|
@@ -380,6 +390,7 @@
|
|
380
390
|
|
381
391
|
- Changelog was created.
|
382
392
|
|
393
|
+
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
383
394
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
384
395
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
385
396
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
@@ -231,7 +231,7 @@ module Squared
|
|
231
231
|
if val.is_a?(::Array)
|
232
232
|
lines = val.map(&:to_s)
|
233
233
|
else
|
234
|
-
lines = val.to_s.lines
|
234
|
+
lines = val.to_s.lines(chomp: true)
|
235
235
|
lines[0] = "#{val.class}: #{lines.first}" if (err = val.is_a?(StandardError))
|
236
236
|
end
|
237
237
|
n = cols || max.(lines)
|
data/lib/squared/version.rb
CHANGED
@@ -639,7 +639,7 @@ module Squared
|
|
639
639
|
|
640
640
|
dest = target.join(File.basename(file.path))
|
641
641
|
FileUtils.mv(entry, dest)
|
642
|
-
dest.children.each { |
|
642
|
+
dest.children.each { |child| FileUtils.mv(child, target) }
|
643
643
|
dest.rmdir
|
644
644
|
target = entry
|
645
645
|
depth -= 1
|
@@ -400,8 +400,8 @@ module Squared
|
|
400
400
|
status = %w[created exited dead]
|
401
401
|
end
|
402
402
|
ps.merge(status.map { |s| "--filter=\"status=#{s}\"" })
|
403
|
-
list_image(flag, ps, no: no, hint: "status: #{status.join(', ')}", from: from) do |
|
404
|
-
run(cmd.temp(
|
403
|
+
list_image(flag, ps, no: no, hint: "status: #{status.join(', ')}", from: from) do |img|
|
404
|
+
run(cmd.temp(img), from: from)
|
405
405
|
end
|
406
406
|
return
|
407
407
|
else
|
@@ -426,9 +426,8 @@ module Squared
|
|
426
426
|
break
|
427
427
|
end
|
428
428
|
end
|
429
|
-
flag = :run if flag == :list
|
430
429
|
list_image(flag, cmd << '-a', from: from) do |val|
|
431
|
-
container(
|
430
|
+
container(:run, if name
|
432
431
|
opts.dup << "name=#{index == 0 ? name : "#{name}-#{index}"}"
|
433
432
|
else
|
434
433
|
opts
|
@@ -528,20 +527,22 @@ module Squared
|
|
528
527
|
found = false
|
529
528
|
IO.popen(session_done(cmd << '--format=json')).each_with_index do |line, index|
|
530
529
|
data = JSON.parse(line)
|
530
|
+
id = data['ID']
|
531
531
|
rt = [data['Repository'], data['Tag']].reject { |val| val == '<none>' }.join(':')
|
532
|
-
rt = nil if
|
532
|
+
rt = nil if rt.empty?
|
533
533
|
aa = if data['Names']
|
534
534
|
as_a(data['Names']).join(', ')
|
535
|
-
elsif
|
535
|
+
elsif rt
|
536
536
|
dd = true
|
537
537
|
data['Repository']
|
538
538
|
else
|
539
|
-
|
539
|
+
id
|
540
540
|
end
|
541
541
|
bb = index.succ.to_s
|
542
542
|
cc = bb.size + 1
|
543
|
-
|
544
|
-
|
543
|
+
ee = data['Image'] || rt || aa
|
544
|
+
a = sub_style(ee, styles: theme[:inline])
|
545
|
+
b = "Execute #{sub_style(flag, styles: theme[:active])} on #{a}#{ee == id ? '' : " (#{id})"}"
|
545
546
|
c, d = no ? ['y/N', 'N'] : ['Y/n', 'Y']
|
546
547
|
e = time_format(time_offset(data['CreatedAt']), pass: ['ms'])
|
547
548
|
f = sub_style(ARG[:BORDER][0], styles: theme[:inline])
|
@@ -560,7 +561,7 @@ module Squared
|
|
560
561
|
next unless confirm("#{h + b}? [#{c}] ", d, timeout: 60)
|
561
562
|
|
562
563
|
puts if @@print_order == 0
|
563
|
-
blk.call
|
564
|
+
blk.call id
|
564
565
|
end
|
565
566
|
puts log_message(Logger::INFO, 'none detected', subject: "#{name}:#{from}", hint: hint) unless found
|
566
567
|
end
|
@@ -1080,10 +1080,10 @@ module Squared
|
|
1080
1080
|
unless (origin = option('repository', prefix: 'git', ignore: false))
|
1081
1081
|
out = source(git_output('log -n1 --format=%h%d'), io: true, banner: false, stdout: true).first
|
1082
1082
|
if out =~ /^#{r[2]} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/
|
1083
|
-
split_escape($1).each do |
|
1084
|
-
next unless
|
1083
|
+
split_escape($1).each do |s|
|
1084
|
+
next unless s.end_with?("/#{branch}")
|
1085
1085
|
|
1086
|
-
origin =
|
1086
|
+
origin = s[0, s.size - branch.size - 1]
|
1087
1087
|
break
|
1088
1088
|
end
|
1089
1089
|
end
|
@@ -4,7 +4,7 @@ module Squared
|
|
4
4
|
module Workspace
|
5
5
|
module Project
|
6
6
|
class Python < Git
|
7
|
-
REQUIREMENTS = %w[requirements.txt pyproject.toml setup.cfg].freeze
|
7
|
+
REQUIREMENTS = %w[requirements.txt pyproject.toml setup.cfg poetry.lock].freeze
|
8
8
|
SETUPTOOLS = %w[setup.py pyproject.toml].freeze
|
9
9
|
DIR_PYTHON = (REQUIREMENTS + SETUPTOOLS).freeze
|
10
10
|
OPT_PYTHON = {
|
@@ -24,6 +24,12 @@ module Squared
|
|
24
24
|
python-version=q report=p r|requirement=p root=p root-user-action=b src=p t|target=p
|
25
25
|
upgrade-strategy=b].freeze
|
26
26
|
}.freeze
|
27
|
+
OPT_POETRY = {
|
28
|
+
common: %w[ansi no-ansi no-cache n|no-interaction no-plugins P|project=p q|quiet v|verbose].freeze,
|
29
|
+
build: %w[clean config-settings=qq f|format=b o|output=p].freeze,
|
30
|
+
publish: %w[build dry-run client-cert=p cert=p dist-dir=p p|password=b r|repository=b skip-existing
|
31
|
+
u|username=b].freeze
|
32
|
+
}.freeze
|
27
33
|
OPT_HATCH = {
|
28
34
|
common: %w[color interactive no-color no-interactive cache-dir=p config=p data-dir=p e|env=b p|project=e
|
29
35
|
q|quiet v|verbose].freeze,
|
@@ -36,7 +42,8 @@ module Squared
|
|
36
42
|
config-file=p cert=p client-cert=p i|identity=b p|password=q r|repository=b repository-url=q
|
37
43
|
sign-with=b u|username=q].freeze
|
38
44
|
}.freeze
|
39
|
-
private_constant :REQUIREMENTS, :SETUPTOOLS, :DIR_PYTHON, :OPT_PYTHON, :OPT_PIP, :
|
45
|
+
private_constant :REQUIREMENTS, :SETUPTOOLS, :DIR_PYTHON, :OPT_PYTHON, :OPT_PIP, :OPT_POETRY, :OPT_HATCH,
|
46
|
+
:OPT_TWINE
|
40
47
|
|
41
48
|
class << self
|
42
49
|
def populate(*); end
|
@@ -75,8 +82,8 @@ module Squared
|
|
75
82
|
|
76
83
|
@@tasks[ref] = {
|
77
84
|
'install' => %i[user force upgrade target editable].freeze,
|
78
|
-
'build' => %i[python hatch].freeze,
|
79
|
-
'publish' => %i[twine hatch].freeze
|
85
|
+
'build' => %i[python poetry hatch].freeze,
|
86
|
+
'publish' => %i[poetry twine hatch].freeze
|
80
87
|
}.freeze
|
81
88
|
|
82
89
|
def ref
|
@@ -130,12 +137,22 @@ module Squared
|
|
130
137
|
end
|
131
138
|
end
|
132
139
|
when 'build'
|
133
|
-
format_desc(action, flag, 'opts*', after: flag
|
140
|
+
format_desc(action, flag, 'opts*', after: case flag
|
141
|
+
when :python
|
142
|
+
'srcdir?'
|
143
|
+
when :hatch
|
144
|
+
'location?'
|
145
|
+
end)
|
134
146
|
task flag do |_, args|
|
135
147
|
buildx flag, args.to_a
|
136
148
|
end
|
137
149
|
when 'publish'
|
138
|
-
format_desc(action, flag, 'opts*', after: flag
|
150
|
+
format_desc(action, flag, 'opts*', after: case flag
|
151
|
+
when :hatch
|
152
|
+
'artifacts?'
|
153
|
+
when :twine
|
154
|
+
'dist?'
|
155
|
+
end)
|
139
156
|
task flag do |_, args|
|
140
157
|
publish flag, args.to_a
|
141
158
|
end
|
@@ -151,22 +168,27 @@ module Squared
|
|
151
168
|
super
|
152
169
|
elsif outdated?
|
153
170
|
workspace.rev_clear name
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
cmd << "--#{flag}"
|
158
|
-
when :target
|
159
|
-
cmd << quote_option('target', basepath(target))
|
160
|
-
when :force
|
161
|
-
cmd << '--force-reinstall'
|
171
|
+
if !flag && dependtype == 4
|
172
|
+
cmd = session 'poetry', 'install'
|
173
|
+
cmd << '--no-root' if option('no-root')
|
162
174
|
else
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
175
|
+
cmd = pip_session 'install'
|
176
|
+
case flag
|
177
|
+
when :user
|
178
|
+
cmd << "--#{flag}"
|
179
|
+
when :target
|
180
|
+
cmd << quote_option('target', basepath(target))
|
181
|
+
when :force
|
182
|
+
cmd << '--force-reinstall'
|
183
|
+
else
|
184
|
+
append_global
|
185
|
+
end
|
186
|
+
append_pip(flag, opts, from: :install) if flag
|
187
|
+
if dependtype == 1 && !session_arg?('e', 'editable')
|
188
|
+
cmd << '-r requirements.txt' unless session_arg?('r', 'requirement')
|
189
|
+
elsif !session_arg?('e', 'editable', value: true)
|
190
|
+
cmd << '.'
|
191
|
+
end
|
170
192
|
end
|
171
193
|
run(from: :depend, sync: sync)
|
172
194
|
end
|
@@ -268,6 +290,9 @@ module Squared
|
|
268
290
|
when :python
|
269
291
|
cmd << shell_option('m', 'build')
|
270
292
|
list = OPT_PYTHON[:build] + OPT_PYTHON[:common]
|
293
|
+
when :poetry
|
294
|
+
cmd << 'build'
|
295
|
+
list = OPT_POETRY[:build] + OPT_POETRY[:common]
|
271
296
|
when :hatch
|
272
297
|
cmd << 'build'
|
273
298
|
list = OPT_HATCH[:build] + OPT_HATCH[:common]
|
@@ -281,7 +306,17 @@ module Squared
|
|
281
306
|
out << opt
|
282
307
|
end
|
283
308
|
end
|
284
|
-
|
309
|
+
case flag
|
310
|
+
when :poetry
|
311
|
+
if srcdir
|
312
|
+
if session_arg?('o', 'output')
|
313
|
+
out << srcdir
|
314
|
+
else
|
315
|
+
cmd << quote_option('output', basepath(srcdir))
|
316
|
+
end
|
317
|
+
srcdir = nil
|
318
|
+
end
|
319
|
+
when :hatch
|
285
320
|
if ENV['HATCH_BUILD_LOCATION']
|
286
321
|
srcdir = nil
|
287
322
|
else
|
@@ -298,6 +333,9 @@ module Squared
|
|
298
333
|
cmd = session flag
|
299
334
|
out = []
|
300
335
|
case flag
|
336
|
+
when :poetry
|
337
|
+
cmd << 'publish'
|
338
|
+
list = OPT_POETRY[:publish] + OPT_POETRY[:common]
|
301
339
|
when :twine
|
302
340
|
cmd << 'upload'
|
303
341
|
list = OPT_TWINE[:publish]
|
@@ -306,7 +344,7 @@ module Squared
|
|
306
344
|
list = OPT_HATCH[:publish] + OPT_HATCH[:common]
|
307
345
|
end
|
308
346
|
option_sanitize(opts, list).first.each do |opt|
|
309
|
-
if flag
|
347
|
+
if flag != :twine && opt =~ /^(v+|q+)$/
|
310
348
|
cmd << "-#{$1}"
|
311
349
|
else
|
312
350
|
out << opt
|
@@ -315,7 +353,7 @@ module Squared
|
|
315
353
|
if out.empty?
|
316
354
|
dist = basepath.join('dist')
|
317
355
|
raise_error('no source files given', hint: dist) unless dist.directory? && !dist.empty?
|
318
|
-
out << "#{dist}/*"
|
356
|
+
out << "#{dist}/*" unless flag == :poetry
|
319
357
|
end
|
320
358
|
append_value out
|
321
359
|
run(from: :"#{flag}:publish")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|