squared 0.2.2 → 0.2.3

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: 82c53d370d6535fd30824fafd72a2f68fd7db161600d2740fd643f270d68d6f6
4
- data.tar.gz: 26b8eb9e45b508923bacce4bc06502d3031fc7a8b9c844dfd02775a86191ec3c
3
+ metadata.gz: 3bc7bf1e798295581f3dcbd052d367f159a91bff55bc4bbcbe3862a6d4c39739
4
+ data.tar.gz: '03919adb276a1ed4b25b217776e28d4525c90e4ffe5af508b883d3480f4fbf23'
5
5
  SHA512:
6
- metadata.gz: f32e8ae4585c328c298791628eca4e18e00ac2818bee7aa9c5e1f1f680fd6b60f0a59cc1fd1b4313794d1d7d926dfc195762cf9912e83034d553d248f90f8743
7
- data.tar.gz: '091805806ce97b61bf45f6df58bf5232ce75f65e0d1bcbcdffb0aed949e3e38200b5ea8d9bd600e9c2150e24296af2faf2ac3a99312ec290112bf55770ea38a7'
6
+ metadata.gz: 4ad94be493ad60c59ed738d59884bbfd815cddd8ddbe31ad6be4fd6f0e7ddf70b6b7bd6b70d65ab4b14caa99d1480f7cb985f02d39351d5a4554f6f6a91cb6a3
7
+ data.tar.gz: 98783c78e94aa41d5f331110129f329cfe2c80e87e008a8d453cc0f4851701cc538524b7fe924ae19e58689641a9be2b131e354386566ee4344b7b831539cd42
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.3] - 2025-02-05
4
+
5
+ ### Fixed
6
+
7
+ - Project hash options duplicated dash prefix.
8
+ - Pip upgrade did not append package names.
9
+
3
10
  ## [0.2.2] - 2025-01-19
4
11
 
5
12
  ### Fixed
@@ -169,6 +176,7 @@
169
176
 
170
177
  - Changelog was created.
171
178
 
179
+ [0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-ruby
172
180
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
173
181
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
174
182
  [0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
data/README.ruby.md CHANGED
@@ -335,16 +335,16 @@ Common::PATH.merge!({
335
335
  # :env :run :opts
336
336
  # LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -c
337
337
  BUILD_${NAME} # gcc a.c -o a.o
338
- BUILD_OPTS_${NAME} # -c
339
- BUILD_ENV_${NAME} # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
338
+ BUILD_${NAME}_OPTS # -c
339
+ BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
340
340
 
341
341
  # :env :opts :script
342
342
  # NODE_ENV="production" NO_COLOR="1" npm run --loglevel=error --workspaces=false build:dev
343
343
  BUILD_${NAME} # build:dev
344
- BUILD_OPTS_${NAME} # --loglevel=error --workspaces=false
345
- BUILD_ENV_${NAME} # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
346
- BUILD_DEV_${NAME} # pattern,0,1 (:dev)
347
- BUILD_PROD_${NAME} # pattern,0,1 (:prod)
344
+ BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
345
+ BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
346
+ BUILD_${NAME}_DEV # pattern,0,1 (:dev)
347
+ BUILD_${NAME}_PROD # pattern,0,1 (:prod)
348
348
 
349
349
  BUILD_${NAME}=0 # skip project
350
350
  ```
@@ -40,7 +40,12 @@ module Squared
40
40
  end
41
41
 
42
42
  def shell_option(flag, val = nil, escape: true, quote: true)
43
- a, b = flag.size == 1 ? ['-', ' '] : ['--', '=']
43
+ flag = flag.to_s
44
+ if flag[0] == '-'
45
+ b = flag[1] == '-' ? '=' : ' '
46
+ else
47
+ a, b = flag.size == 1 ? ['-', ' '] : ['--', '=']
48
+ end
44
49
  "#{a}#{flag}#{if val
45
50
  "#{b}#{if escape
46
51
  shell_escape(val, quote: quote)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
@@ -992,21 +992,17 @@ module Squared
992
992
  def append_hash(opts, target: @session)
993
993
  out = target.to_s
994
994
  opts.each do |key, val|
995
- key = key.to_s
996
- key = shell_option(key) unless key[0] == '-'
997
- next if out =~ Regexp.new(" #{key}(?: |=|$)")
995
+ next if out =~ / #{Regexp.escape(shell_option(key))}(?: |=|$)/
998
996
 
999
997
  case val
1000
- when String
1001
- append_repeat(key, [val], target: target)
1002
998
  when Array
1003
999
  append_repeat(key, val, target: target)
1004
1000
  when Numeric
1005
- target << (key + (key.start_with?('--') ? '=' : '') + val.to_s)
1001
+ target << basic_option(key, val)
1006
1002
  when false
1007
- target << key.sub(/^--(?!no-)/, '--no-')
1003
+ target << shell_option(key).sub(/^--(?!no-)/, '--no-')
1008
1004
  else
1009
- target << key
1005
+ target << shell_option(key, val.is_a?(String) ? val : nil)
1010
1006
  end
1011
1007
  end
1012
1008
  end
@@ -4,11 +4,11 @@ module Squared
4
4
  module Workspace
5
5
  module Project
6
6
  class Python < Git
7
- REQUIREMENTS = %w[requirements.txt pyproject.toml setup.py].freeze
7
+ REQUIREMENTS = %w[requirements.txt pyproject.toml].freeze
8
8
  OPT_INSTALL = %w[I U break-system-packages check-build-dependencies compile dry-run force-reinstall
9
9
  ignore-installed ignore-requires-python no-build-isolation no-clean no-compile no-deps
10
10
  no-index no-warn-conflicts no-warn-script-location pre prefer-binary require-hashes upgrade
11
- use-pep517 user abi=s config-settings=s c=s constraint=s e=s editable=s extra-index-url=s
11
+ use-pep517 user abi=s config-settings=s c=s constraint=s e=s? editable=s? extra-index-url=s
12
12
  f=s find-links=s global-option=s implementation=s i=s index-url=s no-binary=s only-binary=s
13
13
  platform=s prefix=s progress-bar=s python-version=s report=s r=s requirement=s
14
14
  root-user-action=s root=s src=s t=s target=s upgrade-strategy=s].freeze
@@ -37,7 +37,7 @@ module Squared
37
37
  def config?(val)
38
38
  return false unless (val = as_path(val))
39
39
 
40
- REQUIREMENTS.any? { |file| val.join(file).exist? }
40
+ (REQUIREMENTS + ['setup.py']).any? { |file| val.join(file).exist? }
41
41
  end
42
42
  end
43
43
 
@@ -79,7 +79,7 @@ module Squared
79
79
  when :target
80
80
  'dir'
81
81
  when :upgrade
82
- 'strategy'
82
+ 'strategy?,packages+'
83
83
  end)
84
84
  end
85
85
  case flag
@@ -104,47 +104,32 @@ module Squared
104
104
  if @depend && !flag
105
105
  super
106
106
  elsif outdated?
107
- case (type = dependtype)
108
- when 1, 2
109
- cmd = pip_session 'install'
110
- case flag
111
- when :user
112
- cmd << '--user'
113
- when :upgrade
114
- cmd << '--upgrade'
115
- case param
116
- when 'eager', 'only-if-needed'
117
- cmd << basic_option('upgrade-strategy', param)
118
- else
119
- opts << param
120
- end
121
- when :force
122
- cmd << '--force-reinstall'
123
- when :target
124
- cmd << quote_option('target', basepath(param))
107
+ cmd = pip_session 'install'
108
+ case flag
109
+ when :user
110
+ cmd << '--user'
111
+ when :upgrade
112
+ cmd << '--upgrade'
113
+ case param
114
+ when 'eager', 'only-if-needed'
115
+ cmd << basic_option('upgrade-strategy', param)
125
116
  else
126
- append_global
117
+ opts << param
127
118
  end
128
- append_pip opts if flag
129
- if type == 2
119
+ when :force
120
+ cmd << '--force-reinstall'
121
+ when :target
122
+ cmd << quote_option('target', basepath(param))
123
+ else
124
+ append_global
125
+ end
126
+ append_pip flag, opts if flag
127
+ unless flag == :upgrade
128
+ if dependtype == 2 || cmd.find { |val| val =~ /^(?:-e|--editable)$/ }
130
129
  cmd << '.'
131
- elsif !cmd.find { |val| val =~ /^(?:-r|--requirement)/ }
130
+ elsif !cmd.find { |val| val =~ /^(?:-r|--requirement|-e|--editable)/ }
132
131
  cmd << '-r requirements.txt'
133
132
  end
134
- when 3
135
- cmd = python_session 'setup.py', 'install'
136
- case flag
137
- when :user
138
- cmd << '--user'
139
- when :target
140
- cmd << quote_option('build-base', basepath(dir))
141
- end
142
- if option('user')
143
- cmd << '--user'
144
- else
145
- append_first(%w[home prefix], equals: true, escape: false, quote: true, ignore: false)
146
- end
147
- cmd.delete('--user') if workspace.windows?
148
133
  end
149
134
  run(from: :depend, sync: sync)
150
135
  end
@@ -256,12 +241,12 @@ module Squared
256
241
  session('python', *cmd)
257
242
  end
258
243
 
259
- def append_pip(opts, list = nil, target: @session)
244
+ def append_pip(flag, opts, target: @session)
260
245
  append_nocolor(target: target)
261
246
  return if opts.empty?
262
247
 
263
248
  out = []
264
- opts, pat = option_partition(opts, list || (OPT_INSTALL + OPT_GENERAL), target: target)
249
+ opts, pat = option_partition(opts, OPT_INSTALL + OPT_GENERAL, target: target)
265
250
  opts.each do |opt|
266
251
  if opt =~ /^(v+|q+)$/
267
252
  cmd << "-#{$1}"
@@ -272,7 +257,7 @@ module Squared
272
257
  target << quote_option($1, basepath($2))
273
258
  when 'e', 'editable'
274
259
  val = $2
275
- target << quote_option($1, val =~ %r{^[a-z]+\+[a-z]+://} ? val : basepath(val))
260
+ target << quote_option($1, val =~ %r{^[a-z]+(?:\+[a-z]+)?://}i ? val : basepath(val))
276
261
  when 'proxy', 'config-settings', 'global-option', 'extra-index-url',
277
262
  'f', 'find-links', 'i', 'index-url'
278
263
  target << quote_option($1, $2)
@@ -285,7 +270,11 @@ module Squared
285
270
  out << opt
286
271
  end
287
272
  end
288
- option_clear(out, target: target)
273
+ if flag == :upgrade
274
+ append_value(out, delim: true)
275
+ else
276
+ option_clear(out, target: target)
277
+ end
289
278
  end
290
279
 
291
280
  def append_global
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-19 00:00:00.000000000 Z
10
+ date: 2025-02-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.6.2
109
+ rubygems_version: 3.6.3
110
110
  specification_version: 4
111
111
  summary: Rake task generator for managing multi-language workspaces.
112
112
  test_files: []