squared 0.5.16 → 0.5.17
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 +26 -0
- data/README.md +35 -26
- data/lib/squared/common/format.rb +8 -6
- data/lib/squared/common/shell.rb +5 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +2 -2
- data/lib/squared/workspace/project/base.rb +34 -36
- data/lib/squared/workspace/project/git.rb +18 -16
- data/lib/squared/workspace/project/node.rb +7 -6
- data/lib/squared/workspace/project/python.rb +4 -4
- data/lib/squared/workspace/project/ruby.rb +25 -27
- data/lib/squared/workspace/project/support/class.rb +23 -15
- data/lib/squared/workspace/repo.rb +2 -2
- data/lib/squared/workspace.rb +4 -2
- 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: 91dfb7530ecdb1ab70461ab8bbbf894e706ea6f78b5e9ada99c930d0819e9ec9
|
|
4
|
+
data.tar.gz: 82591aa893baf80057a3193e95763b8ce98c13593de54dffd00e31f0c27a3bf8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce78218f60162cda536062dc37e5f27f30b5cd25e1afcac502c3519085988594c01ea149b47ecd536373ba2f4312162d468915fd6792f27f15d1d301bf2e03eb
|
|
7
|
+
data.tar.gz: b0b6cec02ec4c531ddbabfa4ff1f3f8a87cf4592dd48fd86b74a8ac3787c602df165b0526cd69af8c585c221dcace1bcfc606a1bc511e3722f1e1b9cd1161e17
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.17] - 2025-11-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- See `0.4.31`.
|
|
8
|
+
|
|
9
|
+
## [0.4.31] - 2025-11-22
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Project base attribute project was converted into an accessor.
|
|
14
|
+
- Ruby command flag is given precedence to a program file.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Repo application tasks are not created on Windows.
|
|
19
|
+
- Repo module used conflicting REPO_URL with Repo application.
|
|
20
|
+
- Project task outdated did not check pass and only exclusions.
|
|
21
|
+
- Workspace static method resolve did nothing when given a String.
|
|
22
|
+
- Project base run command types did not include Struct.
|
|
23
|
+
- Project change directory context did not always restore when raised.
|
|
24
|
+
- Ruby file method attributes did not always return nil.
|
|
25
|
+
- JoinSet with a delimiter did not report correct size.
|
|
26
|
+
|
|
3
27
|
## [0.5.16] - 2025-11-14
|
|
4
28
|
|
|
5
29
|
### Fixed
|
|
@@ -1247,6 +1271,7 @@
|
|
|
1247
1271
|
|
|
1248
1272
|
- Changelog was created.
|
|
1249
1273
|
|
|
1274
|
+
[0.5.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.17
|
|
1250
1275
|
[0.5.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.16
|
|
1251
1276
|
[0.5.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.15
|
|
1252
1277
|
[0.5.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.14
|
|
@@ -1264,6 +1289,7 @@
|
|
|
1264
1289
|
[0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
|
|
1265
1290
|
[0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
|
|
1266
1291
|
[0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
|
|
1292
|
+
[0.4.31]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.31
|
|
1267
1293
|
[0.4.30]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.30
|
|
1268
1294
|
[0.4.29]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.29
|
|
1269
1295
|
[0.4.28]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.28
|
data/README.md
CHANGED
|
@@ -23,23 +23,9 @@ The range chart indicates the latest Ruby tested against at the time of release.
|
|
|
23
23
|
gem install squared
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
### Optional
|
|
27
|
-
|
|
28
|
-
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
|
29
|
-
* https://github.com/anpham6/squared-repo
|
|
30
|
-
* Python 3.6
|
|
31
|
-
* Not compatible with Windows
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
mkdir -p ~/.bin
|
|
35
|
-
PATH="${HOME}/.bin:${PATH}"
|
|
36
|
-
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
|
37
|
-
chmod a+rx ~/.bin/repo
|
|
38
|
-
```
|
|
39
|
-
|
|
40
26
|
## Example - Rakefile
|
|
41
27
|
|
|
42
|
-
Projects from any accessible folder can be added relative to the parent directory
|
|
28
|
+
Projects from any accessible folder can be added relative to the parent directory or absolutely. Missing projects will simply be excluded from the task runner.
|
|
43
29
|
|
|
44
30
|
```ruby
|
|
45
31
|
require "squared"
|
|
@@ -55,14 +41,6 @@ require "squared/app" # All workspace related mod
|
|
|
55
41
|
|
|
56
42
|
# NODE_ENV = production
|
|
57
43
|
|
|
58
|
-
# REPO_ROOT = /workspaces |
|
|
59
|
-
# REPO_HOME = /workspaces/squared | Dir.pwd
|
|
60
|
-
# rake = /workspaces/squared/Rakefile | main?
|
|
61
|
-
# OR
|
|
62
|
-
# REPO_ROOT = /workspaces | Dir.pwd
|
|
63
|
-
# rake = /workspaces/Rakefile |
|
|
64
|
-
# REPO_HOME = /workspaces/squared | main: "squared"
|
|
65
|
-
|
|
66
44
|
# pathname = /workspaces/pathname
|
|
67
45
|
# optparse = /workspaces/optparse
|
|
68
46
|
# log = /workspaces/logger
|
|
@@ -77,7 +55,6 @@ require "squared/app" # All workspace related mod
|
|
|
77
55
|
Workspace::Application
|
|
78
56
|
.new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
|
|
79
57
|
.banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
|
|
80
|
-
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
|
|
81
58
|
.run("rake install", ref: :ruby)
|
|
82
59
|
.depend(false, group: "default")
|
|
83
60
|
.clean("rake clean", group: "default")
|
|
@@ -730,7 +707,37 @@ Workspace::Application
|
|
|
730
707
|
|
|
731
708
|
### Repo
|
|
732
709
|
|
|
733
|
-
|
|
710
|
+
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
|
711
|
+
* https://github.com/anpham6/squared-repo
|
|
712
|
+
* Python 3.6
|
|
713
|
+
* Not compatible with Windows
|
|
714
|
+
|
|
715
|
+
```sh
|
|
716
|
+
mkdir -p ~/.bin
|
|
717
|
+
PATH="${HOME}/.bin:${PATH}"
|
|
718
|
+
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
|
719
|
+
chmod a+rx ~/.bin/repo
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
```ruby
|
|
723
|
+
# REPO_ROOT = /workspaces |
|
|
724
|
+
# REPO_HOME = /workspaces/squared | Dir.pwd
|
|
725
|
+
# rake = /workspaces/squared/Rakefile | main?
|
|
726
|
+
#
|
|
727
|
+
# OR
|
|
728
|
+
#
|
|
729
|
+
# REPO_ROOT = /workspaces | Dir.pwd
|
|
730
|
+
# rake = /workspaces/Rakefile |
|
|
731
|
+
# REPO_HOME = /workspaces/squared | main: "squared"
|
|
732
|
+
|
|
733
|
+
Workspace::Application
|
|
734
|
+
.new(main: "squared")
|
|
735
|
+
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "prod"], ref: :node)
|
|
736
|
+
.add("squared", script: ["build:stage1", "build:stage2"])
|
|
737
|
+
.build
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
These global options also can target the application main suffix `${NAME}`. (e.g. *REPO_ROOT_SQUARED*)
|
|
734
741
|
|
|
735
742
|
```sh
|
|
736
743
|
REPO_ROOT # parent dir
|
|
@@ -742,7 +749,7 @@ REPO_DEV # pattern,0,1
|
|
|
742
749
|
REPO_PROD # pattern,0,1
|
|
743
750
|
REPO_WARN # 0,1
|
|
744
751
|
REPO_SYNC # 0,1
|
|
745
|
-
|
|
752
|
+
REPO_GIT # manifest repository
|
|
746
753
|
REPO_MANIFEST # e.g. latest,nightly,prod
|
|
747
754
|
REPO_GROUPS # e.g. base,prod,docs
|
|
748
755
|
REPO_STAGE # 0,1,2,3,4
|
|
@@ -750,6 +757,8 @@ REPO_SUBMODULLES # 0,1
|
|
|
750
757
|
REPO_TIMEOUT # confirm dialog (seconds)
|
|
751
758
|
```
|
|
752
759
|
|
|
760
|
+
Other similarly cloned `Repo` repositories can be managed remotely by setting the `REPO_ROOT` environment variable to the location.
|
|
761
|
+
|
|
753
762
|
## LICENSE
|
|
754
763
|
|
|
755
764
|
BSD 3-Clause
|
|
@@ -67,6 +67,7 @@ module Squared
|
|
|
67
67
|
end
|
|
68
68
|
wrap = ->(s, n) { "\x1B[#{n.join(';')}m#{s}\x1B[0m" }
|
|
69
69
|
code = []
|
|
70
|
+
args.clear if args.size == 1 && args.first.nil?
|
|
70
71
|
args.concat(Array(styles)).flatten.each_with_index do |type, i|
|
|
71
72
|
next unless type
|
|
72
73
|
|
|
@@ -180,19 +181,20 @@ module Squared
|
|
|
180
181
|
args = args.map(&:to_s)
|
|
181
182
|
if level.is_a?(::Numeric)
|
|
182
183
|
if append && respond_to?(:log)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
end
|
|
184
|
+
ref = log rescue nil
|
|
185
|
+
ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(::Logger)
|
|
186
186
|
end
|
|
187
|
-
return false
|
|
187
|
+
return false unless pass || level >= ARG[:LEVEL]
|
|
188
188
|
end
|
|
189
|
-
if
|
|
189
|
+
if hint.nil? ? args.size > 1 : !hint
|
|
190
190
|
title = log_title(level, color: false)
|
|
191
191
|
sub = [pat: /\A(#{Regexp.escape(title)})(.*)\z/m, styles: __get__(:theme)[:logger][log_sym(level)]] if color
|
|
192
192
|
emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub, pipe: -1)
|
|
193
193
|
else
|
|
194
194
|
msg = [log_title(level, color: color)]
|
|
195
|
-
|
|
195
|
+
if subject
|
|
196
|
+
msg << (color ? sub_style(subject.to_s, (@theme.is_a?(::Hash) && @theme[:subject]) || :bold) : subject)
|
|
197
|
+
end
|
|
196
198
|
msg << args.shift if msg.size == 1
|
|
197
199
|
message(msg.join(' '), *args, hint: hint)
|
|
198
200
|
end
|
data/lib/squared/common/shell.rb
CHANGED
data/lib/squared/version.rb
CHANGED
|
@@ -497,7 +497,7 @@ module Squared
|
|
|
497
497
|
if (base = task_base?(key))
|
|
498
498
|
tasks << key if obj.has?(key, baseref)
|
|
499
499
|
elsif (batch = series.batch_get(key))
|
|
500
|
-
obj.allref
|
|
500
|
+
obj.allref do |ref|
|
|
501
501
|
next unless obj.has?(key, ref) && (data = batch[ref])
|
|
502
502
|
|
|
503
503
|
data.each do |val|
|
|
@@ -516,7 +516,7 @@ module Squared
|
|
|
516
516
|
if tasks.empty?
|
|
517
517
|
return [] if (base && !obj.ref?(baseref)) || !(data = series.alias_get(key))
|
|
518
518
|
|
|
519
|
-
obj.allref
|
|
519
|
+
obj.allref do |ref|
|
|
520
520
|
next unless obj.has?(key, ref) && (alt = data[ref])
|
|
521
521
|
|
|
522
522
|
ret = task_resolve obj, alt
|
|
@@ -80,9 +80,9 @@ module Squared
|
|
|
80
80
|
'asdf' => %i[set exec current]
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
attr_reader :name, :
|
|
83
|
+
attr_reader :name, :workspace, :path, :theme, :group, :parent, :dependfile,
|
|
84
84
|
:exception, :pipe, :verbose
|
|
85
|
-
attr_accessor :global
|
|
85
|
+
attr_accessor :global, :project
|
|
86
86
|
|
|
87
87
|
def initialize(workspace, path, name, *, group: nil, first: {}, last: {}, error: {}, common: ARG[:COMMON],
|
|
88
88
|
**kwargs)
|
|
@@ -1075,8 +1075,8 @@ module Squared
|
|
|
1075
1075
|
@log = Logger.new(enabled? ? @log.first : nil, **@log.last)
|
|
1076
1076
|
end
|
|
1077
1077
|
|
|
1078
|
-
def allref
|
|
1079
|
-
@ref.reverse_each
|
|
1078
|
+
def allref(&blk)
|
|
1079
|
+
@ref.reverse_each(&blk)
|
|
1080
1080
|
end
|
|
1081
1081
|
|
|
1082
1082
|
def basepath(*args)
|
|
@@ -1090,7 +1090,7 @@ module Squared
|
|
|
1090
1090
|
path.parent.ascend.each do |dir|
|
|
1091
1091
|
target = dir.join(*args)
|
|
1092
1092
|
return target if target.exist?
|
|
1093
|
-
break if (ascend && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
|
|
1093
|
+
break if (ascend.is_a?(String) && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
|
|
1094
1094
|
end
|
|
1095
1095
|
ret
|
|
1096
1096
|
end
|
|
@@ -1356,7 +1356,9 @@ module Squared
|
|
|
1356
1356
|
end
|
|
1357
1357
|
|
|
1358
1358
|
def print_error(*args, loglevel: Logger::WARN, **kwargs)
|
|
1359
|
-
|
|
1359
|
+
return unless warning?
|
|
1360
|
+
|
|
1361
|
+
warn log_message(loglevel, *args, **kwargs)
|
|
1360
1362
|
end
|
|
1361
1363
|
|
|
1362
1364
|
def print_item(*val, series: true)
|
|
@@ -1509,8 +1511,8 @@ module Squared
|
|
|
1509
1511
|
"#{msg}#{!always && (!obj || obj == 0 || obj.to_s.empty?) ? '' : message(hint: message(title, obj.to_s))}"
|
|
1510
1512
|
end
|
|
1511
1513
|
|
|
1512
|
-
def append_repeat(flag, opts, target: @session)
|
|
1513
|
-
opts.each { |val| target << shell_option(flag, val) }
|
|
1514
|
+
def append_repeat(flag, opts, target: @session, **kwargs)
|
|
1515
|
+
opts.each { |val| target << shell_option(flag, val, **kwargs) }
|
|
1514
1516
|
end
|
|
1515
1517
|
|
|
1516
1518
|
def append_hash(data, target: @session || [], build: false)
|
|
@@ -1536,6 +1538,8 @@ module Squared
|
|
|
1536
1538
|
target << basic_option(key, val)
|
|
1537
1539
|
when FalseClass
|
|
1538
1540
|
target << shell_option(key).sub(/^--(?!no-)/, '--no-')
|
|
1541
|
+
when Pathname
|
|
1542
|
+
target << shell_option(key, val, escape: false)
|
|
1539
1543
|
else
|
|
1540
1544
|
target << shell_option(key, val.is_a?(String) ? val : nil)
|
|
1541
1545
|
end
|
|
@@ -1594,18 +1598,18 @@ module Squared
|
|
|
1594
1598
|
return if list.empty?
|
|
1595
1599
|
|
|
1596
1600
|
kwargs[:ignore] = false if no && !kwargs.key?(:ignore)
|
|
1597
|
-
[]
|
|
1598
|
-
|
|
1599
|
-
|
|
1601
|
+
ret = []
|
|
1602
|
+
list.flatten.each do |flag|
|
|
1603
|
+
next unless (val = option(flag, target: target, **kwargs))
|
|
1600
1604
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
end
|
|
1605
|
-
ret << shell_option(flag, equals ? val : nil, escape: escape, quote: quote, force: force)
|
|
1605
|
+
if no && val == '0'
|
|
1606
|
+
flag = "no-#{flag}"
|
|
1607
|
+
val = nil
|
|
1606
1608
|
end
|
|
1607
|
-
ret
|
|
1609
|
+
ret << shell_option(flag, equals ? val : nil, escape: escape, quote: quote, force: force)
|
|
1608
1610
|
end
|
|
1611
|
+
ret.each { |val| target << val } unless ret.empty?
|
|
1612
|
+
ret
|
|
1609
1613
|
end
|
|
1610
1614
|
|
|
1611
1615
|
def append_nocolor(target: @session)
|
|
@@ -1653,9 +1657,9 @@ module Squared
|
|
|
1653
1657
|
end
|
|
1654
1658
|
|
|
1655
1659
|
def collect_hash(data, pass: [])
|
|
1656
|
-
[]
|
|
1657
|
-
|
|
1658
|
-
|
|
1660
|
+
ret = []
|
|
1661
|
+
data.each { |key, val| ret.concat(val) unless pass.include?(key) }
|
|
1662
|
+
ret
|
|
1659
1663
|
end
|
|
1660
1664
|
|
|
1661
1665
|
def parse_json(val, kind: Hash, hint: nil)
|
|
@@ -1908,16 +1912,15 @@ module Squared
|
|
|
1908
1912
|
end
|
|
1909
1913
|
|
|
1910
1914
|
def pwd_set(pass: false, dryrun: false, from: nil)
|
|
1911
|
-
|
|
1912
|
-
return yield if (path.to_s == pwd || pass == true) && (workspace.mri? || !workspace.windows?)
|
|
1915
|
+
return yield if (path.to_s == Dir.pwd || pass == true) && (workspace.mri? || !workspace.windows?)
|
|
1913
1916
|
|
|
1914
|
-
Dir.
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
+
pwd = Dir.pwd
|
|
1918
|
+
Dir.chdir(path)
|
|
1919
|
+
yield
|
|
1917
1920
|
rescue StandardError => e
|
|
1918
1921
|
on_error(e, from, dryrun: dryrun)
|
|
1919
|
-
|
|
1920
|
-
|
|
1922
|
+
ensure
|
|
1923
|
+
Dir.chdir(pwd) if pwd
|
|
1921
1924
|
end
|
|
1922
1925
|
|
|
1923
1926
|
def run_set(cmd, val = nil, opts: nil, **)
|
|
@@ -2097,7 +2100,7 @@ module Squared
|
|
|
2097
2100
|
|
|
2098
2101
|
def runnable?(val)
|
|
2099
2102
|
case val
|
|
2100
|
-
when String, Enumerable, Proc, Method
|
|
2103
|
+
when String, Enumerable, Proc, Method, Struct
|
|
2101
2104
|
true
|
|
2102
2105
|
else
|
|
2103
2106
|
false
|
|
@@ -2159,14 +2162,9 @@ module Squared
|
|
|
2159
2162
|
end
|
|
2160
2163
|
|
|
2161
2164
|
def has_value?(data, other)
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
when Enumerable
|
|
2166
|
-
other.is_a?(Enumerable) ? other.any? { |obj| data.include?(obj) } : data.include?(other)
|
|
2167
|
-
else
|
|
2168
|
-
false
|
|
2169
|
-
end
|
|
2165
|
+
return false unless data.is_a?(Enumerable)
|
|
2166
|
+
|
|
2167
|
+
other.is_a?(Enumerable) ? other.any? { |obj,| data.include?(obj) } : data.include?(other)
|
|
2170
2168
|
end
|
|
2171
2169
|
|
|
2172
2170
|
def variables
|
|
@@ -134,7 +134,7 @@ module Squared
|
|
|
134
134
|
File.write(@revfile, JSON.pretty_generate(@revdoc))
|
|
135
135
|
rescue StandardError => e
|
|
136
136
|
log&.debug e
|
|
137
|
-
warn log_message(Logger::WARN, e, pass: true) if warning
|
|
137
|
+
warn log_message(Logger::WARN, e, pass: true) if warning
|
|
138
138
|
ensure
|
|
139
139
|
@revlock = false
|
|
140
140
|
end
|
|
@@ -1494,7 +1494,8 @@ module Squared
|
|
|
1494
1494
|
case flag
|
|
1495
1495
|
when :commit, :'no-commit'
|
|
1496
1496
|
op = OptionPartition.new(opts, OPT_GIT[:merge], cmd, project: self, no: OPT_GIT[:no][:merge])
|
|
1497
|
-
op << "--#{flag}"
|
|
1497
|
+
op << "--#{flag}"
|
|
1498
|
+
op.delim
|
|
1498
1499
|
if branch
|
|
1499
1500
|
op << branch
|
|
1500
1501
|
op.clear(pass: false)
|
|
@@ -1699,7 +1700,7 @@ module Squared
|
|
|
1699
1700
|
cmd, opts = git_session('rev-parse', opts: opts)
|
|
1700
1701
|
case flag
|
|
1701
1702
|
when :commit
|
|
1702
|
-
cmd << (
|
|
1703
|
+
cmd << (size.to_i.zero? ? '--verify' : basic_option('short', [size.to_i, 5].max))
|
|
1703
1704
|
append_commit(ref, head: true)
|
|
1704
1705
|
when :branch
|
|
1705
1706
|
cmd << '--abbrev-ref'
|
|
@@ -1748,7 +1749,7 @@ module Squared
|
|
|
1748
1749
|
case flag
|
|
1749
1750
|
when :blame
|
|
1750
1751
|
raise_error 'no file found' unless (n = op.index { |s| basepath(s).file? })
|
|
1751
|
-
op <<
|
|
1752
|
+
op.delim << shell_quote(basepath(op.delete_at(n)))
|
|
1752
1753
|
op.clear
|
|
1753
1754
|
when :revert
|
|
1754
1755
|
if VAL_GIT[:rebase][:send].any? { |val| op.arg?(val) }
|
|
@@ -1763,12 +1764,11 @@ module Squared
|
|
|
1763
1764
|
grep, list = op.partition { |val| OptionPartition.pattern?(val) }
|
|
1764
1765
|
unless grep.empty? && !list.empty?
|
|
1765
1766
|
grep.map! { |val| Regexp.new(val[1..-2]) }
|
|
1766
|
-
files = []
|
|
1767
|
-
|
|
1768
|
-
|
|
1767
|
+
files = []
|
|
1768
|
+
status_data.each do |a, b|
|
|
1769
|
+
next if b.strip.empty? || (!grep.empty? && grep.none? { |pat| pat.match?(a) })
|
|
1769
1770
|
|
|
1770
|
-
|
|
1771
|
-
end
|
|
1771
|
+
files << "#{sub_style(b, styles: color(:red))} #{a}"
|
|
1772
1772
|
end
|
|
1773
1773
|
unless files.empty?
|
|
1774
1774
|
files = choice_index('Select files', files, multiple: true, force: true, trim: /^\S+\s/,
|
|
@@ -1924,7 +1924,7 @@ module Squared
|
|
|
1924
1924
|
end
|
|
1925
1925
|
args = []
|
|
1926
1926
|
args << quote_option('sort', sort) if sort
|
|
1927
|
-
args <<
|
|
1927
|
+
args << basic_option('count', env('GIT_COUNT', ARG[:CHOICE])) if count
|
|
1928
1928
|
choice_index(msg, foreachref(type, *args, format: format), trim: trim, **kwargs)
|
|
1929
1929
|
end
|
|
1930
1930
|
|
|
@@ -1957,13 +1957,13 @@ module Squared
|
|
|
1957
1957
|
end
|
|
1958
1958
|
|
|
1959
1959
|
def status_data(*args)
|
|
1960
|
-
[]
|
|
1961
|
-
|
|
1962
|
-
|
|
1960
|
+
ret = []
|
|
1961
|
+
git_spawn('status -z -uall', *args).split("\x0").each do |line|
|
|
1962
|
+
next unless line =~ /^(.)(.) (.+)$/
|
|
1963
1963
|
|
|
1964
|
-
|
|
1965
|
-
end
|
|
1964
|
+
ret << [$3, $2, $1]
|
|
1966
1965
|
end
|
|
1966
|
+
ret
|
|
1967
1967
|
end
|
|
1968
1968
|
|
|
1969
1969
|
def append_pull(opts, list, target: @session, flag: nil, no: nil, remote: nil, from: nil)
|
|
@@ -2038,7 +2038,9 @@ module Squared
|
|
|
2038
2038
|
|
|
2039
2039
|
def append_message(val = nil, target: @session)
|
|
2040
2040
|
val = messageopt if val.to_s.empty?
|
|
2041
|
-
|
|
2041
|
+
return unless val
|
|
2042
|
+
|
|
2043
|
+
target << quote_option('message', val)
|
|
2042
2044
|
end
|
|
2043
2045
|
|
|
2044
2046
|
def append_head(val = nil, target: @session)
|
|
@@ -160,7 +160,8 @@ module Squared
|
|
|
160
160
|
elsif exception
|
|
161
161
|
indexerror n, list
|
|
162
162
|
else
|
|
163
|
-
|
|
163
|
+
log.warn "run script #{n} of #{list.size} (out of range)"
|
|
164
|
+
next
|
|
164
165
|
end
|
|
165
166
|
else
|
|
166
167
|
opts << val
|
|
@@ -198,11 +199,11 @@ module Squared
|
|
|
198
199
|
if op.empty?
|
|
199
200
|
op << package
|
|
200
201
|
if (args = readline('Enter arguments', force: false))
|
|
201
|
-
op
|
|
202
|
+
op.delim unless pnpm?
|
|
202
203
|
op << args
|
|
203
204
|
end
|
|
204
205
|
else
|
|
205
|
-
op
|
|
206
|
+
op.delim unless pnpm?
|
|
206
207
|
op << package << op.join(' ')
|
|
207
208
|
end
|
|
208
209
|
else
|
|
@@ -281,6 +282,8 @@ module Squared
|
|
|
281
282
|
|
|
282
283
|
def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil, files: nil, workspace: false,
|
|
283
284
|
link: false, force: false, override: false, sync: invoked_sync?('copy'), **kwargs)
|
|
285
|
+
return if @copy == false
|
|
286
|
+
|
|
284
287
|
glob = kwargs[:include]
|
|
285
288
|
pass = kwargs[:exclude]
|
|
286
289
|
if @copy && !override
|
|
@@ -297,8 +300,6 @@ module Squared
|
|
|
297
300
|
create = @copy[:create] if @copy.key?(:create)
|
|
298
301
|
glob = @copy[:include] if @copy.key?(:include)
|
|
299
302
|
pass = @copy[:exclude] if @copy.key?(:exclude)
|
|
300
|
-
elsif @copy == false
|
|
301
|
-
return
|
|
302
303
|
end
|
|
303
304
|
items = []
|
|
304
305
|
if build? && path != @workspace.home && @workspace.home?
|
|
@@ -864,7 +865,7 @@ module Squared
|
|
|
864
865
|
end
|
|
865
866
|
|
|
866
867
|
def outdated?
|
|
867
|
-
dependfile.exist?
|
|
868
|
+
dependfile.exist? && !task_pass?('outdated')
|
|
868
869
|
end
|
|
869
870
|
|
|
870
871
|
def update?
|
|
@@ -624,7 +624,7 @@ module Squared
|
|
|
624
624
|
end
|
|
625
625
|
|
|
626
626
|
def outdated?
|
|
627
|
-
dependtype > 0
|
|
627
|
+
dependtype > 0 && !task_pass?('outdated')
|
|
628
628
|
end
|
|
629
629
|
|
|
630
630
|
private
|
|
@@ -636,7 +636,7 @@ module Squared
|
|
|
636
636
|
def python_session(*cmd, opts: nil)
|
|
637
637
|
return session('python', *preopts(quiet: false), *cmd, path: venv.nil?) unless opts
|
|
638
638
|
|
|
639
|
-
op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single:
|
|
639
|
+
op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: singleopt(:python))
|
|
640
640
|
ret = session('python', *op.to_a, *cmd, path: venv.nil?)
|
|
641
641
|
[ret, op.extras]
|
|
642
642
|
end
|
|
@@ -733,7 +733,7 @@ module Squared
|
|
|
733
733
|
quote_option('cache-dir', basepath(val))
|
|
734
734
|
end
|
|
735
735
|
end
|
|
736
|
-
option('proxy', target: target) { |val| target <<
|
|
736
|
+
option('proxy', target: target) { |val| target << quote_option('proxy', val) }
|
|
737
737
|
option('python', target: target) { |val| target << quote_option('python', basepath(val)) }
|
|
738
738
|
append_nocolor(target: target)
|
|
739
739
|
end
|
|
@@ -814,7 +814,7 @@ module Squared
|
|
|
814
814
|
def singleopt(flag = nil)
|
|
815
815
|
case flag
|
|
816
816
|
when :python
|
|
817
|
-
/\A(?:v+|q+|b+)\z/
|
|
817
|
+
/\A(?:v+|q+|b+|V+|O+)\z/
|
|
818
818
|
when :twine
|
|
819
819
|
nil
|
|
820
820
|
else
|
|
@@ -294,6 +294,8 @@ module Squared
|
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
def copy(from: gemlib, into: @gemdir, override: false, **kwargs)
|
|
297
|
+
return if @copy == false
|
|
298
|
+
|
|
297
299
|
glob = kwargs[:include]
|
|
298
300
|
pass = kwargs[:exclude]
|
|
299
301
|
if @copy && !override
|
|
@@ -303,8 +305,6 @@ module Squared
|
|
|
303
305
|
glob = @copy[:include] if @copy.key?(:include)
|
|
304
306
|
pass = @copy[:exclude] if @copy.key?(:exclude)
|
|
305
307
|
into = @copy[:into] if @copy.key?(:into)
|
|
306
|
-
elsif @copy == false
|
|
307
|
-
return
|
|
308
308
|
end
|
|
309
309
|
return unless into
|
|
310
310
|
|
|
@@ -468,13 +468,15 @@ module Squared
|
|
|
468
468
|
case flag
|
|
469
469
|
when :file, :script
|
|
470
470
|
op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, args: true)
|
|
471
|
-
if
|
|
472
|
-
op.unshift(shell_quote(basepath(file)))
|
|
473
|
-
elsif command
|
|
471
|
+
if command
|
|
474
472
|
op << quote_option('e', command, option: false)
|
|
473
|
+
elsif file
|
|
474
|
+
op.unshift(basepath(file))
|
|
475
|
+
end
|
|
476
|
+
unless op.arg?('e')
|
|
477
|
+
op.push(args) if args
|
|
478
|
+
op.append(delim: true, escape: false, quote: false) unless op.empty?
|
|
475
479
|
end
|
|
476
|
-
op.push(args) if args
|
|
477
|
-
op.append(delim: true, escape: false, quote: false) unless op.empty?
|
|
478
480
|
when :version
|
|
479
481
|
pwd_set do
|
|
480
482
|
out = []
|
|
@@ -801,7 +803,7 @@ module Squared
|
|
|
801
803
|
else
|
|
802
804
|
[name[0, n], name[(n + 1)..-1]]
|
|
803
805
|
end
|
|
804
|
-
op.adjoin(pre,
|
|
806
|
+
op.adjoin(pre, basic_option('version', ver))
|
|
805
807
|
.clear
|
|
806
808
|
elsif flag == :install
|
|
807
809
|
op.append_any
|
|
@@ -809,7 +811,7 @@ module Squared
|
|
|
809
811
|
op.append
|
|
810
812
|
end
|
|
811
813
|
op.clear(errors: true)
|
|
812
|
-
op <<
|
|
814
|
+
op.delim << readline('Enter command [args]', force: true) if flag == :install && op.remove(':')
|
|
813
815
|
else
|
|
814
816
|
op.append
|
|
815
817
|
end
|
|
@@ -857,7 +859,7 @@ module Squared
|
|
|
857
859
|
r.each { |val| op << shell_option('r', val, merge: true) }
|
|
858
860
|
Array(path).each { |val| op << quote_option('I', val, merge: true) }
|
|
859
861
|
if args
|
|
860
|
-
op <<
|
|
862
|
+
op.delim << args
|
|
861
863
|
op.clear
|
|
862
864
|
else
|
|
863
865
|
op.append(delim: true)
|
|
@@ -866,13 +868,8 @@ module Squared
|
|
|
866
868
|
end
|
|
867
869
|
|
|
868
870
|
def gemspec
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
@gemspec = if gemfile
|
|
872
|
-
Gem::Specification.load(gemfile.to_s) rescue false
|
|
873
|
-
else
|
|
874
|
-
false
|
|
875
|
-
end
|
|
871
|
+
@gemspec = !gemfile.nil? && Gem::Specification.load(gemfile.to_s) rescue false if @gemspec.nil?
|
|
872
|
+
@gemspec || nil
|
|
876
873
|
end
|
|
877
874
|
|
|
878
875
|
def gemname
|
|
@@ -962,7 +959,7 @@ module Squared
|
|
|
962
959
|
end
|
|
963
960
|
|
|
964
961
|
def outdated?
|
|
965
|
-
dependtype > 0
|
|
962
|
+
dependtype > 0 && !task_pass?('outdated')
|
|
966
963
|
end
|
|
967
964
|
|
|
968
965
|
private
|
|
@@ -1054,11 +1051,11 @@ module Squared
|
|
|
1054
1051
|
end
|
|
1055
1052
|
|
|
1056
1053
|
def rakefile
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
file ? basepath(file) : false
|
|
1054
|
+
if @rakefile.nil?
|
|
1055
|
+
file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
|
|
1056
|
+
@rakefile = !file.nil? && basepath(file)
|
|
1061
1057
|
end
|
|
1058
|
+
@rakefile || nil
|
|
1062
1059
|
end
|
|
1063
1060
|
|
|
1064
1061
|
def rakepwd
|
|
@@ -1087,11 +1084,12 @@ module Squared
|
|
|
1087
1084
|
end
|
|
1088
1085
|
|
|
1089
1086
|
def gemfile
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1087
|
+
if @gemfile.nil?
|
|
1088
|
+
@gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
|
|
1089
|
+
.concat(path.glob('*.gemspec'))
|
|
1090
|
+
.find(&:exist?) || false
|
|
1091
|
+
end
|
|
1092
|
+
@gemfile || nil
|
|
1095
1093
|
end
|
|
1096
1094
|
|
|
1097
1095
|
def gemlib
|
|
@@ -29,15 +29,15 @@ module Squared
|
|
|
29
29
|
pat, s = Array(strip)
|
|
30
30
|
ret.map! { |val| val.is_a?(String) ? val.gsub(pat, s || '') : val }
|
|
31
31
|
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
ret.map! do |val|
|
|
33
|
+
next val if opt?(val)
|
|
34
|
+
|
|
35
|
+
if quote || val.is_a?(Pathname)
|
|
36
|
+
shell_quote(val, force: force, double: double)
|
|
37
|
+
elsif escape
|
|
38
|
+
shell_escape(val, quote: quote, double: double)
|
|
39
|
+
else
|
|
40
|
+
val
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
if target.is_a?(Set)
|
|
@@ -431,6 +431,11 @@ module Squared
|
|
|
431
431
|
self
|
|
432
432
|
end
|
|
433
433
|
|
|
434
|
+
def delim
|
|
435
|
+
add '--'
|
|
436
|
+
self
|
|
437
|
+
end
|
|
438
|
+
|
|
434
439
|
def splice(*exclude, quote: true, delim: true, path: false, pattern: false, &blk)
|
|
435
440
|
found, other = if block_given?
|
|
436
441
|
partition(&blk)
|
|
@@ -632,8 +637,8 @@ module Squared
|
|
|
632
637
|
extras!(obj) || super
|
|
633
638
|
end
|
|
634
639
|
|
|
635
|
-
def
|
|
636
|
-
|
|
640
|
+
def size
|
|
641
|
+
super + extras.size
|
|
637
642
|
end
|
|
638
643
|
|
|
639
644
|
def to_a
|
|
@@ -641,21 +646,24 @@ module Squared
|
|
|
641
646
|
end
|
|
642
647
|
|
|
643
648
|
def to_s
|
|
644
|
-
|
|
649
|
+
to_a.join(@delim)
|
|
645
650
|
end
|
|
646
651
|
|
|
647
652
|
def to_enum(*args)
|
|
648
|
-
|
|
653
|
+
to_a.to_enum(*args)
|
|
649
654
|
end
|
|
650
655
|
|
|
651
656
|
def to_json(*args)
|
|
652
|
-
|
|
657
|
+
to_a.to_json(*args)
|
|
653
658
|
end
|
|
654
659
|
|
|
655
660
|
def to_yaml(*args)
|
|
656
|
-
|
|
661
|
+
to_a.to_yaml(*args)
|
|
657
662
|
end
|
|
658
663
|
|
|
664
|
+
alias add :<<
|
|
665
|
+
alias add? :<<
|
|
666
|
+
|
|
659
667
|
private
|
|
660
668
|
|
|
661
669
|
def extras!(obj)
|
|
@@ -158,7 +158,7 @@ module Squared
|
|
|
158
158
|
desc.call("init[manifest?=#{target},groups?,{0}]", target)
|
|
159
159
|
task 'init' do |_, args|
|
|
160
160
|
args = args.to_a
|
|
161
|
-
u = env('
|
|
161
|
+
u = env('REPO_GIT') || manifest_url
|
|
162
162
|
m = args.first && !opts.include?(args.first) ? args.shift : target
|
|
163
163
|
g = args.first && !opts.include?(args.first) ? args.shift : nil
|
|
164
164
|
g = case (val = env('REPO_GROUPS'))
|
|
@@ -251,7 +251,7 @@ module Squared
|
|
|
251
251
|
end
|
|
252
252
|
|
|
253
253
|
def repo?
|
|
254
|
-
return false unless manifest_url
|
|
254
|
+
return false unless manifest_url && !windows?
|
|
255
255
|
|
|
256
256
|
repo_install? || @repo_override == true
|
|
257
257
|
end
|
data/lib/squared/workspace.rb
CHANGED
|
@@ -5,12 +5,14 @@ module Squared
|
|
|
5
5
|
class << self
|
|
6
6
|
include Common
|
|
7
7
|
|
|
8
|
-
def resolve(*args)
|
|
8
|
+
def resolve(*args, base: '..')
|
|
9
|
+
values = __get__(:project).values
|
|
9
10
|
ret = args.map do |id|
|
|
10
11
|
if id.is_a?(Symbol)
|
|
11
12
|
project id
|
|
12
13
|
else
|
|
13
|
-
|
|
14
|
+
values.find { |proj| proj.name == id } || values.find { |proj| proj.project == id } ||
|
|
15
|
+
values.find { |proj| proj.path.to_s == File.expand_path(id, base) }
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
ret.size == 1 ? ret.first : ret
|
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.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- An Pham
|
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
125
|
version: '0'
|
|
126
126
|
requirements: []
|
|
127
|
-
rubygems_version: 3.
|
|
127
|
+
rubygems_version: 3.6.9
|
|
128
128
|
specification_version: 4
|
|
129
129
|
summary: Rake task generator for managing multi-language workspaces.
|
|
130
130
|
test_files: []
|