squared 0.2.7 → 0.2.9
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 +29 -0
- data/lib/squared/common/format.rb +4 -0
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +1 -1
- data/lib/squared/workspace/project/base.rb +26 -20
- data/lib/squared/workspace/project/git.rb +13 -10
- data/lib/squared/workspace/project/python.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da84184d479e255a0a9916bfa33d081259b3965fb61ab40f32f7417fad7751b5
|
4
|
+
data.tar.gz: 9dceba3df95cf08e724c13f0ab63c7ba607f7253e2cefe5f5ebab78858c58c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bed08c89a0f41d484b8d18d951abbd1386b1138365ab0f9add293ec81865303c3e6861ec6cb8a6326e3e91c1b2692fad6ceb64b11410c5f4df8015f3da1226d7
|
7
|
+
data.tar.gz: fc545d2ecb6a324d3a1d4869d73223d5122b15517268e248d5cbda19be39e4ddcfb5fb07627d090c9010334e7747f7121c8e6b8dbce7c2ca08f44131263a6681
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.2.9] - 2025-04-17
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
- Project log file naming supports more date formats.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Environment options did not always pass session object.
|
12
|
+
- Git command pull actions used unknown flags.
|
13
|
+
- Workspace describe did not merge multiple invocations.
|
14
|
+
|
15
|
+
## [0.1.6] - 2025-04-17
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Project path validation did not include separator.
|
20
|
+
|
21
|
+
## [0.2.8] - 2025-04-12
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- User-defined program paths were not sanitized for ENV.
|
26
|
+
- Project clean task used incompatible rmtree flag.
|
27
|
+
- Git branch unset-upstream used undefined variable.
|
28
|
+
|
3
29
|
## [0.2.7] - 2025-04-08
|
4
30
|
|
5
31
|
### Fixed
|
@@ -226,6 +252,8 @@
|
|
226
252
|
|
227
253
|
- Changelog was created.
|
228
254
|
|
255
|
+
[0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
|
256
|
+
[0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
|
229
257
|
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
230
258
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
231
259
|
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
@@ -234,6 +262,7 @@
|
|
234
262
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
235
263
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
236
264
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
265
|
+
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
237
266
|
[0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
|
238
267
|
[0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
|
239
268
|
[0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
|
@@ -274,6 +274,10 @@ module Squared
|
|
274
274
|
val.gsub(/\x1B\[(\d+;?)+m/, '')
|
275
275
|
end
|
276
276
|
|
277
|
+
def stripext(val)
|
278
|
+
File.basename(val, File.extname(val))
|
279
|
+
end
|
280
|
+
|
277
281
|
def raise_error(*args, hint: nil, kind: ArgumentError)
|
278
282
|
raise kind, message(*args, hint: hint, empty: true), caller_locations(1).map(&:to_s)
|
279
283
|
end
|
data/lib/squared/version.rb
CHANGED
@@ -163,19 +163,24 @@ module Squared
|
|
163
163
|
return if @log
|
164
164
|
|
165
165
|
log = log.is_a?(Hash) ? log.dup : { file: log }
|
166
|
-
|
167
|
-
file =
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
166
|
+
if (file = env('LOG_FILE'))
|
167
|
+
file = DateTime.now.strftime(file)
|
168
|
+
elsif (val = env('LOG_AUTO'))
|
169
|
+
file = "#{@name}-%s.log" % [case val
|
170
|
+
when 'y', 'year'
|
171
|
+
Date.today.year
|
172
|
+
when 'm', 'month'
|
173
|
+
Date.today.strftime('%Y-%m')
|
174
|
+
when 'd', 'day', '1'
|
175
|
+
Date.today
|
176
|
+
else
|
177
|
+
val.include?('%') ? DateTime.now.strftime(val) : DateTime.now.strftime
|
178
|
+
end]
|
179
|
+
elsif (val = log[:file])
|
180
|
+
file = val.is_a?(String) ? DateTime.now.strftime(val) : "#{@name}-#{Date.today}.log"
|
175
181
|
end
|
176
|
-
if file
|
177
|
-
file =
|
178
|
-
file = (dir = env('LOG_DIR')) ? @workspace.home.join(dir, file) : @workspace.home.join(file)
|
182
|
+
if file
|
183
|
+
file = (val = env('LOG_DIR')) ? @workspace.home.join(val, file) : @workspace.home.join(file)
|
179
184
|
begin
|
180
185
|
file = file.realdirpath
|
181
186
|
rescue StandardError => e
|
@@ -412,7 +417,7 @@ module Squared
|
|
412
417
|
path = basepath(val)
|
413
418
|
if path.directory? && val =~ %r{[\\/]\z}
|
414
419
|
log&.warn "rm -rf #{path}"
|
415
|
-
|
420
|
+
FileUtils.rm_rf(path, verbose: verbose)
|
416
421
|
else
|
417
422
|
log&.warn "rm #{path}"
|
418
423
|
(val.include?('*') ? Dir[path] : [path]).each do |file|
|
@@ -777,7 +782,7 @@ module Squared
|
|
777
782
|
end
|
778
783
|
|
779
784
|
def session(*cmd, prefix: cmd.first, main: true, options: true)
|
780
|
-
prefix = prefix.to_s.upcase
|
785
|
+
prefix = stripext(prefix.to_s).upcase
|
781
786
|
if (val = PATH[prefix] || PATH[prefix.to_sym])
|
782
787
|
cmd[0] = shell_quote(val, force: false)
|
783
788
|
end
|
@@ -798,10 +803,10 @@ module Squared
|
|
798
803
|
cmd.done
|
799
804
|
end
|
800
805
|
|
801
|
-
def option(*args,
|
806
|
+
def option(*args, target: @session, prefix: target&.first, **kwargs)
|
802
807
|
if prefix
|
803
808
|
args.each do |val|
|
804
|
-
ret = env("#{prefix}_#{val.gsub(/\W/, '_')}".upcase, **kwargs)
|
809
|
+
ret = env("#{stripext(prefix)}_#{val.gsub(/\W/, '_')}".upcase, **kwargs)
|
805
810
|
return ret if ret
|
806
811
|
end
|
807
812
|
end
|
@@ -1011,7 +1016,7 @@ module Squared
|
|
1011
1016
|
|
1012
1017
|
def append_first(list, target: @session, flag: true, equals: false, quote: false, escape: true, **kwargs)
|
1013
1018
|
list.each do |opt|
|
1014
|
-
next unless (val = option(opt, **kwargs))
|
1019
|
+
next unless (val = option(opt, target: target, **kwargs))
|
1015
1020
|
|
1016
1021
|
return target << (if flag
|
1017
1022
|
shell_option(opt, equals ? val : nil, quote: quote, escape: escape)
|
@@ -1024,14 +1029,14 @@ module Squared
|
|
1024
1029
|
|
1025
1030
|
def append_option(list, target: @session, equals: false, quote: false, escape: true, **kwargs)
|
1026
1031
|
list.each do |flag|
|
1027
|
-
next unless (val = option(flag, **kwargs))
|
1032
|
+
next unless (val = option(flag, target: target, **kwargs))
|
1028
1033
|
|
1029
1034
|
target << shell_option(flag, equals ? val : nil, quote: quote, escape: escape)
|
1030
1035
|
end
|
1031
1036
|
end
|
1032
1037
|
|
1033
1038
|
def append_nocolor(target: @session)
|
1034
|
-
target << '--no-color' if !ARG[:COLOR] || stdin? || option('no-color', ignore: false)
|
1039
|
+
target << '--no-color' if !ARG[:COLOR] || stdin? || option('no-color', target: target, ignore: false)
|
1035
1040
|
end
|
1036
1041
|
|
1037
1042
|
def param_guard(action, flag, args: nil, key: nil, pat: nil)
|
@@ -1192,7 +1197,8 @@ module Squared
|
|
1192
1197
|
end
|
1193
1198
|
|
1194
1199
|
def projectpath?(val)
|
1195
|
-
Pathname.new(val).
|
1200
|
+
val = Pathname.new(val).cleanpath
|
1201
|
+
val.absolute? ? val.to_s.start_with?(File.join(path, '')) : !val.to_s.start_with?(File.join('..', ''))
|
1196
1202
|
end
|
1197
1203
|
|
1198
1204
|
def semmajor?(cur, want)
|
@@ -72,13 +72,13 @@ module Squared
|
|
72
72
|
|
73
73
|
module Project
|
74
74
|
class Git < Base
|
75
|
-
FOR_FETCH = %w[atomic multiple negotiate-only prefetch progress prune-tags refetch
|
75
|
+
FOR_FETCH = %w[atomic multiple negotiate-only prefetch progress prune-tags refetch].freeze
|
76
76
|
NO_FETCH = %w[all ipv4 ipv6 recurse-submodules show-forced-updates tags].freeze
|
77
77
|
FNO_FETCH = %w[auto-gc auto-maintenance write-commit-graph write-fetch-head].freeze
|
78
78
|
OPT_FETCH = (FOR_FETCH + NO_FETCH + FNO_FETCH +
|
79
79
|
%w[append dry-run force keep prune quiet set-upstream unshallow update-shallow verbose
|
80
|
-
deepen=i depth=i jobs=i negotiation-tip=s refmap=s
|
81
|
-
shallow-since=d upload-pack=s]).freeze
|
80
|
+
deepen=i depth=i jobs=i negotiation-tip=s refmap=s recurse-submodules=s server-option=s
|
81
|
+
shallow-exclude=s shallow-since=d upload-pack=s]).freeze
|
82
82
|
NO_PULL = %w[allow-unrelated-histories autostash commit edit ff signoff squash stat verify verify-signatures
|
83
83
|
gpg-sign=? log=? rebase=?].freeze
|
84
84
|
OPT_PULL = (NO_PULL + %w[ff-only signoff=s strategy=s strategy-option=s]).freeze
|
@@ -439,8 +439,11 @@ module Squared
|
|
439
439
|
end
|
440
440
|
|
441
441
|
def pull(flag = nil, sync: invoked_sync?('pull', flag), remote: nil, opts: [])
|
442
|
-
cmd = git_session 'pull'
|
443
|
-
if
|
442
|
+
cmd = git_session 'pull'
|
443
|
+
if flag == :rebase
|
444
|
+
cmd << '--rebase'
|
445
|
+
cmd << '--autostash' if option('autostash')
|
446
|
+
elsif (val = option('rebase', ignore: false))
|
444
447
|
cmd << case val
|
445
448
|
when '0'
|
446
449
|
'--no-rebase'
|
@@ -791,7 +794,7 @@ module Squared
|
|
791
794
|
cmd << '--force' if option('force')
|
792
795
|
when :set
|
793
796
|
if ref.start_with?('!')
|
794
|
-
cmd << '--unset-upstream' << shell_escape(
|
797
|
+
cmd << '--unset-upstream' << shell_escape(ref[1..-1])
|
795
798
|
target = nil
|
796
799
|
stdout = true
|
797
800
|
else
|
@@ -1019,7 +1022,7 @@ module Squared
|
|
1019
1022
|
end
|
1020
1023
|
|
1021
1024
|
def append_pull(opts, list, no = [], target: @session, flag: nil, remote: nil)
|
1022
|
-
|
1025
|
+
target << '--force' if option('force', target: target)
|
1023
1026
|
modules = append_submodules(target: target)
|
1024
1027
|
out = []
|
1025
1028
|
refspec = []
|
@@ -1050,7 +1053,7 @@ module Squared
|
|
1050
1053
|
end
|
1051
1054
|
if remote
|
1052
1055
|
append_value(remote, target: target, delim: true, quote: true)
|
1053
|
-
if (val = option('refspec', strict: true))
|
1056
|
+
if (val = option('refspec', target: target, strict: true))
|
1054
1057
|
append_value(split_escape(val), target: target, escape: false)
|
1055
1058
|
else
|
1056
1059
|
target.merge(refspec)
|
@@ -1069,7 +1072,7 @@ module Squared
|
|
1069
1072
|
end
|
1070
1073
|
|
1071
1074
|
def append_pathspec(files = [], target: @session, expect: false, parent: false)
|
1072
|
-
if files.empty? && (val = option('pathspec'))
|
1075
|
+
if files.empty? && (val = option('pathspec', target: target))
|
1073
1076
|
files = split_escape(val)
|
1074
1077
|
end
|
1075
1078
|
files = projectmap(files, parent: parent)
|
@@ -1091,7 +1094,7 @@ module Squared
|
|
1091
1094
|
end
|
1092
1095
|
|
1093
1096
|
def append_submodules(from = nil, target: @session)
|
1094
|
-
return unless (val = option('recurse-submodules', ignore: false))
|
1097
|
+
return unless (val = option('recurse-submodules', target: target, ignore: false))
|
1095
1098
|
|
1096
1099
|
if from == :clone
|
1097
1100
|
projectmap(split_escape(val)).each do |path|
|
@@ -246,7 +246,6 @@ module Squared
|
|
246
246
|
append_global(target: target)
|
247
247
|
return
|
248
248
|
end
|
249
|
-
|
250
249
|
out = []
|
251
250
|
opts, pat = option_partition(opts, OPT_INSTALL + OPT_GENERAL, target: target)
|
252
251
|
append_global(target: target)
|
@@ -281,7 +280,7 @@ module Squared
|
|
281
280
|
end
|
282
281
|
|
283
282
|
def append_global(target: @session)
|
284
|
-
if (val = option('cache-dir'))
|
283
|
+
if (val = option('cache-dir', target: target))
|
285
284
|
target << case val
|
286
285
|
when '0', 'false'
|
287
286
|
'--no-cache-dir'
|
@@ -289,8 +288,8 @@ module Squared
|
|
289
288
|
quote_option('cache-dir', basepath(val))
|
290
289
|
end
|
291
290
|
end
|
292
|
-
target << quote_option('proxy', val) if (val = option('proxy'))
|
293
|
-
target << quote_option('python', basepath(val)) if (val = option('python'))
|
291
|
+
target << quote_option('proxy', val) if (val = option('proxy', target: target))
|
292
|
+
target << quote_option('python', basepath(val)) if (val = option('python', target: target))
|
294
293
|
append_nocolor(target: target)
|
295
294
|
end
|
296
295
|
end
|
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.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.6.
|
123
|
+
rubygems_version: 3.6.8
|
124
124
|
specification_version: 4
|
125
125
|
summary: Rake task generator for managing multi-language workspaces.
|
126
126
|
test_files: []
|