squared 0.8.6 → 0.9.0.pre1

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.
@@ -53,7 +53,7 @@ module Squared
53
53
  opts = options
54
54
  val.is_a?(String) ? val : key.to_s
55
55
  end
56
- unless uri.match?(GIT_PROTO) || Pathname.new(uri).absolute?
56
+ unless uri.match?(GIT_PROTO) || File.absolute_path?(uri)
57
57
  if uri.start_with?('.')
58
58
  uri = rootpath uri
59
59
  elsif base
@@ -135,8 +135,7 @@ module Squared
135
135
  def rev_write(name = nil, data = nil, sync: true, utc: nil)
136
136
  return unless @revfile
137
137
 
138
- sleep 0 while !sync && @revlock
139
- @revlock = true
138
+ (@revlock ||= Monitor.new).enter unless sync
140
139
  if name
141
140
  data&.each { |key, val| rev_entry(name, key, val: val) }
142
141
  rev_timeutc(name, utc) if utc
@@ -145,7 +144,7 @@ module Squared
145
144
  rescue => e
146
145
  warn log_warn(e, pass: true) if warning
147
146
  ensure
148
- @revlock = false
147
+ @revlock.exit unless sync
149
148
  end
150
149
  end
151
150
 
@@ -204,6 +203,8 @@ module Squared
204
203
  X|strategy-option=b].freeze,
205
204
  rm: %w[r cached f|force n|dry-run ignore-unmatch pathspec-file-nul q|quiet sparse
206
205
  pathspec-from-file=p].freeze,
206
+ show: %w[t combined-all-paths no-diff-merges remerge-diff show-notes-by-default show-signature diff-merges=b
207
+ encoding=b expand-tabs=i notes=q show-notes=q?].freeze,
207
208
  'sparse-checkout': %w[cone sparse-index no-cone no-sparse-index skip-checks].freeze
208
209
  }.freeze,
209
210
  log: {
@@ -270,8 +271,6 @@ module Squared
270
271
  branches=q? default=q disambiguate=b exclude=q exclude-hidden=b git-path=p glob=q
271
272
  output-object-format=b path-format=b? prefix=q remotes=q? resolve-git-dir=p short=i?
272
273
  show-object-format=b? since=q tags=q? until=q].freeze,
273
- show: %w[t combined-all-paths no-diff-merges remerge-diff show-notes-by-default show-signature diff-merges=b
274
- encoding=b expand-tabs=i notes=q show-notes=q?].freeze,
275
274
  sparse_checkout: {
276
275
  add: %w[skip-checks].freeze,
277
276
  clean: %w[n f v].freeze
@@ -370,7 +369,7 @@ module Squared
370
369
  'range-diff' => %i[view between contain].freeze,
371
370
  'fetch' => %i[origin remote all].freeze,
372
371
  'files' => %i[cached modified deleted others].freeze,
373
- 'git' => %i[add blame clean grep mv revert rm sparse-checkout status].freeze,
372
+ 'git' => %i[add blame clean grep mv revert rm show sparse-checkout status].freeze,
374
373
  'log' => %i[grep view between contain].freeze,
375
374
  'merge' => %i[commit no-commit send].freeze,
376
375
  'pull' => %i[origin remote all].freeze,
@@ -381,7 +380,6 @@ module Squared
381
380
  'reset' => %i[commit index patch mode undo].freeze,
382
381
  'restore' => %i[source staged worktree].freeze,
383
382
  'rev' => %i[commit branch build output].freeze,
384
- 'show' => %i[format oneline textconv].freeze,
385
383
  'sparse-checkout' => %i[add reapply list clean disable].freeze,
386
384
  'stash' => %i[push pop apply drop command].freeze,
387
385
  'submodule' => %i[status update branch url sync].freeze,
@@ -814,11 +812,6 @@ module Squared
814
812
  end
815
813
  branch(flag, refs: refs, remote: remote)
816
814
  end
817
- when :list
818
- format_desc action, flag, 'opts*,pattern*'
819
- task flag do |_, args|
820
- branch flag, args.to_a
821
- end
822
815
  when :move, :copy
823
816
  format_desc action, flag, 'branch,oldbranch?'
824
817
  task flag, [:branch, :oldbranch] do |_, args|
@@ -832,9 +825,9 @@ module Squared
832
825
  branch(flag, refs: [oldbranch, branch])
833
826
  end
834
827
  else
835
- format_desc action, flag
836
- task flag do
837
- branch flag
828
+ format_desc(action, flag, ('opts*,pattern*' if flag == :list))
829
+ task flag do |_, args|
830
+ branch flag, args.to_a
838
831
  end
839
832
  end
840
833
  when 'clone'
@@ -914,25 +907,6 @@ module Squared
914
907
  reset flag
915
908
  end
916
909
  end
917
- when 'show'
918
- case flag
919
- when :oneline
920
- format_desc action, flag, 'opts*,object*'
921
- task flag do |_, args|
922
- show flag, args.to_a
923
- end
924
- when :format
925
- format_desc action, flag, 'format?,opts*,object*'
926
- task flag, [:format] do |_, args|
927
- show(flag, args.extras, format: args.format)
928
- end
929
- when :textconv
930
- format_desc action, flag, 'files+'
931
- task flag do |_, args|
932
- files = param_guard(action, flag, args: args.to_a)
933
- show(flag, files: files)
934
- end
935
- end
936
910
  when 'rebase', 'merge'
937
911
  case flag
938
912
  when :branch
@@ -968,13 +942,10 @@ module Squared
968
942
  when :commit, :'no-commit'
969
943
  format_desc action, flag, 'branch|:,ours|theirs?,opts*'
970
944
  task flag, [:branch] do |_, args|
971
- branch = if args.branch == ':'
972
- choice_refs('Choose a branch', accept: "#{action.capitalize}?")
973
- else
974
- args.branch
975
- end
976
- current = git_value 'branch --show-current'
945
+ branch = args.branch
946
+ current = git_spawn('branch --show-current').chomp
977
947
  if branch
948
+ branch = choice_refs('Choose a branch', accept: "#{action.capitalize}?") if branch == ':'
978
949
  opts = args.extras
979
950
  if has_value!(opts, 'ours')
980
951
  opts << 's=ort' << 'X=ours'
@@ -1007,7 +978,7 @@ module Squared
1007
978
  task flag, [:ref, :size] do |_, args|
1008
979
  ref = commithead args.ref
1009
980
  size = args.size
1010
- if !size && ref.to_i.between?(4, 40)
981
+ if !size && ref.to_i.between?(4, 64)
1011
982
  size = ref
1012
983
  ref = nil
1013
984
  end
@@ -1148,6 +1119,8 @@ module Squared
1148
1119
  'source+,destination'
1149
1120
  when :revert
1150
1121
  'commit+'
1122
+ when :show
1123
+ 'format?'
1151
1124
  end
1152
1125
  after = case flag
1153
1126
  when :add
@@ -1158,6 +1131,8 @@ module Squared
1158
1131
  'dir+'
1159
1132
  when :clean, :rm, :status
1160
1133
  'pathspec*'
1134
+ when :show
1135
+ 'object*'
1161
1136
  end
1162
1137
  format_desc(action, flag, 'opts*', before: before, after: after)
1163
1138
  task flag do |_, args|
@@ -1226,7 +1201,7 @@ module Squared
1226
1201
  (heads.dup << cur).each_with_index do |branch, i|
1227
1202
  next unless (i < heads.size && cur != branch) || i == heads.size
1228
1203
 
1229
- git_spawn('switch --quiet', force && '--force', shell_quote(branch))
1204
+ git_spawn 'switch --quiet', force && '--force', shell_quote(branch)
1230
1205
  pull(nil, opts, sync: false, hint: branch) if heads.include?(branch)
1231
1206
  end
1232
1207
  return
@@ -1302,13 +1277,13 @@ module Squared
1302
1277
  if flag
1303
1278
  return unless dir && ref
1304
1279
 
1305
- url = git_value "config --get remote.#{remotetrack}.url"
1280
+ url = git_spawn("config --get remote.#{remotetrack}.url")
1306
1281
  cmd, opts = git_session('clone', worktree: false, opts: opts)
1307
1282
  op = OptionPartition.new(opts, OPT_GIT[:clone], cmd, project: self, strict: strict?,
1308
1283
  no: OPT_GIT[:no][:clone])
1309
1284
  op.add_option('b', ref)
1310
1285
  .delim
1311
- .add_quote(url)
1286
+ .add_quote(url.chomp)
1312
1287
  .add_path(dir)
1313
1288
  .clear
1314
1289
  source
@@ -1501,7 +1476,7 @@ module Squared
1501
1476
  end
1502
1477
  return
1503
1478
  end
1504
- sha = git_value 'rev-parse --verify HEAD'
1479
+ sha = git_spawn('rev-parse --verify HEAD').chomp
1505
1480
  return if sha.empty?
1506
1481
 
1507
1482
  sync = kwargs.fetch(:sync) { invoked_sync?('revbuild', flag) }
@@ -1522,7 +1497,7 @@ module Squared
1522
1497
  run_p(*Array(kwargs[:before]), sync: sync, from: symjoin(from, 'before')) if kwargs[:before]
1523
1498
  force = if (force = env('REVBUILD_FORCE', strict: true))
1524
1499
  force != '0' && force != 'false'
1525
- elsif (force = ENV['GIT_FORCE'] || ENV['REVBUILD_FORCE'])
1500
+ elsif (force = env('GIT_FORCE', suffix: false) || env('REVBUILD_FORCE', suffix: false))
1526
1501
  split_escape(force).any? { |val| val == '1' || val == 'true' || val == name }
1527
1502
  end
1528
1503
  if !force && (cur = workspace.rev_entry(name)) && cur['revision'] == sha
@@ -1564,7 +1539,7 @@ module Squared
1564
1539
  .clear(pass: false)
1565
1540
  when :commit
1566
1541
  exit 1 unless ref
1567
- branch ||= git_value('name-rev --name-only', ref)
1542
+ branch ||= git_spawn('name-rev --name-only', ref).chomp
1568
1543
  raise ArgumentError, message('could not resolve upstream branch', hint: ref) if branch.empty?
1569
1544
 
1570
1545
  op.append(remotetrack, "#{ref}:#{branch}")
@@ -1759,7 +1734,7 @@ module Squared
1759
1734
  end
1760
1735
  if (n = op.index('>'))
1761
1736
  patch = op.slice!(n, 2)[1]
1762
- elsif !op.last.include?('*') && !op.exist?(op.last)
1737
+ elsif !op.exist?(op.last)
1763
1738
  patch ||= op.pop
1764
1739
  end
1765
1740
  append_pathspec op.extras
@@ -1865,8 +1840,7 @@ module Squared
1865
1840
  if adding.empty? && !cached.empty? && banner?
1866
1841
  puts(cached.lines(chomp: true).map { |val| "cached #{shell_quote(val)}" })
1867
1842
  end
1868
- source co
1869
- source pu
1843
+ ENV['COMMIT_PUSH'] = git_spawn 'rev-parse --verify HEAD' if source(co) && source(pu) && !dryrun?
1870
1844
  else
1871
1845
  if banner?
1872
1846
  puts 'Nothing to commit'
@@ -1966,13 +1940,13 @@ module Squared
1966
1940
  print_item banner
1967
1941
  ret = write_lines(out, sub: [
1968
1942
  opt_style(color(:green), /^(\*\s+)(\S+)(.*)$/, 2),
1943
+ opt_style(color(:blue), /^(.+)((?<=\[)[^\]]+(?=\]))(.*)$/, 2),
1969
1944
  opt_style(color(:red), %r{^(\s*)(remotes/\S+)(.*)$}, 2)
1970
1945
  ])
1971
1946
  list_result(ret, 'branches', banner: banner, from: from)
1972
1947
  return
1973
1948
  else
1974
- head = git_value 'rev-parse --abbrev-ref HEAD'
1975
- if head.empty?
1949
+ if (head = git_spawn('rev-parse --abbrev-ref HEAD').chomp).empty?
1976
1950
  ret = 0
1977
1951
  else
1978
1952
  git_spawn 'fetch --all --prune --quiet' if option('sync')
@@ -2057,35 +2031,6 @@ module Squared
2057
2031
  source(sync: false, stderr: true)
2058
2032
  end
2059
2033
 
2060
- def show(flag, opts = [], format: nil, files: [])
2061
- cmd, opts = git_session('show', opts: opts)
2062
- case flag
2063
- when :textconv
2064
- cmd << '--textconv'
2065
- append_value(files.flat_map { |val| Dir[val] }
2066
- .select { |val| projectpath?(val) }
2067
- .map { |val| "HEAD:#{val}" })
2068
- source(banner: false)
2069
- return
2070
- when :oneline
2071
- format = flag.to_s
2072
- end
2073
- case format
2074
- when 'oneline', 'short', 'medium', 'full', 'fuller', 'reference', 'email', 'raw'
2075
- cmd << basic_option('format', format)
2076
- when /^t?format:|%/
2077
- cmd << quote_option('pretty', format)
2078
- else
2079
- opts << format if format
2080
- end
2081
- list = OPT_GIT[:show] + OPT_GIT[:diff][:show] + collect_hash(OPT_GIT[:log], pass: [:base])
2082
- op = OptionPartition.new(opts, list, cmd,
2083
- project: self, strict: strict?,
2084
- no: OPT_GIT[:no][:show] + collect_hash(OPT_GIT[:no][:log], pass: [:base]))
2085
- op.append
2086
- source(exception: false, banner: flag != :oneline)
2087
- end
2088
-
2089
2034
  def rev_parse(flag, opts = [], ref: nil, size: nil)
2090
2035
  cmd, opts = git_session('rev-parse', opts: opts)
2091
2036
  case flag
@@ -2099,7 +2044,7 @@ module Squared
2099
2044
  else
2100
2045
  ref
2101
2046
  end)
2102
- return git_value(cmd, exception: false)
2047
+ return git_spawn(cmd, exception: false).chomp
2103
2048
  when :output
2104
2049
  if opts.delete('sq-quote')
2105
2050
  cmd << '--sq-quote'
@@ -2149,18 +2094,28 @@ module Squared
2149
2094
 
2150
2095
  def git(flag, opts = [], extras: [])
2151
2096
  cmd, opts = git_session(flag, opts: opts)
2152
- list = OPT_GIT[:git].fetch(flag, []) + OPT_GIT.fetch(flag, []).yield_self { |a| a.is_a?(Array) ? a : [] }
2097
+ list = OPT_GIT[:git].fetch(flag, []) + OPT_GIT.fetch(flag, []).then { |a| a.is_a?(Array) ? a : [] }
2098
+ no = OPT_GIT[:no].fetch(flag, [])
2153
2099
  case flag
2154
2100
  when :add
2155
2101
  list.concat(OPT_GIT[:log][:diff_context])
2156
2102
  when :revert
2157
2103
  list.concat(VAL_GIT[:rebase][:send])
2104
+ when :show
2105
+ list.concat(OPT_GIT[:diff][:show], collect_hash(OPT_GIT[:log], pass: [:base]))
2106
+ no += collect_hash(OPT_GIT[:no][:log], pass: [:base])
2107
+ case opts.first
2108
+ when 'short', 'medium', 'full', 'fuller', 'reference', 'email', 'raw'
2109
+ cmd << basic_option('format', opts.shift)
2110
+ when /^t?format:|%/
2111
+ cmd << quote_option('pretty', opts.shift)
2112
+ end
2158
2113
  when :'sparse-checkout'
2159
2114
  cmd << 'set'
2160
2115
  end
2161
- op = OptionPartition.new(opts, list, cmd, project: self, strict: strict?, no: OPT_GIT[:no][flag],
2116
+ op = OptionPartition.new(opts, list, cmd, project: self, strict: strict?, no: no,
2162
2117
  first: case flag
2163
- when :blame, :revert, :'sparse-checkout' then nil
2118
+ when :blame, :revert, :show, :'sparse-checkout' then nil
2164
2119
  else matchpathspec
2165
2120
  end)
2166
2121
  case flag
@@ -2226,6 +2181,20 @@ module Squared
2226
2181
  op.add_quote(val)
2227
2182
  end
2228
2183
  end
2184
+ when :show
2185
+ if op.arg?('textconv')
2186
+ op.each do |val|
2187
+ files = Dir[val]
2188
+ if files.empty? || !files.all? { |path| projectpath?(path) }
2189
+ op.add_quote(val)
2190
+ else
2191
+ op.append(files.map { |path| "HEAD:#{path}" })
2192
+ end
2193
+ end
2194
+ else
2195
+ op.append
2196
+ end
2197
+ return source(exception: false, banner: !op.arg?('oneline', 'textconv'))
2229
2198
  end
2230
2199
  case flag
2231
2200
  when :revert, :mv, :rm
@@ -2341,7 +2310,9 @@ module Squared
2341
2310
  end
2342
2311
  args = []
2343
2312
  args << quote_option('sort', sort) if sort
2344
- args << basic_option('count', env('GIT_COUNT', ARG[:CHOICE])) if count
2313
+ if count && (count = env('GIT_COUNT') || ARG[:CHOICE]) && count != Float::INFINITY
2314
+ args << basic_option('count', count)
2315
+ end
2345
2316
  choice_index(msg, foreachref(type, *args, format: format), trim: trim, **kwargs)
2346
2317
  end
2347
2318
 
@@ -2349,11 +2320,13 @@ module Squared
2349
2320
  kwargs[:attempts] ||= 1 unless force
2350
2321
  cmd = git_output(reflog && env('GIT_REFLOG') ? 'reflog' : 'log', range)
2351
2322
  cmd << quote_option('format', "#{commitstyle('%h')} %s")
2352
- cmd << basic_option('max-count', env('GIT_COUNT', ARG[:CHOICE])) if count
2323
+ if count && (count = env('GIT_COUNT') || ARG[:CHOICE]) && count != Float::INFINITY
2324
+ cmd << basic_option('max-count', count)
2325
+ end
2353
2326
  ret = choice_index(msg, git_spawn(cmd, stdout: false), column: /^(\S+)/, force: force, **kwargs)
2354
2327
  case ret
2355
2328
  when Array
2356
- ret.map { |val| val.is_a?(Array) ? val.map { |s| s&.stripstyle } : val&.stripstyle }
2329
+ ret.map { |val| val&.stripstyle }
2357
2330
  when String
2358
2331
  ret.stripstyle
2359
2332
  else
@@ -2531,10 +2504,6 @@ module Squared
2531
2504
  stdout: stdout, banner: banner, **kwargs)
2532
2505
  end
2533
2506
 
2534
- def git_value(*cmd, exception: true)
2535
- git_spawn(*cmd, exception: exception).chomp
2536
- end
2537
-
2538
2507
  def git_grep(cmd, *grep, equals: true, **kwargs)
2539
2508
  ret = []
2540
2509
  git_spawn(cmd, **kwargs).lines(chomp: true).each do |line|
@@ -2578,8 +2547,8 @@ module Squared
2578
2547
  n = origin&.index('/')
2579
2548
  raise message("missing #{origin ? 'branch' : 'remote'} name", hint: origin) unless n && branch
2580
2549
 
2581
- branch = "#{branch}:#{origin[n.succ..-1]}" unless origin.end_with?("/#{branch}")
2582
- ret = [origin[0..n.pred], branch]
2550
+ branch = task_join branch, origin[n.succ..] unless origin.end_with?("/#{branch}")
2551
+ ret = [origin[...n], branch]
2583
2552
  ret.quote! if quote
2584
2553
  ret
2585
2554
  end
@@ -2589,7 +2558,7 @@ module Squared
2589
2558
  end
2590
2559
 
2591
2560
  def commithash(val)
2592
- val[/\A:(\h{5,40})\z/, 1]
2561
+ val[/\A:(\h{5,64})\z/, 1]
2593
2562
  end
2594
2563
 
2595
2564
  def commithead(val)
@@ -104,6 +104,9 @@ module Squared
104
104
  build: %w[clean=!? dry=!? force=!? v|verbose=!?].freeze,
105
105
  watch: %w[excludeDirectories=p excludeFiles=p fallbackPolling=b synchronousWatchDirectory=!? watchDirectory=b
106
106
  watchFile=b].freeze,
107
+ v7: {
108
+ compiler: %w[builders=i checkers=i singleThreaded=!?]
109
+ },
107
110
  v5: {
108
111
  compiler: %w[allowSyntheticDefaultImports=!? alwaysStrict=!? baseUrl=p downlevelIteration=!?
109
112
  esModuleInterop=!? outFile=p].freeze
@@ -545,8 +548,7 @@ module Squared
545
548
  Open3.capture2e(cmd.to_s)
546
549
  .first
547
550
  .scan(/^npm notice \d+(?:\.\d+)?[a-z]+ (.+)$/i)
548
- .map { |item| Pathname.new(item.first) }
549
- .select(&:exist?)
551
+ .filter_map { |item| item.first if File.exist?(item.first) }
550
552
  end.concat(Array(files))
551
553
  packed = true
552
554
  end
@@ -662,7 +664,7 @@ module Squared
662
664
  end
663
665
  if nolockfile?(prefix: 'yarn')
664
666
  cmd << '--no-lockfile'
665
- elsif option('ci') || (ci? && exist?('yarn.lock'))
667
+ elsif ci? && exist?('yarn.lock')
666
668
  if yarn == 1
667
669
  cmd << '--frozen-lockfile'
668
670
  elsif !flag
@@ -698,14 +700,13 @@ module Squared
698
700
  '--force'
699
701
  elsif nolockfile?(prefix: 'pnpm')
700
702
  '--no-lockfile'
701
- elsif option('ci') || (ci? && exist?('pnpm-lock.yaml'))
703
+ elsif ci? && exist?('pnpm-lock.yaml')
702
704
  '--frozen-lockfile'
703
705
  end
704
706
  cmd << '--ignore-scripts' if option('ignore-scripts')
705
707
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
706
708
  else
707
- ci = option('ci', prefix: 'npm') || (ci? && exist?('package-lock.json'))
708
- cmd = session('npm', ci ? 'ci' : 'install')
709
+ cmd = session('npm', ci = ci? && exist?('package-lock.json') ? 'ci' : 'install')
709
710
  option('approve-scripts') do |val|
710
711
  cmd = npm_output 'approve-scripts'
711
712
  cmd << case val
@@ -815,7 +816,7 @@ module Squared
815
816
  latest = val['latest']
816
817
  ch = file[0]
817
818
  if ch.match?(/[~^]/)
818
- file = file[1..-1]
819
+ file = file[1..]
819
820
  elsif ia && flag == :major
820
821
  major = true
821
822
  else
@@ -960,7 +961,7 @@ module Squared
960
961
  (1..items.size)
961
962
  else
962
963
  choice('Select a package', items.map(&:first), multiple: true, force: false, index: true,
963
- border: true)
964
+ border: true, **parse_select)
964
965
  end.each do |n|
965
966
  item = items[n.pred].last
966
967
  doc.sub!(pat.call(item)) { edit.call(item, $1, $2) }
@@ -1039,7 +1040,7 @@ module Squared
1039
1040
  c = 0
1040
1041
  e = 0
1041
1042
  doc['files'].each do |item|
1042
- path = item['path'][n..-1]
1043
+ path = item['path'][n..]
1043
1044
  js = File.extname(path)
1044
1045
  next unless ext.empty? || ext.any? { |val| val == js }
1045
1046
 
@@ -1355,7 +1356,8 @@ module Squared
1355
1356
  b = kwargs[:build]
1356
1357
  w = kwargs[:watch]
1357
1358
  list = OPT_TSC[:base] + OPT_TSC[:compiler]
1358
- list.concat(Array(kwargs.fetch(:legacy, 5)).flat_map { |n| OPT_TSC.fetch(:"v#{n}", {}).fetch(:compiler, []) })
1359
+ kwargs[:legacy] = semapp('npx', 'tsc', '--version', minor: false) if kwargs[:detect]
1360
+ list.concat(Array(kwargs[:legacy]).flat_map { |n| OPT_TSC.fetch(:"v#{n}", {}).fetch(:compiler, []) })
1359
1361
  cmd = session 'tsc', if p
1360
1362
  quote_option 'p', basepath(p)
1361
1363
  elsif b
@@ -1381,7 +1383,7 @@ module Squared
1381
1383
  print_run(cmd, banner, **kwargs)
1382
1384
  session 'npx', cmd
1383
1385
  start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
1384
- ret = run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from)
1386
+ ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from)
1385
1387
  print_status(name, subject: 'tsc', start: start) if success?(ret, banner, start.nil?) && start
1386
1388
  ret
1387
1389
  end
@@ -1518,7 +1520,7 @@ module Squared
1518
1520
  end
1519
1521
 
1520
1522
  def scripts
1521
- @scripts ||= read_package('scripts').yield_self { |ret| ret.is_a?(Hash) ? ret : {} }
1523
+ @scripts ||= read_package('scripts').then { |ret| ret.is_a?(Hash) ? ret : {} }
1522
1524
  end
1523
1525
 
1524
1526
  private