squared 0.4.30 → 0.4.31

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: ec34e9b4cff5c76d921c742e1d3f476814756fee0a4766b7433c0cef64987826
4
- data.tar.gz: d1dacfbcc7293efc614a220d7476ce63a641adaf6863c4dec0ba29575182b56b
3
+ metadata.gz: e24f3f18639483d5b698d06a1fd471251623658359121940dd4d6597d3e5f453
4
+ data.tar.gz: 90eb6cd2b8b5e28497d666d655758422d124b4eb47701164ce3712a11ecc2936
5
5
  SHA512:
6
- metadata.gz: aaef815c281e7fb8ac3dae919218ca38e0a4af7815db58315e0221baf35cffbfb28ee8398d8ccabd16ef3888030b825055b1b69ee96d0c1b6632bca41ef60b59
7
- data.tar.gz: e4934cf825627079d4f6f536b4b86b96b51724415fe316af4b2c900268e284b98600224263faa090c4249db3fafca6eebcb3390fd27a0f0d94c027b616fbcd78
6
+ metadata.gz: 4a7a4c5283e6bd65ed22fe9053d3f14552f2de61200e48c8c0c8e8013d0915db2c72a76ad2f7de784d0127ac47a8dd87c48ceea7a6c8c93468119487820886d7
7
+ data.tar.gz: 8aee7c98eb186fec5968373ab0f3acffefcbe45d6c85adce46c581536ca51d77c71af89f1c0b95cf4be10e850a24df6b783c35eb9fc32da0fa3918d360f8d779
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.31] - 2025-11-22
4
+
5
+ ### Changed
6
+
7
+ - Project base attribute project was converted into an accessor.
8
+ - Ruby command flag is given precedence to a program file.
9
+
10
+ ### Fixed
11
+
12
+ - Repo application tasks are not created on Windows.
13
+ - Repo module used conflicting REPO_URL with Repo application.
14
+ - Project task outdated did not check pass and only exclusions.
15
+ - Workspace static method resolve did nothing when given a String.
16
+ - Project base run command types did not include Struct.
17
+ - Project change directory context did not always restore when raised.
18
+ - Ruby file method attributes did not always return nil.
19
+ - JoinSet with a delimiter did not report correct size.
20
+
3
21
  ## [0.4.30] - 2025-11-14
4
22
 
5
23
  ### Added
@@ -1103,6 +1121,7 @@
1103
1121
 
1104
1122
  - Changelog was created.
1105
1123
 
1124
+ [0.4.31]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.31
1106
1125
  [0.4.30]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.30
1107
1126
  [0.4.29]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.29
1108
1127
  [0.4.28]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.28
data/README.md CHANGED
@@ -20,23 +20,9 @@ The range chart indicates the latest Ruby tested against at the time of release.
20
20
  gem install squared
21
21
  ```
22
22
 
23
- ### Optional
24
-
25
- * [Repo](https://source.android.com/docs/setup/reference/repo)
26
- * https://github.com/anpham6/squared-repo
27
- * Python 3.6
28
- * Not compatible with Windows
29
-
30
- ```sh
31
- mkdir -p ~/.bin
32
- PATH="${HOME}/.bin:${PATH}"
33
- curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
34
- chmod a+rx ~/.bin/repo
35
- ```
36
-
37
23
  ## Example - Rakefile
38
24
 
39
- Projects from any accessible folder can be added relative to the parent directory (e.g. *REPO_ROOT*) or absolutely. The same Rakefile can also manage other similarly cloned `Repo` repositories remotely by setting the `REPO_ROOT` environment variable to the location. Missing projects will simply be excluded from the task runner.
25
+ 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.
40
26
 
41
27
  ```ruby
42
28
  require "squared"
@@ -52,14 +38,6 @@ require "squared/app" # All workspace related mod
52
38
 
53
39
  # NODE_ENV = production
54
40
 
55
- # REPO_ROOT = /workspaces |
56
- # REPO_HOME = /workspaces/squared | Dir.pwd
57
- # rake = /workspaces/squared/Rakefile | main?
58
- # OR
59
- # REPO_ROOT = /workspaces | Dir.pwd
60
- # rake = /workspaces/Rakefile |
61
- # REPO_HOME = /workspaces/squared | main: "squared"
62
-
63
41
  # pathname = /workspaces/pathname
64
42
  # optparse = /workspaces/optparse
65
43
  # log = /workspaces/logger
@@ -74,7 +52,6 @@ require "squared/app" # All workspace related mod
74
52
  Workspace::Application
75
53
  .new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
76
54
  .banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
77
- .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
78
55
  .run("rake install", ref: :ruby)
79
56
  .depend(false, group: "default")
80
57
  .clean("rake clean", group: "default")
@@ -708,7 +685,37 @@ DOCKER_Y=1 # confirm all
708
685
 
709
686
  ### Repo
710
687
 
711
- These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
688
+ * [Repo](https://source.android.com/docs/setup/reference/repo)
689
+ * https://github.com/anpham6/squared-repo
690
+ * Python 3.6
691
+ * Not compatible with Windows
692
+
693
+ ```sh
694
+ mkdir -p ~/.bin
695
+ PATH="${HOME}/.bin:${PATH}"
696
+ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
697
+ chmod a+rx ~/.bin/repo
698
+ ```
699
+
700
+ ```ruby
701
+ # REPO_ROOT = /workspaces |
702
+ # REPO_HOME = /workspaces/squared | Dir.pwd
703
+ # rake = /workspaces/squared/Rakefile | main?
704
+ #
705
+ # OR
706
+ #
707
+ # REPO_ROOT = /workspaces | Dir.pwd
708
+ # rake = /workspaces/Rakefile |
709
+ # REPO_HOME = /workspaces/squared | main: "squared"
710
+
711
+ Workspace::Application
712
+ .new(main: "squared")
713
+ .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "prod"], ref: :node)
714
+ .add("squared", script: ["build:stage1", "build:stage2"])
715
+ .build
716
+ ```
717
+
718
+ These global options also can target the application main suffix `${NAME}`. (e.g. *REPO_ROOT_SQUARED*)
712
719
 
713
720
  ```sh
714
721
  REPO_ROOT # parent dir
@@ -720,7 +727,7 @@ REPO_DEV # pattern,0,1
720
727
  REPO_PROD # pattern,0,1
721
728
  REPO_WARN # 0,1
722
729
  REPO_SYNC # 0,1
723
- REPO_URL # manifest repository
730
+ REPO_GIT # manifest repository
724
731
  REPO_MANIFEST # e.g. latest,nightly,prod
725
732
  REPO_GROUPS # e.g. base,prod,docs
726
733
  REPO_STAGE # 0,1,2,3,4
@@ -728,6 +735,8 @@ REPO_SUBMODULLES # 0,1
728
735
  REPO_TIMEOUT # confirm dialog (seconds)
729
736
  ```
730
737
 
738
+ Other similarly cloned `Repo` repositories can be managed remotely by setting the `REPO_ROOT` environment variable to the location.
739
+
731
740
  ## LICENSE
732
741
 
733
742
  BSD 3-Clause
@@ -134,8 +134,8 @@ module Squared
134
134
  extras!(obj) || super
135
135
  end
136
136
 
137
- def add?(obj)
138
- extras!(obj) || super
137
+ def size
138
+ super + extras.size
139
139
  end
140
140
 
141
141
  def to_a
@@ -143,21 +143,24 @@ module Squared
143
143
  end
144
144
 
145
145
  def to_s
146
- pass.join(@delim)
146
+ to_a.join(@delim)
147
147
  end
148
148
 
149
149
  def to_enum(*args)
150
- pass.to_enum(*args)
150
+ to_a.to_enum(*args)
151
151
  end
152
152
 
153
153
  def to_json(*args)
154
- pass.to_json(*args)
154
+ to_a.to_json(*args)
155
155
  end
156
156
 
157
157
  def to_yaml(*args)
158
- pass.to_yaml(*args)
158
+ to_a.to_yaml(*args)
159
159
  end
160
160
 
161
+ alias add :<<
162
+ alias add? :<<
163
+
161
164
  private
162
165
 
163
166
  def extras!(obj)
@@ -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
 
@@ -178,19 +179,20 @@ module Squared
178
179
  args = args.map(&:to_s)
179
180
  if level.is_a?(::Numeric)
180
181
  if append && respond_to?(:log)
181
- (log rescue nil).tap do |ref|
182
- ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(::Logger)
183
- end
182
+ ref = log rescue nil
183
+ ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(::Logger)
184
184
  end
185
- return false if !pass && level < ARG[:LEVEL]
185
+ return false unless pass || level >= ARG[:LEVEL]
186
186
  end
187
- if (args.size > 1 && !hint) || hint == false
187
+ if hint.nil? ? args.size > 1 : !hint
188
188
  title = log_title(level, color: false)
189
189
  sub = [pat: /\A(#{Regexp.escape(title)})(.*)\z/m, styles: __get__(:theme)[:logger][log_sym(level)]] if color
190
190
  emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub, pipe: -1)
191
191
  else
192
192
  msg = [log_title(level, color: color)]
193
- msg << (color ? sub_style(subject.to_s, styles: (@theme && @theme[:subject]) || :bold) : subject) if subject
193
+ if subject
194
+ msg << (color ? sub_style(subject.to_s, (@theme.is_a?(::Hash) && @theme[:subject]) || :bold) : subject)
195
+ end
194
196
  msg << args.shift if msg.size == 1
195
197
  message(msg.join(' '), *args, hint: hint)
196
198
  end
@@ -78,7 +78,11 @@ module Squared
78
78
  end
79
79
  sep = unless flag.empty?
80
80
  if flag[0] == '-'
81
- flag[1] == '-' ? '=' : ' '
81
+ if flag[1] == '-'
82
+ '='
83
+ else
84
+ merge ? '' : ' '
85
+ end
82
86
  elsif flag.size == 1
83
87
  pre = '-'
84
88
  merge ? '' : ' '
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.30'
4
+ VERSION = '0.4.31'
5
5
  end
@@ -488,7 +488,7 @@ module Squared
488
488
  if (base = task_base?(key))
489
489
  tasks << key if obj.has?(key, baseref)
490
490
  elsif (batch = series.batch_get(key))
491
- obj.allref.each do |ref|
491
+ obj.allref do |ref|
492
492
  next unless obj.has?(key, ref) && (data = batch[ref])
493
493
 
494
494
  data.each do |val|
@@ -507,7 +507,7 @@ module Squared
507
507
  if tasks.empty?
508
508
  return [] if (base && !obj.ref?(baseref)) || !(data = series.alias_get(key))
509
509
 
510
- obj.allref.each do |ref|
510
+ obj.allref do |ref|
511
511
  next unless obj.has?(key, ref) && (alt = data[ref])
512
512
 
513
513
  ret = task_resolve(obj, alt)
@@ -72,9 +72,9 @@ module Squared
72
72
  'unpack' => %i[zip tar gem ext].freeze
73
73
  })
74
74
 
75
- attr_reader :name, :project, :workspace, :path, :theme, :group, :parent, :dependfile,
75
+ attr_reader :name, :workspace, :path, :theme, :group, :parent, :dependfile,
76
76
  :exception, :pipe, :verbose
77
- attr_accessor :global
77
+ attr_accessor :global, :project
78
78
 
79
79
  def initialize(workspace, path, name, *, group: nil, first: {}, last: {}, error: {}, common: ARG[:COMMON],
80
80
  **kwargs)
@@ -1005,8 +1005,8 @@ module Squared
1005
1005
  @log = Logger.new(enabled? ? @log.first : nil, **@log.last)
1006
1006
  end
1007
1007
 
1008
- def allref
1009
- @ref.reverse_each
1008
+ def allref(&blk)
1009
+ @ref.reverse_each(&blk)
1010
1010
  end
1011
1011
 
1012
1012
  def basepath(*args)
@@ -1020,7 +1020,7 @@ module Squared
1020
1020
  path.parent.ascend.each do |dir|
1021
1021
  target = dir.join(*args)
1022
1022
  return target if target.exist?
1023
- break if (ascend && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
1023
+ break if (ascend.is_a?(String) && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
1024
1024
  end
1025
1025
  ret
1026
1026
  end
@@ -1290,7 +1290,9 @@ module Squared
1290
1290
  end
1291
1291
 
1292
1292
  def print_error(*args, loglevel: Logger::WARN, **kwargs)
1293
- warn log_message(loglevel, *args, **kwargs) if warning?
1293
+ return unless warning?
1294
+
1295
+ warn log_message(loglevel, *args, **kwargs)
1294
1296
  end
1295
1297
 
1296
1298
  def print_item(*val)
@@ -1444,8 +1446,8 @@ module Squared
1444
1446
  "#{msg}#{!always && (!obj || obj == 0 || obj.to_s.empty?) ? '' : message(hint: message(title, obj.to_s))}"
1445
1447
  end
1446
1448
 
1447
- def append_repeat(flag, opts, target: @session)
1448
- opts.each { |val| target << shell_option(flag, val) }
1449
+ def append_repeat(flag, opts, target: @session, **kwargs)
1450
+ opts.each { |val| target << shell_option(flag, val, **kwargs) }
1449
1451
  end
1450
1452
 
1451
1453
  def append_hash(data, target: @session || [], build: false)
@@ -1471,6 +1473,8 @@ module Squared
1471
1473
  target << basic_option(key, val)
1472
1474
  when FalseClass
1473
1475
  target << shell_option(key).sub(/^--(?!no-)/, '--no-')
1476
+ when Pathname
1477
+ target << shell_option(key, val, escape: false)
1474
1478
  else
1475
1479
  target << shell_option(key, val.is_a?(String) ? val : nil)
1476
1480
  end
@@ -1855,17 +1859,15 @@ module Squared
1855
1859
  pwd = Pathname.pwd
1856
1860
  if block_given?
1857
1861
  begin
1858
- if (path == pwd || pass == true) && (workspace.mri? || !workspace.windows?)
1859
- ret = yield
1860
- else
1861
- Dir.chdir path
1862
- ret = yield
1863
- Dir.chdir pwd
1862
+ unless (path == pwd || pass == true) && (workspace.mri? || !workspace.windows?)
1863
+ restore = true
1864
+ Dir.chdir(path)
1864
1865
  end
1866
+ yield
1865
1867
  rescue StandardError => e
1866
1868
  on_error(e, from, dryrun: dryrun)
1867
- else
1868
- ret
1869
+ ensure
1870
+ Dir.chdir(pwd) if restore
1869
1871
  end
1870
1872
  elsif @pwd == pwd
1871
1873
  @pwd = nil
@@ -2052,7 +2054,7 @@ module Squared
2052
2054
 
2053
2055
  def runnable?(val)
2054
2056
  case val
2055
- when String, Enumerable, Proc, Method
2057
+ when String, Enumerable, Proc, Method, Struct
2056
2058
  true
2057
2059
  else
2058
2060
  false
@@ -2111,14 +2113,9 @@ module Squared
2111
2113
  end
2112
2114
 
2113
2115
  def has_value?(data, other)
2114
- case data
2115
- when Hash
2116
- other.is_a?(Enumerable) ? other.any? { |obj| data.value?(obj) } : data.value?(other)
2117
- when Enumerable
2118
- other.is_a?(Enumerable) ? other.any? { |obj| data.include?(obj) } : data.include?(other)
2119
- else
2120
- false
2121
- end
2116
+ return false unless data.is_a?(Enumerable)
2117
+
2118
+ other.is_a?(Enumerable) ? other.any? { |obj,| data.include?(obj) } : data.include?(other)
2122
2119
  end
2123
2120
 
2124
2121
  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
@@ -1696,7 +1696,7 @@ module Squared
1696
1696
  cmd, opts = git_session('rev-parse', opts: opts)
1697
1697
  case flag
1698
1698
  when :commit
1699
- cmd << ((n = size.to_i) > 0 ? basic_option('short', [n, 5].max) : '--verify')
1699
+ cmd << (size.to_i.zero? ? '--verify' : basic_option('short', [size.to_i, 5].max))
1700
1700
  append_commit(ref, head: true)
1701
1701
  when :branch
1702
1702
  cmd << '--abbrev-ref'
@@ -1760,12 +1760,11 @@ module Squared
1760
1760
  grep, list = op.partition { |val| OptionPartition.pattern?(val) }
1761
1761
  unless grep.empty? && !list.empty?
1762
1762
  grep.map! { |val| Regexp.new(val[1..-2]) }
1763
- files = [].tap do |out|
1764
- status_data.each do |a, b|
1765
- next if b.strip.empty? || (!grep.empty? && grep.none? { |pat| pat.match?(a) })
1763
+ files = []
1764
+ status_data.each do |a, b|
1765
+ next if b.strip.empty? || (!grep.empty? && grep.none? { |pat| pat.match?(a) })
1766
1766
 
1767
- out << "#{sub_style(b, styles: color(:red))} #{a}"
1768
- end
1767
+ files << "#{sub_style(b, styles: color(:red))} #{a}"
1769
1768
  end
1770
1769
  unless files.empty?
1771
1770
  files = choice_index('Select files', files, multiple: true, force: true, trim: /^\S+\s/,
@@ -1921,7 +1920,7 @@ module Squared
1921
1920
  end
1922
1921
  args = []
1923
1922
  args << quote_option('sort', sort) if sort
1924
- args << shell_option('count', env('GIT_COUNT', ARG[:CHOICE])) if count
1923
+ args << basic_option('count', env('GIT_COUNT', ARG[:CHOICE])) if count
1925
1924
  choice_index(msg, foreachref(type, *args, format: format), trim: trim, **kwargs)
1926
1925
  end
1927
1926
 
@@ -1954,13 +1953,13 @@ module Squared
1954
1953
  end
1955
1954
 
1956
1955
  def status_data(*args)
1957
- [].tap do |ret|
1958
- git_spawn('status -z -uall', *args).split("\x0").each do |line|
1959
- next unless line =~ /^(.)(.) (.+)$/
1956
+ ret = []
1957
+ git_spawn('status -z -uall', *args).split("\x0").each do |line|
1958
+ next unless line =~ /^(.)(.) (.+)$/
1960
1959
 
1961
- ret << [$3, $2, $1]
1962
- end
1960
+ ret << [$3, $2, $1]
1963
1961
  end
1962
+ ret
1964
1963
  end
1965
1964
 
1966
1965
  def append_pull(opts, list, target: @session, flag: nil, no: nil, remote: nil, from: nil)
@@ -2037,7 +2036,9 @@ module Squared
2037
2036
 
2038
2037
  def append_message(val = nil, target: @session)
2039
2038
  val = messageopt if val.to_s.empty?
2040
- target << quote_option('message', val) if val
2039
+ return unless val
2040
+
2041
+ target << quote_option('message', val)
2041
2042
  end
2042
2043
 
2043
2044
  def append_head(val = nil, target: @session)
@@ -158,7 +158,8 @@ module Squared
158
158
  elsif exception
159
159
  indexerror n, list
160
160
  else
161
- next log.warn "run script #{n} of #{list.size} (out of range)"
161
+ log.warn "run script #{n} of #{list.size} (out of range)"
162
+ next
162
163
  end
163
164
  run compose(val, script: true)
164
165
  else
@@ -269,6 +270,8 @@ module Squared
269
270
 
270
271
  def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil, files: nil, workspace: false,
271
272
  link: false, force: false, override: false, sync: invoked_sync?('copy'), **kwargs)
273
+ return if @copy == false
274
+
272
275
  glob = kwargs[:include]
273
276
  pass = kwargs[:exclude]
274
277
  if @copy && !override
@@ -285,8 +288,6 @@ module Squared
285
288
  create = @copy[:create] if @copy.key?(:create)
286
289
  glob = @copy[:include] if @copy.key?(:include)
287
290
  pass = @copy[:exclude] if @copy.key?(:exclude)
288
- elsif @copy == false
289
- return
290
291
  end
291
292
  items = []
292
293
  if build? && path != @workspace.home && @workspace.home?
@@ -857,7 +858,7 @@ module Squared
857
858
  end
858
859
 
859
860
  def outdated?
860
- dependfile.exist?
861
+ dependfile.exist? && !task_pass?('outdated')
861
862
  end
862
863
 
863
864
  def update?
@@ -602,7 +602,7 @@ module Squared
602
602
  end
603
603
 
604
604
  def outdated?
605
- dependtype > 0
605
+ dependtype > 0 && !task_pass?('outdated')
606
606
  end
607
607
 
608
608
  private
@@ -614,7 +614,7 @@ module Squared
614
614
  def python_session(*cmd, opts: nil)
615
615
  return session('python', *preopts(quiet: false), *cmd, path: venv.nil?) unless opts
616
616
 
617
- op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: /\A(?:v+|OO)\z/)
617
+ op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: singleopt(:python))
618
618
  ret = session('python', *op.to_a, *cmd, path: venv.nil?)
619
619
  [ret, op.extras]
620
620
  end
@@ -712,7 +712,7 @@ module Squared
712
712
  quote_option('cache-dir', basepath(val))
713
713
  end
714
714
  end
715
- target << shell_option('proxy', val) if (val = option('proxy', target: target))
715
+ target << quote_option('proxy', val) if (val = option('proxy', target: target))
716
716
  target << quote_option('python', basepath(val)) if (val = option('python', target: target))
717
717
  append_nocolor(target: target)
718
718
  end
@@ -793,7 +793,7 @@ module Squared
793
793
  def singleopt(flag = nil)
794
794
  case flag
795
795
  when :python
796
- /\A(?:v+|q+|b+)\z/
796
+ /\A(?:v+|q+|b+|V+|O+)\z/
797
797
  when :twine
798
798
  nil
799
799
  else
@@ -288,6 +288,8 @@ module Squared
288
288
  end
289
289
 
290
290
  def copy(from: gemlib, into: @gemdir, override: false, **kwargs)
291
+ return if @copy == false
292
+
291
293
  glob = kwargs[:include]
292
294
  pass = kwargs[:exclude]
293
295
  if @copy && !override
@@ -297,8 +299,6 @@ module Squared
297
299
  glob = @copy[:include] if @copy.key?(:include)
298
300
  pass = @copy[:exclude] if @copy.key?(:exclude)
299
301
  into = @copy[:into] if @copy.key?(:into)
300
- elsif @copy == false
301
- return
302
302
  end
303
303
  return unless into
304
304
 
@@ -462,13 +462,15 @@ module Squared
462
462
  case flag
463
463
  when :file, :script
464
464
  op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, args: true)
465
- if file
466
- op.unshift(shell_quote(basepath(file)))
467
- elsif command
465
+ if command
468
466
  op << quote_option('e', command, option: false)
467
+ elsif file
468
+ op.unshift(basepath(file))
469
+ end
470
+ unless op.arg?('e')
471
+ op.push(args) if args
472
+ op.append(delim: true, escape: false, quote: false) unless op.empty?
469
473
  end
470
- op.push(args) if args
471
- op.append(delim: true, escape: false, quote: false) unless op.empty?
472
474
  when :version
473
475
  pwd_set do
474
476
  out = []
@@ -763,7 +765,7 @@ module Squared
763
765
  else
764
766
  [name[0, n], name[(n + 1)..-1]]
765
767
  end
766
- op.adjoin(pre, shell_option('version', ver))
768
+ op.adjoin(pre, basic_option('version', ver))
767
769
  .clear
768
770
  elsif flag == :install
769
771
  op.append_any
@@ -828,13 +830,8 @@ module Squared
828
830
  end
829
831
 
830
832
  def gemspec
831
- return @gemspec unless @gemspec.nil?
832
-
833
- @gemspec = if gemfile
834
- Gem::Specification.load(gemfile.to_s) rescue false
835
- else
836
- false
837
- end
833
+ @gemspec = !gemfile.nil? && Gem::Specification.load(gemfile.to_s) rescue false if @gemspec.nil?
834
+ @gemspec || nil
838
835
  end
839
836
 
840
837
  def gemname
@@ -924,7 +921,7 @@ module Squared
924
921
  end
925
922
 
926
923
  def outdated?
927
- dependtype > 0
924
+ dependtype > 0 && !task_pass?('outdated')
928
925
  end
929
926
 
930
927
  private
@@ -994,10 +991,11 @@ module Squared
994
991
  end
995
992
 
996
993
  def rakefile
997
- return @rakefile unless @rakefile.nil?
998
-
999
- file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
1000
- @rakefile = file ? basepath(file) : false
994
+ if @rakefile.nil?
995
+ file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
996
+ @rakefile = !file.nil? && basepath(file)
997
+ end
998
+ @rakefile || nil
1001
999
  end
1002
1000
 
1003
1001
  def rakepwd
@@ -1026,11 +1024,12 @@ module Squared
1026
1024
  end
1027
1025
 
1028
1026
  def gemfile
1029
- return @gemfile unless @gemfile.nil?
1030
-
1031
- @gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
1032
- .concat(Dir.glob(basepath('*.gemspec')))
1033
- .find { |file| File.exist?(file) } || false
1027
+ if @gemfile.nil?
1028
+ @gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
1029
+ .concat(Dir.glob(basepath('*.gemspec')))
1030
+ .find { |file| File.exist?(file) } || false
1031
+ end
1032
+ @gemfile || nil
1034
1033
  end
1035
1034
 
1036
1035
  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
- if escape || quote
33
- ret.map! do |val|
34
- if opt?(val)
35
- val
36
- elsif escape
37
- shell_escape(val, quote: quote, double: double)
38
- else
39
- shell_quote(val, force: force, double: double)
40
- end
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)
@@ -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('REPO_URL') || manifest_url
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
@@ -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
- __get__(:project).find { |_, val| File.expand_path(val.path) == File.expand_path(id) }
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.4.30
4
+ version: 0.4.31
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: 3.7.2
128
+ rubygems_version: 3.6.9
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []