squared 0.7.5 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3a64a3f90d6dfc5e68c78112d2c52d159be020666fb157947fbdc7d09082017
4
- data.tar.gz: e24e2116bea994017beba440d32e3f9fcf3c4245f2fc152a8c9ab2d6331c34ed
3
+ metadata.gz: 34bdb83cec13d6b8da3e9aecb19b2b13f7c3482ce7500f399e2663ef436c46d1
4
+ data.tar.gz: b12b93015ce27785b1903674af314582348537ca3cc5ac2de00188c072677e50
5
5
  SHA512:
6
- metadata.gz: '0792cc244db8ec647b9ca5eb30a2fbf8b5b2cd215613c619d96c52bc78abffd9b3231fb31f62cb1eec6227277c0fdd09dcea1a71e4624cb0f378b4fc1868f02d'
7
- data.tar.gz: 42efaeed57cae1baa4b9b8ef8cbbde7d0e049713e6f246a0b3ce19175354ce35b633eb22e2e55f192763059451c7a421113b19f9b760b70de59115adf2a767d5
6
+ metadata.gz: ede0371288478d0cdfdfc3a282d82b3d46e2dd5f32186df6d9125f781eeaa604f75e808490fc8cdfde32a77ed7b24d392407d5c907bb31384cfa4f19276a6623
7
+ data.tar.gz: 822a6b29c9047a8708240f25443ce6158092a04001302b14981d3466d9473a24db2c6ce8b5a31011f0104848943e241ed9eaf975b0b6bcc598abea22b571e0a3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.6] - 2026-05-04
4
+
5
+ ### Added
6
+
7
+ - Node command publish action verify was created.
8
+
9
+ ## [0.6.13]
10
+
11
+ ### Added
12
+
13
+ - Application project commands can be defined without a reference.
14
+
15
+ ### Fixed
16
+
17
+ - Application methods log and exclude were non-functional.
18
+ - Project base tasks did not detect build scripts using Arrays.
19
+
3
20
  ## [0.7.5] - 2026-04-29
4
21
 
5
22
  ### Added
@@ -13,20 +30,20 @@
13
30
  - Docker command bake action build can use a URL as the context.
14
31
  - Git command options were updated to version 2.54.
15
32
 
16
- ## [0.6.12] - 2026-04-29
33
+ ## [0.6.12]
17
34
 
18
35
  ### Fixed
19
36
 
20
37
  - Application dynamic Project loader assumed class would be found.
21
38
  - Git command grep did not add patterns with "--" pathspec separator.
22
39
 
23
- ## [0.5.23] - 2026-04-29
40
+ ## [0.5.23]
24
41
 
25
42
  ### Fixed
26
43
 
27
44
  - See `0.4.37`.
28
45
 
29
- ## [0.4.37] - 2026-04-29
46
+ ## [0.4.37]
30
47
 
31
48
  ### Changed
32
49
 
@@ -77,19 +94,19 @@
77
94
 
78
95
  - Node command outdated using PNPM did not work in nested projects.
79
96
 
80
- ## [0.6.11] - 2026-03-11
97
+ ## [0.6.11]
81
98
 
82
99
  ### Changed
83
100
 
84
101
  - Git internal data calls do not write to logs.
85
102
 
86
- ## [0.5.22] - 2026-03-11
103
+ ## [0.5.22]
87
104
 
88
105
  ### Fixed
89
106
 
90
107
  - Project base run command was not covered due to lack of type checking.
91
108
 
92
- ## [0.4.36] - 2026-03-11
109
+ ## [0.4.36]
93
110
 
94
111
  ### Added
95
112
 
@@ -219,7 +236,7 @@
219
236
  - Project base method command_args did not append prompted value.
220
237
  - Bundler command exec did not use correct delegate for delete.
221
238
 
222
- ## [0.6.9] - 2026-01-07
239
+ ## [0.6.9]
223
240
 
224
241
  ### Added
225
242
 
@@ -235,7 +252,7 @@
235
252
 
236
253
  - See `0.4.35`.
237
254
 
238
- ## [0.4.35] - 2025-12-31
255
+ ## [0.4.35]
239
256
 
240
257
  ### Changed
241
258
 
@@ -262,13 +279,13 @@
262
279
 
263
280
  - Gem command outdated did not set bindir with update command.
264
281
 
265
- ## [0.5.20] - 2025-12-26
282
+ ## [0.5.20]
266
283
 
267
284
  ### Fixed
268
285
 
269
286
  - Bundle config get method did not always discard newline.
270
287
 
271
- ## [0.4.34] - 2025-12-26
288
+ ## [0.4.34]
272
289
 
273
290
  ### Added
274
291
 
@@ -299,13 +316,13 @@
299
316
  - Bundler did not recognize sub-commands options.
300
317
  - Project graph did not use built-in comparison method.
301
318
 
302
- ## [0.5.19] - 2025-12-07
319
+ ## [0.5.19]
303
320
 
304
321
  ### Fixed
305
322
 
306
323
  - See `0.4.33`.
307
324
 
308
- ## [0.4.33] - 2025-12-07
325
+ ## [0.4.33]
309
326
 
310
327
  ### Added
311
328
 
@@ -351,7 +368,7 @@
351
368
 
352
369
  - See `0.5.18`.
353
370
 
354
- ## [0.4.32] - 2025-11-25
371
+ ## [0.4.32]
355
372
 
356
373
  ### Fixed
357
374
 
@@ -366,7 +383,7 @@
366
383
 
367
384
  - See `0.4.31`.
368
385
 
369
- ## [0.4.31] - 2025-11-22
386
+ ## [0.4.31]
370
387
 
371
388
  ### Changed
372
389
 
@@ -443,13 +460,13 @@
443
460
  - Project graph print did not display parent and last child consequetively.
444
461
  - Project outdated interactive prompts use exact column alignments.
445
462
 
446
- ## [0.5.16] - 2025-11-14
463
+ ## [0.5.16]
447
464
 
448
465
  ### Fixed
449
466
 
450
467
  - See `0.4.30`.
451
468
 
452
- ## [0.4.30] - 2025-11-14
469
+ ## [0.4.30]
453
470
 
454
471
  ### Added
455
472
 
@@ -476,13 +493,13 @@
476
493
 
477
494
  - Session global program options were untested and worthless upon draft.
478
495
 
479
- ## [0.5.15] - 2025-11-08
496
+ ## [0.5.15]
480
497
 
481
498
  ### Fixed
482
499
 
483
500
  - See `0.4.29`.
484
501
 
485
- ## [0.4.29] - 2025-11-08
502
+ ## [0.4.29]
486
503
 
487
504
  ### Fixed
488
505
 
@@ -494,7 +511,7 @@
494
511
 
495
512
  - See `0.4.28`.
496
513
 
497
- ## [0.4.28] - 2025-11-08
514
+ ## [0.4.28]
498
515
 
499
516
  ### Fixed
500
517
 
@@ -517,13 +534,13 @@
517
534
  - Project base choice range did not detect empty list result.
518
535
  - Project base method build as arrays parsed unrelated arguments.
519
536
 
520
- ## [0.5.13] - 2025-11-05
537
+ ## [0.5.13]
521
538
 
522
539
  ### Fixed
523
540
 
524
541
  - See `0.4.27`.
525
542
 
526
- ## [0.4.27] - 2025-11-05
543
+ ## [0.4.27]
527
544
 
528
545
  ### Changed
529
546
 
@@ -628,7 +645,7 @@
628
645
 
629
646
  - Node task update did not check equivalent ENV install options.
630
647
 
631
- ## [0.5.12] - 2025-10-31
648
+ ## [0.5.12]
632
649
 
633
650
  ### Changed
634
651
 
@@ -638,7 +655,7 @@
638
655
 
639
656
  - Node command run did nothing at all when called upon.
640
657
 
641
- ## [0.4.26] - 2025-10-31
658
+ ## [0.4.26]
642
659
 
643
660
  ### Added
644
661
 
@@ -666,7 +683,7 @@
666
683
  - Ruby command version did not parse asdf output in Go.
667
684
  - Git command submodule action branch did not provide name argument.
668
685
 
669
- ## [0.4.25] - 2025-10-18
686
+ ## [0.4.25]
670
687
 
671
688
  ### Fixed
672
689
 
@@ -697,7 +714,7 @@
697
714
 
698
715
  - See `0.4.23`.
699
716
 
700
- ## [0.4.23] - 2025-10-11
717
+ ## [0.4.23]
701
718
 
702
719
  ### Fixed
703
720
 
@@ -711,7 +728,7 @@
711
728
 
712
729
  - Git command commit did not always show files being pushed.
713
730
 
714
- ## [0.4.22] - 2025-10-08
731
+ ## [0.4.22]
715
732
 
716
733
  ### Added
717
734
 
@@ -735,7 +752,7 @@
735
752
 
736
753
  - See `0.4.21`.
737
754
 
738
- ## [0.4.21] - 2025-10-01
755
+ ## [0.4.21]
739
756
 
740
757
  ### Added
741
758
 
@@ -771,7 +788,7 @@
771
788
 
772
789
  - See `0.4.20`.
773
790
 
774
- ## [0.4.20] - 2025-09-14
791
+ ## [0.4.20]
775
792
 
776
793
  ### Changed
777
794
 
@@ -794,7 +811,7 @@
794
811
  - Docker command compose parameter services is interactive.
795
812
  - Workspace with public method has conditional pass parameter.
796
813
 
797
- ## [0.4.19] - 2025-08-30
814
+ ## [0.4.19]
798
815
 
799
816
  ### Added
800
817
 
@@ -831,7 +848,7 @@
831
848
  - Git command submodule did not include name of command.
832
849
  - Shellwords method shellsplit was missing from String class.
833
850
 
834
- ## [0.4.18] - 2025-08-23
851
+ ## [0.4.18]
835
852
 
836
853
  ### Added
837
854
 
@@ -847,19 +864,19 @@
847
864
  - Common format method puts_oe was renamed log_console.
848
865
  - Global task git:all is disabled for single project workspaces.
849
866
 
850
- ## [0.3.14] - 2025-08-23
867
+ ## [0.3.14]
851
868
 
852
869
  ### Fixed
853
870
 
854
871
  - Gem command exec did not separate command and arguments.
855
872
 
856
- ## [0.2.14] - 2025-08-23
873
+ ## [0.2.14]
857
874
 
858
875
  ### Fixed
859
876
 
860
877
  - See `0.1.11`.
861
878
 
862
- ## [0.1.11] - 2025-08-23
879
+ ## [0.1.11]
863
880
 
864
881
  ### Fixed
865
882
 
@@ -874,7 +891,7 @@
874
891
 
875
892
  - Shellwords gem is no longer globally required.
876
893
 
877
- ## [0.4.17] - 2025-08-09
894
+ ## [0.4.17]
878
895
 
879
896
  ### Added
880
897
 
@@ -910,7 +927,7 @@
910
927
 
911
928
  - See `0.4.16`.
912
929
 
913
- ## [0.4.16] - 2025-07-27
930
+ ## [0.4.16]
914
931
 
915
932
  ### Added
916
933
 
@@ -944,7 +961,7 @@
944
961
 
945
962
  - Common method choice can accept dashed ranges for selection lists.
946
963
 
947
- ## [0.4.15] - 2025-07-16
964
+ ## [0.4.15]
948
965
 
949
966
  ### Added
950
967
 
@@ -956,19 +973,19 @@
956
973
  - Ruby task copy does not guess Gem directory when version is used.
957
974
  - Workspace hash-based data uses global method for key creation.
958
975
 
959
- ## [0.3.13] - 2025-07-16
976
+ ## [0.3.13]
960
977
 
961
978
  ### Fixed
962
979
 
963
980
  - See `0.2.13`.
964
981
 
965
- ## [0.2.13] - 2025-07-16
982
+ ## [0.2.13]
966
983
 
967
984
  ### Fixed
968
985
 
969
986
  - Project graph did not ignore circular references.
970
987
 
971
- ## [0.1.10] - 2025-07-16
988
+ ## [0.1.10]
972
989
 
973
990
  ### Fixed
974
991
 
@@ -985,7 +1002,7 @@
985
1002
 
986
1003
  - Gem command push did not prompt for gem to publish.
987
1004
 
988
- ## [0.4.14] - 2025-07-05
1005
+ ## [0.4.14]
989
1006
 
990
1007
  ### Added
991
1008
 
@@ -1016,7 +1033,7 @@
1016
1033
  - Project confirmation accept dialog did not always quit.
1017
1034
  - Git command add did not detect when no files were changed.
1018
1035
 
1019
- ## [0.3.12] - 2025-07-05
1036
+ ## [0.3.12]
1020
1037
 
1021
1038
  ### Fixed
1022
1039
 
@@ -1026,13 +1043,13 @@
1026
1043
  - Gem command push did not validate gem file to publish.
1027
1044
  - Node command publish did not publish when silent.
1028
1045
 
1029
- ## [0.2.12] - 2025-07-05
1046
+ ## [0.2.12]
1030
1047
 
1031
1048
  ### Fixed
1032
1049
 
1033
1050
  - See `0.1.9`.
1034
1051
 
1035
- ## [0.1.9] - 2025-07-05
1052
+ ## [0.1.9]
1036
1053
 
1037
1054
  ### Added
1038
1055
 
@@ -1072,7 +1089,7 @@
1072
1089
 
1073
1090
  - Project private variables external modification was revised.
1074
1091
 
1075
- ## [0.4.13] - 2025-06-16
1092
+ ## [0.4.13]
1076
1093
 
1077
1094
  ### Added
1078
1095
 
@@ -1129,14 +1146,14 @@
1129
1146
 
1130
1147
  - See `0.2.11`.
1131
1148
 
1132
- ## [0.2.11] - 2025-05-15
1149
+ ## [0.2.11]
1133
1150
 
1134
1151
  ### Fixed
1135
1152
 
1136
1153
  - Disabled batch and alias tasks were not hidden.
1137
1154
  - Workspace git did not parse multiple download URIs.
1138
1155
 
1139
- ## [0.1.8] - 2025-05-15
1156
+ ## [0.1.8]
1140
1157
 
1141
1158
  ### Fixed
1142
1159
 
@@ -1218,7 +1235,7 @@
1218
1235
  - Git command rev action branch only echoed valid branches.
1219
1236
  - Git command rev action parseopt is not relevant to a workspace.
1220
1237
 
1221
- ## [0.3.10] - 2025-04-27
1238
+ ## [0.3.10]
1222
1239
 
1223
1240
  ### Fixed
1224
1241
 
@@ -1231,14 +1248,14 @@
1231
1248
 
1232
1249
  - Git command files action ignored could not be used alone.
1233
1250
 
1234
- ## [0.2.10] - 2025-04-27
1251
+ ## [0.2.10]
1235
1252
 
1236
1253
  ### Fixed
1237
1254
 
1238
1255
  - Project run and script tasks did not fire first and last callbacks.
1239
1256
  - Git command clone did not read booleans for recurse-submodules.
1240
1257
 
1241
- ## [0.1.7] - 2025-04-27
1258
+ ## [0.1.7]
1242
1259
 
1243
1260
  ### Fixed
1244
1261
 
@@ -1295,13 +1312,13 @@
1295
1312
 
1296
1313
  - Project task archive was not enabled.
1297
1314
 
1298
- ## [0.3.9] - 2025-04-17
1315
+ ## [0.3.9]
1299
1316
 
1300
1317
  ### Fixed
1301
1318
 
1302
1319
  - Project option parser did not separate custom values.
1303
1320
 
1304
- ## [0.2.9] - 2025-04-17
1321
+ ## [0.2.9]
1305
1322
 
1306
1323
  ### Changed
1307
1324
 
@@ -1313,7 +1330,7 @@
1313
1330
  - Git command pull actions used unknown flags.
1314
1331
  - Workspace describe did not merge multiple invocations.
1315
1332
 
1316
- ## [0.1.6] - 2025-04-17
1333
+ ## [0.1.6]
1317
1334
 
1318
1335
  ### Fixed
1319
1336
 
@@ -1339,13 +1356,13 @@
1339
1356
  - Python venv init did not locate user-defined program paths.
1340
1357
  - Node update task did not reset revbuild target flags.
1341
1358
 
1342
- ## [0.3.8] - 2025-04-12
1359
+ ## [0.3.8]
1343
1360
 
1344
1361
  ### Fixed
1345
1362
 
1346
1363
  - Project class did not parse verbose string values.
1347
1364
 
1348
- ## [0.2.8] - 2025-04-12
1365
+ ## [0.2.8]
1349
1366
 
1350
1367
  ### Fixed
1351
1368
 
@@ -1387,13 +1404,13 @@
1387
1404
  - Unrecognized options are appended selectively on context.
1388
1405
  - Hatch root options were not applied correctly.
1389
1406
 
1390
- ## [0.3.7] - 2025-04-08
1407
+ ## [0.3.7]
1391
1408
 
1392
1409
  ### Fixed
1393
1410
 
1394
1411
  - See `0.2.7`.
1395
1412
 
1396
- ## [0.2.7] - 2025-04-08
1413
+ ## [0.2.7]
1397
1414
 
1398
1415
  ### Fixed
1399
1416
 
@@ -1516,13 +1533,13 @@
1516
1533
 
1517
1534
  - See `0.2.6`.
1518
1535
 
1519
- ## [0.2.6] - 2025-03-06
1536
+ ## [0.2.6]
1520
1537
 
1521
1538
  ### Fixed
1522
1539
 
1523
1540
  - Git rebase did not include flag with pull command.
1524
1541
 
1525
- ## [0.3.4] - 2025-03-06
1542
+ ## [0.3.4]
1526
1543
 
1527
1544
  ### Fixed
1528
1545
 
@@ -1544,13 +1561,13 @@
1544
1561
 
1545
1562
  - Task program command options used unrecognized symbol.
1546
1563
 
1547
- ## [0.2.5] - 2025-02-25
1564
+ ## [0.2.5]
1548
1565
 
1549
1566
  ### Fixed
1550
1567
 
1551
1568
  - See `0.1.5`.
1552
1569
 
1553
- ## [0.1.5] - 2025-02-25
1570
+ ## [0.1.5]
1554
1571
 
1555
1572
  ### Fixed
1556
1573
 
@@ -1566,7 +1583,7 @@
1566
1583
 
1567
1584
  - Build ENV options error message used undeclared variable.
1568
1585
 
1569
- ## [0.2.4] - 2025-02-12
1586
+ ## [0.2.4]
1570
1587
 
1571
1588
  ### Fixed
1572
1589
 
@@ -1635,7 +1652,7 @@
1635
1652
 
1636
1653
  - Project hash options duplicated dash prefix.
1637
1654
 
1638
- ## [0.1.4] - 2025-02-05
1655
+ ## [0.1.4]
1639
1656
 
1640
1657
  ### Fixed
1641
1658
 
@@ -1812,12 +1829,14 @@
1812
1829
 
1813
1830
  - Changelog was created.
1814
1831
 
1832
+ [0.7.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.6
1815
1833
  [0.7.5]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.5
1816
1834
  [0.7.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.4
1817
1835
  [0.7.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.3
1818
1836
  [0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
1819
1837
  [0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
1820
1838
  [0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
1839
+ [0.6.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.13
1821
1840
  [0.6.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.12
1822
1841
  [0.6.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.11
1823
1842
  [0.6.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.10
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.7.5'
4
+ VERSION = '0.7.6'
5
5
  end
@@ -950,7 +950,7 @@ module Squared
950
950
  log_console(*args, pipe: kwargs[:pipe] || pipe)
951
951
  end
952
952
 
953
- def script_command(task, val, group, ref, on, &blk)
953
+ def script_command(task, val, group, ref, on = nil, &blk)
954
954
  if block_given?
955
955
  val = Struct::RunData.new(val, blk)
956
956
  elsif !val
@@ -961,7 +961,7 @@ module Squared
961
961
  as_a group, :to_sym
962
962
  else
963
963
  label = :ref
964
- as_a ref, :to_sym
964
+ as_a(ref || :_, :to_sym)
965
965
  end.each do |name|
966
966
  @script[label][name][task] = val
967
967
  @events[label][name][task] = on if on.is_a?(Hash)
@@ -1014,6 +1014,8 @@ module Squared
1014
1014
  nil
1015
1015
  elsif ref && target[:ref].key?(ref)
1016
1016
  target[:ref][ref]
1017
+ else
1018
+ target[:ref][:_]
1017
1019
  end
1018
1020
  end
1019
1021
 
@@ -1351,7 +1351,7 @@ module Squared
1351
1351
  else
1352
1352
  if series?(obj)
1353
1353
  obj.each(&:call)
1354
- elsif obj.is_a?(Array) && obj.none?(String)
1354
+ elsif obj.is_a?(Array) && obj.any? { |val| val.nil? || !val.is_a?(String) }
1355
1355
  build(*obj, **kwargs)
1356
1356
  elsif obj
1357
1357
  run_s(*Array(obj), **kwargs)
@@ -1557,8 +1557,8 @@ module Squared
1557
1557
 
1558
1558
  def session(*cmd, prefix: cmd.first, main: true, path: true, options: true)
1559
1559
  prefix = prefix.to_s.stripext
1560
- if path && (val = shell_bin(prefix))
1561
- cmd[0] = shell_quote(val, force: false)
1560
+ if path && (bin = shell_bin(prefix))
1561
+ cmd[0] = shell_quote(bin, force: false)
1562
1562
  end
1563
1563
  ret = JoinSet.new(cmd)
1564
1564
  if options
@@ -1622,7 +1622,7 @@ module Squared
1622
1622
  args.unshift(*a)
1623
1623
  OptionPartition.uniq!(args, pass) if pass
1624
1624
  end
1625
- kwargs&.update(b) { |_, val| val }
1625
+ kwargs&.update(b) { |_, obj| obj }
1626
1626
  nil
1627
1627
  end
1628
1628
 
@@ -1790,7 +1790,7 @@ module Squared
1790
1790
  workspace.format_desc([@desc, action, flag].compact, opts, **kwargs)
1791
1791
  end
1792
1792
 
1793
- def format_banner(cmd, banner: true, hint: nil, strip: nil, quote: false)
1793
+ def format_banner(cmd, banner: true, hint: nil, strip: nil, quote: false, command: true)
1794
1794
  return unless banner && banner?
1795
1795
 
1796
1796
  if (data = workspace.banner_get(*@ref, group: group))
@@ -1803,15 +1803,17 @@ module Squared
1803
1803
  if verbose
1804
1804
  out = []
1805
1805
  if data.command
1806
- if cmd =~ /\A(?:"((?:[^"]|(?<=\\)")+)"|'((?:[^']|(?<=\\)')+)'|(\S+))( |\z)/
1807
- arg = $3 || $2 || $1
1808
- cmd = cmd.sub(arg, data.command == 0 ? arg.stripext : arg.stripext.upcase)
1809
- end
1810
- if strip || (strip.nil? && data.order.include?(:path))
1811
- cmd = cmd.gsub(/(?:#{s = Regexp.escape(File.join(path, ''))}?(?=["'])|#{s})/, '')
1812
- .gsub(/(?: -[^ ])? (?:""|'')/, '')
1806
+ if command
1807
+ if cmd =~ /\A(?:"((?:[^"]|(?<=\\)")+)"|'((?:[^']|(?<=\\)')+)'|(\S+))( |\z)/
1808
+ arg = $3 || $2 || $1
1809
+ cmd = cmd.sub(arg, data.command == 0 ? arg.stripext : arg.stripext.upcase)
1810
+ end
1811
+ if strip || (strip.nil? && data.order.include?(:path))
1812
+ cmd = cmd.gsub(/(?:#{s = Regexp.escape(File.join(path, ''))}?(?=["'])|#{s})/, '')
1813
+ .gsub(/(?: -[^ ])? (?:""|'')/, '')
1814
+ end
1815
+ cmd.gsub!(/(?<= )(["'])([\w.-]+)\1(?= |\z)/, '\2') unless quote
1813
1816
  end
1814
- cmd.gsub!(/(?<= )(["'])([\w.-]+)\1(?= |\z)/, '\2') unless quote
1815
1817
  out << cmd.subhint(hint)
1816
1818
  end
1817
1819
  data.order.each do |val|
@@ -2393,7 +2395,7 @@ module Squared
2393
2395
  return if from == false
2394
2396
 
2395
2397
  require 'timeout'
2396
- unless (path.to_s == Dir.pwd || pass == true) && (workspace.mri? || !workspace.windows?)
2398
+ unless (path.to_s == Dir.pwd || pass) && (workspace.mri? || !workspace.windows?)
2397
2399
  pwd = Dir.pwd
2398
2400
  Dir.chdir(path)
2399
2401
  end
@@ -1090,7 +1090,7 @@ module Squared
1090
1090
  cmd, opts = git_session('rebase', opts: opts)
1091
1091
  case flag
1092
1092
  when :branch
1093
- return unless upstream
1093
+ raise ArgumentError, 'no upstream branch' unless upstream
1094
1094
 
1095
1095
  op = OptionPartition.new(opts, OPT_GIT[:rebase], cmd, project: self, strict: strict?,
1096
1096
  no: OPT_GIT[:no][:rebase])
@@ -1098,7 +1098,7 @@ module Squared
1098
1098
  append_head op.shift&.delete_prefix(':')
1099
1099
  op.clear(pass: false)
1100
1100
  when :onto
1101
- return unless upstream
1101
+ raise ArgumentError, 'no base branch/commit' unless upstream
1102
1102
 
1103
1103
  cmd << '--interactive' if option('interactive', 'i')
1104
1104
  cmd << shell_option('onto', commit) if commit
@@ -1921,7 +1921,7 @@ module Squared
1921
1921
  end)
1922
1922
  case flag
1923
1923
  when :blame
1924
- raise Errno::ENOENT, 'no file target' unless (n = op.index { |s| basepath(s).file? })
1924
+ raise Errno::ENOENT, 'no file target' unless (n = op.index { |val| basepath(val).file? })
1925
1925
 
1926
1926
  op.append(basepath(op.remove_at(n)), delim: true)
1927
1927
  .clear
@@ -1929,7 +1929,7 @@ module Squared
1929
1929
  if op.arg?(*VAL_GIT[:rebase][:send])
1930
1930
  op.clear
1931
1931
  elsif op.empty?
1932
- raise 'no commit target'
1932
+ raise ArgumentError, 'no commit target'
1933
1933
  else
1934
1934
  append_commit(*op.extras)
1935
1935
  end
@@ -2068,7 +2068,7 @@ module Squared
2068
2068
  if size == 0
2069
2069
  puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
2070
2070
  elsif stdout?
2071
- styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
2071
+ styles = theme.fetch(:banner, []).reject { |val| val.to_s.end_with?('!') }
2072
2072
  styles << :bold if styles.size <= 1
2073
2073
  puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
2074
2074
  sub: opt_style(styles, /^(\d+)(.+)$/))
@@ -2118,7 +2118,7 @@ module Squared
2118
2118
  glob = kwargs.fetch(:include, [])
2119
2119
  pass = kwargs.fetch(:exclude, [])
2120
2120
  status_data(*args).map(&:first).each_with_object({}) do |file, out|
2121
- next if !glob.empty? && glob.none? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
2121
+ next unless glob.empty? || glob.any? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
2122
2122
  next if pass.any? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
2123
2123
 
2124
2124
  out[file] = algorithm.hexdigest(File.read(basepath(file)))
@@ -2194,12 +2194,10 @@ module Squared
2194
2194
  if !files.empty?
2195
2195
  target << '--' << files.join(' ')
2196
2196
  true
2197
+ elsif expect.is_a?(String)
2198
+ raise expect
2197
2199
  elsif expect
2198
- raise(if expect.is_a?(String)
2199
- expect
2200
- else
2201
- kwargs[:parent] ? 'pathspec not present' : 'pathspec not within worktree'
2202
- end)
2200
+ raise(kwargs[:parent] ? 'pathspec not present' : 'pathspec not within worktree')
2203
2201
  else
2204
2202
  false
2205
2203
  end
@@ -2242,13 +2240,15 @@ module Squared
2242
2240
  end
2243
2241
 
2244
2242
  def foreachref(path, *args, format: nil, chomp: true)
2245
- path = Array(path).map { |val| "refs/#{val}" }
2246
2243
  format &&= quote_option('format', format)
2247
- ret = git_spawn('for-each-ref', format, *args, *path, stdout: workspace.windows?)
2244
+ ret = git_spawn('for-each-ref', format, *args.concat(Array(path).map { |val| "refs/#{val}" }),
2245
+ stdout: workspace.windows?)
2248
2246
  if ret.is_a?(String)
2249
2247
  ret.lines(chomp: chomp)
2248
+ elsif chomp
2249
+ ret.readlines(chomp: chomp)
2250
2250
  else
2251
- chomp ? ret.readlines(chomp: chomp) : ret
2251
+ ret
2252
2252
  end
2253
2253
  end
2254
2254
 
@@ -2292,11 +2292,10 @@ module Squared
2292
2292
  end
2293
2293
 
2294
2294
  def repotrack(origin, branch, quote: true)
2295
- unless origin && branch && (i = origin.index('/'))
2296
- raise_error(ArgumentError, "missing #{origin ? 'branch' : 'remote'} name", hint: origin)
2297
- end
2298
- branch = "#{branch}:#{origin[i.succ..-1]}" unless origin.end_with?("/#{branch}")
2299
- ret = [origin[0..i.pred], branch]
2295
+ n = origin&.index('/')
2296
+ raise_error "missing #{origin ? 'branch' : 'remote'} name", hint: origin unless n && branch
2297
+ branch = "#{branch}:#{origin[n.succ..-1]}" unless origin.end_with?("/#{branch}")
2298
+ ret = [origin[0..n.pred], branch]
2300
2299
  ret.quote! if quote
2301
2300
  ret
2302
2301
  end
@@ -2316,7 +2315,7 @@ module Squared
2316
2315
  end
2317
2316
 
2318
2317
  def matchhead(val)
2319
- val =~ /^(?:(?:HEAD|@)([~^]\d*)?|H(\d+))$/ ? $2 || $1 || '' : nil
2318
+ $2 || $1 || '' if val =~ /^(?:(?:HEAD|@)([~^]\d*)?|H(\d+))$/
2320
2319
  end
2321
2320
 
2322
2321
  def matchpathspec
@@ -156,7 +156,7 @@ module Squared
156
156
  'package' => %i[install add update dedupe rebuild reinstall].freeze,
157
157
  'outdated' => %i[major minor patch].freeze,
158
158
  'bump' => %i[version major minor patch].freeze,
159
- 'publish' => %i[latest tag].freeze,
159
+ 'publish' => %i[latest tag verify].freeze,
160
160
  'tsc' => %i[project build].freeze,
161
161
  'add' => nil,
162
162
  'run' => nil,
@@ -209,11 +209,10 @@ module Squared
209
209
  depend(:add, packages: packages, save: save)
210
210
  end
211
211
  when 'run'
212
- next if scripts.empty?
213
-
214
212
  format_desc action, nil, "script,opts*|#{indexchar}index+|#,pattern*"
215
213
  task action, [:script] do |_, args|
216
- list = scripts.to_a
214
+ next if (list = scripts.to_a).empty?
215
+
217
216
  if args.script == '#'
218
217
  format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: dependfile)
219
218
  else
@@ -334,21 +333,34 @@ module Squared
334
333
  end
335
334
  end
336
335
  when 'publish'
337
- format_desc(action, flag, 'otp?,p/ublic|r/estricted?,d/ry-run?', before: ('tag' if flag == :tag))
338
- task flag do |_, args|
339
- args = args.to_a
340
- access = if has_value!(args, 'r', 'restricted')
341
- 'restricted'
342
- elsif has_value!(args, 'p', 'public')
343
- 'public'
344
- end
345
- dryrun = has_value!(args, 'd', 'dry-run')
346
- if flag == :latest
347
- otp = args.first
348
- else
349
- tag, otp = param_guard(action, flag, args: args)
336
+ if flag == :verify
337
+ format_desc action, flag, 'version?,ext*'
338
+ task flag, [:version] do |_, args|
339
+ ext = args.extras
340
+ if (version = args.version)&.match?(/^\.?[a-z]+$/i)
341
+ ext.unshift(version)
342
+ version = nil
343
+ end
344
+ publish(flag, version: version, ext: ext)
345
+ end
346
+ else
347
+ format_desc(action, flag, 'otp?,p/ublic|r/estricted?,d/ry-run?',
348
+ before: ('tag' if flag == :tag))
349
+ task flag do |_, args|
350
+ args = args.to_a
351
+ access = if has_value!(args, 'r', 'restricted')
352
+ 'restricted'
353
+ elsif has_value!(args, 'p', 'public')
354
+ 'public'
355
+ end
356
+ dryrun = has_value!(args, 'd', 'dry-run')
357
+ if flag == :latest
358
+ otp = args.first
359
+ else
360
+ tag, otp = param_guard(action, flag, args: args)
361
+ end
362
+ publish(flag, otp: otp, tag: tag, access: access, dryrun: dryrun)
350
363
  end
351
- publish(flag, otp: otp, tag: tag, access: access, dryrun: dryrun)
352
364
  end
353
365
  when 'tsc'
354
366
  break unless @tsfile
@@ -882,47 +894,122 @@ module Squared
882
894
  package(:update, from: :update)
883
895
  end
884
896
 
885
- def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
897
+ def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil,
898
+ version: nil, ext: [], workspace: false)
886
899
  if read_package('private')
900
+ return if workspace
901
+
887
902
  ws = children.select { |proj| proj.ref?(Node.ref) }
888
903
  if ws.empty?
889
904
  print_error('nothing to publish', subject: name, hint: 'private')
890
- elsif confirm_basic('Publish workspace?', ws.map(&:name).join(', '), 'N')
891
- ws.each { |proj| proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun) }
905
+ elsif confirm_basic("#{flag == :verify ? 'Verify' : 'Publish'} workspace?", ws.map(&:name).join(', '), 'N')
906
+ ws.each do |proj|
907
+ proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun, version: version,
908
+ ext: ext, workspace: true)
909
+ end
892
910
  end
893
- return
894
- end
895
- return print_error("version: #{dependname}", subject: name, hint: 'not found') unless version
896
-
897
- cmd = session 'npm', 'publish'
898
- cmd << basic_option('otp', otp) if otp ||= option('otp')
899
- cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
900
- case access || option('access')
901
- when 'p', 'public'
902
- cmd << '--access=public'
903
- when 'r', 'restricted'
904
- cmd << '--access=restricted'
905
- end
906
- dryrun ||= dryrun?('npm')
907
- if dryrun
908
- cmd << '--dry-run'
909
- else
910
- from = :'npm:publish'
911
- log.info cmd.to_s
912
- end
913
- if sync
914
- run(sync: sync, from: from, interactive: !dryrun && ['Publish', 'N', npmname])
915
- else
916
- require 'open3'
917
- on :first, from
918
- pwd_set(cmd, dryrun: dryrun) do
919
- cmd = session_done cmd
920
- Open3.popen2e(cmd) do |_, out|
921
- write_lines(out, banner: format_banner(cmd),
922
- sub: npmnotice(opt_style(color(:bright_blue), /^(.+)(Tarball .+)$/, 2)))
911
+ elsif version ||= self.version
912
+ if flag == :verify
913
+ require 'open-uri'
914
+ require 'digest'
915
+ ext = ext.map { |val| val[0] == '.' ? val : ".#{val}" }
916
+ url = "https://unpkg.com/#{read_package('name')}@#{version}?meta"
917
+ print_item format_banner(url, command: false)
918
+ URI.open(url) do |f|
919
+ doc = JSON.parse(f.read)
920
+ n = doc['prefix'].size
921
+ i = 0
922
+ j = doc['files'].size
923
+ pad = j.to_s.size
924
+ m = 0
925
+ c = 0
926
+ e = 0
927
+ doc['files'].each do |item|
928
+ path = item['path'][n..-1]
929
+ js = File.extname(path)
930
+ next unless ext.empty? || ext.any? { |val| val == js }
931
+
932
+ begin
933
+ raise unless (file = basepath!(path)) && item['integrity'] =~ /^(sha\d+)-(.+)$/
934
+
935
+ hash = case $1
936
+ when 'sha384'
937
+ Digest::SHA384
938
+ when 'sha512'
939
+ Digest::SHA512
940
+ else
941
+ Digest::SHA256
942
+ end
943
+ .base64digest(file.read)
944
+ status = if hash == $2
945
+ m += 1
946
+ sub_style 'match', color(:green)
947
+ else
948
+ c += 1
949
+ sub_style 'check', theme[:caution]
950
+ end
951
+ rescue
952
+ status = sub_style 'error', theme[:warn]
953
+ e += 1
954
+ end
955
+ i += 1
956
+ puts "#{i.to_s.rjust(pad)}. #{status} #{path}"
957
+ end
958
+ if i == 0
959
+ puts("No files #{ext.empty? ? 'found' : "matched: #{ext.join(', ')}"}")
960
+ else
961
+ total = ["match #{m}"]
962
+ total << "check #{c}" unless c == 0
963
+ total << "error #{e}" unless e == 0
964
+ unless i == j
965
+ s = "in #{j}"
966
+ if total.size == 1
967
+ total[0] += " #{s}"
968
+ else
969
+ total << s
970
+ end
971
+ end
972
+ puts print_footer(total.join(' / '), right: true, sub: [
973
+ opt_style(color(:green), /^(.*)(match)(.+)$/, 2),
974
+ opt_style(theme[:caution], /^(.+)(check)(.+)$/, 2),
975
+ opt_style(theme[:warn], /^(.+)(error)(.+)$/, 2)
976
+ ])
977
+ end
978
+ end
979
+ else
980
+ cmd = session 'npm', 'publish'
981
+ cmd << basic_option('otp', otp) if otp ||= option('otp')
982
+ cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
983
+ case access || option('access')
984
+ when 'p', 'public'
985
+ cmd << '--access=public'
986
+ when 'r', 'restricted'
987
+ cmd << '--access=restricted'
988
+ end
989
+ dryrun ||= dryrun?('npm')
990
+ if dryrun
991
+ cmd << '--dry-run'
992
+ else
993
+ from = :'npm:publish'
994
+ log.info cmd.to_s
995
+ end
996
+ if sync
997
+ run(sync: sync, from: from, interactive: !dryrun && ['Publish', 'N', npmname])
998
+ else
999
+ require 'open3'
1000
+ on :first, from
1001
+ pwd_set(cmd, dryrun: dryrun) do
1002
+ cmd = session_done cmd
1003
+ Open3.popen2e(cmd) do |_, out|
1004
+ write_lines(out, banner: format_banner(cmd),
1005
+ sub: npmnotice(opt_style(color(:bright_blue), /^(.+)(Tarball .+)$/, 2)))
1006
+ end
1007
+ end
1008
+ on :last, from
923
1009
  end
924
1010
  end
925
- on :last, from
1011
+ elsif !workspace
1012
+ print_error("version: #{dependname}", subject: name, hint: 'not found')
926
1013
  end
927
1014
  end
928
1015
 
@@ -228,7 +228,7 @@ module Squared
228
228
  end
229
229
  next if found.anybits?(1)
230
230
 
231
- puts log_message(found == 0 ? Logger::INFO : Logger.WARN,
231
+ puts log_message(found == 0 ? Logger::INFO : Logger::WARN,
232
232
  "no scripts #{found == 0 ? 'found' : 'executed'}",
233
233
  subject: name, hint: pyprojectfile)
234
234
  end
@@ -614,7 +614,7 @@ module Squared
614
614
  op.clear
615
615
  when :user, :upgrade
616
616
  op.concat(packages)
617
- raise_error 'no packages listed', hint: flag if op.empty?
617
+ raise_error ArgumentError, 'no packages listed', hint: flag if op.empty?
618
618
  op << "--#{flag}"
619
619
  op.append
620
620
  python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
@@ -771,7 +771,7 @@ module Squared
771
771
  when :install, :uninstall
772
772
  op << '.' if installable? && !op.arg?('r', 'requirement')
773
773
  else
774
- raise_error 'no packages listed', hint: flag
774
+ raise_error ArgumentError, 'no packages listed', hint: flag
775
775
  end
776
776
  elsif flag == :install
777
777
  op.append_any
@@ -602,8 +602,8 @@ module Squared
602
602
  end
603
603
  pwd_set do
604
604
  out = []
605
- tool = args.name || (args.local && !SEM_VER.match?(args.local) ? args.local : 'ruby')
606
- trim = ->(s) { s[/^\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/^([a-z]+)-/i, '\1 ') }
605
+ tool = args.name || (s && !SEM_VER.match?(s) ? s : 'ruby')
606
+ trim = ->(val) { val[/^\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/^([a-z]+)-/i, '\1 ') }
607
607
  vm, bin = vmname(bin: true)
608
608
  out << trim.call(case vm
609
609
  when 'rvm'
@@ -689,10 +689,16 @@ module Squared
689
689
  .lines
690
690
  .map { |line| line.sub(/#.*$/, '').strip }
691
691
  .reject(&:empty?)
692
+ .yield_self do |data|
693
+ target = data.find { |line| line.include?(tool) }
694
+ target ? [target] : data
695
+ end
692
696
  .join(', ')
693
697
  end
694
698
  append.call(file, hint)
695
- throw :found if hint&.include?(out.first[/^(?:j|truffle)?ruby ([\d.]+)/, 1])
699
+ if hint&.include?(out.first[/^(?:(?:j|truffle)?ruby|#{tool}) ([\d.]+)/, 1])
700
+ throw :found
701
+ end
696
702
  rescue
697
703
  nil
698
704
  end
@@ -1639,6 +1645,9 @@ module Squared
1639
1645
 
1640
1646
  def serve(root, *, bind: nil, port: 3000, **kwargs)
1641
1647
  require 'webrick'
1648
+ rescue LoadError => e
1649
+ print_error(e, pass: true)
1650
+ else
1642
1651
  config = kwargs.merge({ DocumentRoot: root })
1643
1652
  config[:BindAddress] = bind if bind
1644
1653
  config[:Port] = port if port
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.7.5
4
+ version: 0.7.6
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: 4.0.6
128
+ rubygems_version: 4.0.11
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []