squared 0.4.14 → 0.5.1
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 +37 -0
- data/README.md +4 -4
- data/README.ruby.md +14 -11
- data/lib/squared/common/base.rb +5 -3
- data/lib/squared/common/format.rb +1 -1
- data/lib/squared/common/prompt.rb +44 -40
- data/lib/squared/common/shell.rb +13 -8
- data/lib/squared/common/system.rb +33 -29
- data/lib/squared/common/utils.rb +0 -12
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +14 -13
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +16 -21
- data/lib/squared/workspace/project/base.rb +97 -132
- data/lib/squared/workspace/project/docker.rb +31 -30
- data/lib/squared/workspace/project/git.rb +74 -73
- data/lib/squared/workspace/project/node.rb +31 -20
- data/lib/squared/workspace/project/python.rb +11 -7
- data/lib/squared/workspace/project/ruby.rb +31 -31
- data/lib/squared/workspace/project/support/class.rb +80 -5
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +6 -6
- data/lib/squared/workspace/series.rb +8 -8
- data/lib/squared/workspace/support/data.rb +1 -0
- data/lib/squared/workspace.rb +1 -1
- data/squared.gemspec +1 -1
- metadata +2 -3
- data/lib/squared/common/class.rb +0 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aeb7a32f99a22618e2c6c497d6de2f911df5d126232c63ed986324fc5b31aa7
|
4
|
+
data.tar.gz: fb144ac3238fcaf22f1c8bf4218847f547db9d03904a45ef8f040501df1ecc9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c026101681bf8869138b6882044b60dd3b515d2f61feee9529c4ed70f048c1ceca39538ebe4ac3985c974aeff36b22506d4f5429f9b6eb7ac7d5400a14e737b
|
7
|
+
data.tar.gz: c53bc01a5dbdb5653d67eab02b3bd93229b8cda4fef6d97da16826d70069ab03c085086c49a045281e2da732957a1e920595abd52374bbf76c898f7e63dfe39b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.5.1] - 2025-07-05
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
- Common method confirm will automatically append hint with defaults.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Gem command push did not prompt for gem to publish.
|
12
|
+
|
3
13
|
## [0.4.14] - 2025-07-05
|
4
14
|
|
5
15
|
### Added
|
@@ -62,6 +72,31 @@
|
|
62
72
|
- Common method is used for Kernel shell commands.
|
63
73
|
- Git did not highlight output for single commands.
|
64
74
|
|
75
|
+
## [0.5.0] - 2025-06-16
|
76
|
+
|
77
|
+
### Added
|
78
|
+
|
79
|
+
- Node command exec through NVM was implemented.
|
80
|
+
- Git command options were updated to version 2.49.
|
81
|
+
|
82
|
+
### Changed
|
83
|
+
|
84
|
+
- Gem specification required Ruby version set to 2.5.
|
85
|
+
- Docker build options from ENV do not require dashes.
|
86
|
+
- Unused task descriptions are not generated.
|
87
|
+
- Class object shapes were declared in initialize.
|
88
|
+
- Project outdated interactive uses a more compact prompt.
|
89
|
+
- Workspace banner configuration uses a struct.
|
90
|
+
|
91
|
+
### Removed
|
92
|
+
|
93
|
+
- Git commit hash identifier uses only a colon for a prefix.
|
94
|
+
- Common module for classes was delegated to support namespaces.
|
95
|
+
|
96
|
+
### Fixed
|
97
|
+
|
98
|
+
- Project private variables external modification was revised.
|
99
|
+
|
65
100
|
## [0.4.13] - 2025-06-16
|
66
101
|
|
67
102
|
### Added
|
@@ -802,6 +837,8 @@
|
|
802
837
|
|
803
838
|
- Changelog was created.
|
804
839
|
|
840
|
+
[0.5.1]: https://github.com/anpham6/squared/releases/tag/v0.5.1-ruby
|
841
|
+
[0.5.0]: https://github.com/anpham6/squared/releases/tag/v0.5.0-ruby
|
805
842
|
[0.4.14]: https://github.com/anpham6/squared/releases/tag/v0.4.14-ruby
|
806
843
|
[0.4.13]: https://github.com/anpham6/squared/releases/tag/v0.4.13-ruby
|
807
844
|
[0.4.12]: https://github.com/anpham6/squared/releases/tag/v0.4.12-ruby
|
data/README.md
CHANGED
@@ -140,13 +140,13 @@ rake clone # node + docs
|
|
140
140
|
# PIPE_FAIL={0,1}
|
141
141
|
# PORT=3000
|
142
142
|
docker build -t squared --build-arg MANIFEST=prod --build-arg NODE_ENV=production .
|
143
|
-
docker build -t node --build-arg NODE_TAG=22 --build-arg NODE_INSTALL=pnpm -f slim
|
143
|
+
docker build -t node --build-arg NODE_TAG=22 --build-arg NODE_INSTALL=pnpm -f Dockerfile.slim .
|
144
144
|
NODE=22 docker buildx bake node
|
145
145
|
# OR
|
146
|
-
docker build -t ruby --build-arg RUBY_TAG=3.4.0 --build-arg NODE_VERSION=22 --build-arg PIPE_FAIL=0 -f ruby
|
146
|
+
docker build -t ruby --build-arg RUBY_TAG=3.4.0 --build-arg NODE_VERSION=22 --build-arg PIPE_FAIL=0 -f Dockerfile.ruby .
|
147
147
|
RUBY=3.4.0 docker buildx bake ruby
|
148
148
|
# OR
|
149
|
-
docker build -t nginx --build-arg NGINX_VERSION=1.27 --build-arg PORT=3000 --build-arg NODE_VERSION=20 -f nginx
|
149
|
+
docker build -t nginx --build-arg NGINX_VERSION=1.27 --build-arg PORT=3000 --build-arg NODE_VERSION=20 -f Dockerfile.nginx .
|
150
150
|
NGINX=1.27 docker buildx bake nginx
|
151
151
|
|
152
152
|
# Express
|
@@ -1359,4 +1359,4 @@ NOTE: Defining an element "**id**" will prevent it from being removed during the
|
|
1359
1359
|
|
1360
1360
|
## LICENSE
|
1361
1361
|
|
1362
|
-
BSD 3-Clause
|
1362
|
+
BSD 3-Clause
|
data/README.ruby.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
# squared 0.
|
1
|
+
# squared 0.5
|
2
2
|
|
3
3
|
* [source](https://github.com/anpham6/squared)
|
4
4
|
* [docs](https://squared.readthedocs.io)
|
5
5
|
|
6
6
|
## Version Compatibility
|
7
7
|
|
8
|
-
| Date | squared | Min | Max |
|
9
|
-
| :--------: | ------: | -----: | -----: |
|
10
|
-
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 |
|
11
|
-
| 2025-01-07 | 0.2.0 |
|
12
|
-
| 2025-02-07 | 0.3.0 |
|
13
|
-
| 2025-03-06 | 0.4.0 |
|
8
|
+
| Date | squared | Min | Max |
|
9
|
+
| :--------: | ------: | -----: | -----: |
|
10
|
+
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 |
|
11
|
+
| 2025-01-07 | 0.2.0 | | 3.4.0 |
|
12
|
+
| 2025-02-07 | 0.3.0 | | 3.4.1 |
|
13
|
+
| 2025-03-06 | 0.4.0 | | 3.4.2 |
|
14
|
+
| 2025-06-16 | 0.5.0 | 2.5.0 | 3.4.3 |
|
14
15
|
|
15
16
|
The range chart indicates the latest Ruby tested against at the time of release.
|
16
17
|
|
@@ -263,7 +264,7 @@ Workspace::Application
|
|
263
264
|
add("squared") do
|
264
265
|
revbuild(include: %w[src/ framework/ types/]) # Git revision build command (optional)
|
265
266
|
chain "all", "revbuild", after: "express:build" # step: 4
|
266
|
-
chain "publish", "bump:patch", "publish:latest", step: 0, sync: true # rake publish
|
267
|
+
chain "publish", "bump:patch", "publish:latest", step: 0, sync: true # rake publish
|
267
268
|
end
|
268
269
|
end
|
269
270
|
.with(:python) do
|
@@ -275,12 +276,12 @@ Workspace::Application
|
|
275
276
|
chain "all", "doc", with: "squared", before: "squared:revbuild" # Same
|
276
277
|
end
|
277
278
|
end
|
278
|
-
.chain
|
279
|
+
.chain("all", "status", with: "squared", after: "android-docs") # Global tasks (e.g. without ":")
|
279
280
|
.build
|
280
281
|
```
|
281
282
|
|
282
283
|
```sh
|
283
|
-
rake all
|
284
|
+
rake all # all[1-3-4]
|
284
285
|
rake all:print
|
285
286
|
```
|
286
287
|
|
@@ -537,7 +538,6 @@ Commands which use commit hashes are parsed using a ":" prefix as to not be conf
|
|
537
538
|
|
538
539
|
```sh
|
539
540
|
rake squared:log:view[:af012345] # git log af012345
|
540
|
-
rake squared:log:view[#{af012345}] # deprecated
|
541
541
|
rake squared:log:view[H1,HEAD^5,all,lib,./H12345] # git log --all @~1 @^5 -- 'lib' 'H12345'
|
542
542
|
```
|
543
543
|
|
@@ -683,6 +683,9 @@ DOCKER_TAG=latest # all
|
|
683
683
|
DOCKER_TAG_${NAME}=v0.1.0 # project only (override)
|
684
684
|
DOCKER_ALL=1 # list every image/container
|
685
685
|
DOCKER_Y=1 # confirm all
|
686
|
+
|
687
|
+
BUILD_SQUARED_OPTS="NODE_TAG=24 RUBY_VERSION=3.4.0" DOCKER_SQUARED_OPTS="--no-cache --label=v1" rake squared:build
|
688
|
+
docker build --no-cache --label=v1 --build-arg='NODE_TAG=24' --build-arg='RUBY_VERSION=3.4.0' .
|
686
689
|
```
|
687
690
|
|
688
691
|
| Command | Flag | ENV |
|
data/lib/squared/common/base.rb
CHANGED
@@ -100,7 +100,7 @@ module Squared
|
|
100
100
|
|
101
101
|
module_function
|
102
102
|
|
103
|
-
def as_a(obj, meth
|
103
|
+
def as_a(obj, *meth, flat: nil, compact: false, &blk)
|
104
104
|
return [] if obj.nil?
|
105
105
|
|
106
106
|
unless obj.is_a?(::Array)
|
@@ -114,8 +114,10 @@ module Squared
|
|
114
114
|
end
|
115
115
|
obj = flat.is_a?(::Numeric) ? obj.flatten(flat) : obj.flatten if flat
|
116
116
|
obj = obj.compact if compact
|
117
|
-
obj = obj.map(&meth)
|
118
|
-
|
117
|
+
obj = obj.map(&meth.shift) until meth.empty?
|
118
|
+
return obj unless block_given?
|
119
|
+
|
120
|
+
obj.select(&blk)
|
119
121
|
end
|
120
122
|
end
|
121
123
|
end
|
@@ -8,27 +8,33 @@ module Squared
|
|
8
8
|
def confirm(msg, default = nil, agree: 'Y', cancel: 'N', attempts: 5, timeout: 30)
|
9
9
|
require 'readline'
|
10
10
|
require 'timeout'
|
11
|
+
if agree == 'Y' && cancel == 'N' && !msg.match?(%r{\[(?:Yn|nY|Y/n|y/N)\]})
|
12
|
+
case default
|
13
|
+
when 'Y'
|
14
|
+
msg = "#{msg} [Y/n] "
|
15
|
+
when 'N'
|
16
|
+
msg = "#{msg} [y/N] "
|
17
|
+
end
|
18
|
+
end
|
11
19
|
agree = /^#{Regexp.escape(agree)}$/i if agree.is_a?(::String)
|
12
20
|
cancel = /^#{Regexp.escape(cancel)}$/i if cancel.is_a?(::String)
|
13
21
|
Timeout.timeout(timeout) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
return false
|
22
|
-
end
|
23
|
-
attempts -= 1
|
24
|
-
exit 1 unless attempts > 0
|
22
|
+
while (ch = Readline.readline(msg))
|
23
|
+
ch = ch.chomp
|
24
|
+
case (ch.empty? ? default : ch)
|
25
|
+
when agree
|
26
|
+
return true
|
27
|
+
when cancel
|
28
|
+
return false
|
25
29
|
end
|
26
|
-
|
27
|
-
|
28
|
-
exit 0
|
29
|
-
else
|
30
|
-
false
|
30
|
+
attempts -= 1
|
31
|
+
exit 1 unless attempts > 0
|
31
32
|
end
|
33
|
+
rescue Interrupt
|
34
|
+
puts
|
35
|
+
exit 0
|
36
|
+
else
|
37
|
+
false
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
@@ -43,7 +49,7 @@ module Squared
|
|
43
49
|
next if grep&.none? { |pat| pat.match?(line) }
|
44
50
|
|
45
51
|
items << val.chomp
|
46
|
-
puts
|
52
|
+
puts '%2d. %s' % [items.size, val]
|
47
53
|
end
|
48
54
|
max = items.size
|
49
55
|
raise_error 'empty selection list' if max == 0
|
@@ -56,33 +62,31 @@ module Squared
|
|
56
62
|
end
|
57
63
|
valid = ->(s) { s.match?(/^-?\d+$/) && s.to_i.between?(min, max) }
|
58
64
|
Timeout.timeout(timeout) do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
next if multiple.is_a?(::Numeric) && multiple != b.size
|
65
|
+
while (ch = Readline.readline(msg))
|
66
|
+
unless (ch = ch.strip).empty?
|
67
|
+
if multiple
|
68
|
+
a = ch.split(/\s*,\s*/)
|
69
|
+
b = a.select { |s| valid.call(s) }.map!(&:to_i).sort
|
70
|
+
next unless a.size == b.size
|
71
|
+
return b unless items
|
72
|
+
next if multiple.is_a?(::Numeric) && multiple != b.size
|
68
73
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
74
|
+
return b.map! { |i| items[i - 1] }
|
75
|
+
elsif valid.call(ch)
|
76
|
+
return items ? items[ch.to_i - 1] : ch.to_i
|
73
77
|
end
|
74
|
-
attempts -= 1
|
75
|
-
next if attempts > 0
|
76
|
-
break unless force
|
77
|
-
|
78
|
-
exit 1
|
79
78
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
attempts -= 1
|
80
|
+
next if attempts > 0
|
81
|
+
break unless force
|
82
|
+
|
83
|
+
exit 1
|
85
84
|
end
|
85
|
+
rescue Interrupt
|
86
|
+
puts
|
87
|
+
exit 0
|
88
|
+
else
|
89
|
+
multiple ? [] : nil
|
86
90
|
end
|
87
91
|
end
|
88
92
|
|
data/lib/squared/common/shell.rb
CHANGED
@@ -85,26 +85,31 @@ module Squared
|
|
85
85
|
end}"
|
86
86
|
end
|
87
87
|
|
88
|
-
def shell_split(val,
|
88
|
+
def shell_split(val, join: nil, **kwargs)
|
89
89
|
ret = val.shellsplit
|
90
|
-
ret.map! { |opt| shell_escape(opt,
|
90
|
+
ret.map! { |opt| shell_escape(opt, double: true, option: true, **kwargs) }
|
91
91
|
return ret unless join
|
92
92
|
|
93
93
|
ret.join(join.is_a?(::String) ? join : ' ')
|
94
94
|
end
|
95
95
|
|
96
|
-
def
|
96
|
+
def line_width(lines)
|
97
|
+
ret = [lines.max_by(&:size).size, 80].max
|
98
|
+
[ret, Rake.application.terminal_width].min
|
99
|
+
end
|
100
|
+
|
101
|
+
def fill_option(val, **kwargs)
|
97
102
|
return "-#{val}" if val.match?(/\A(?:[a-z]\d*|\d)\z/i)
|
98
103
|
|
99
|
-
shell_escape(val.start_with?('-') ? val : "--#{val}",
|
104
|
+
shell_escape(val.start_with?('-') ? val : "--#{val}", **kwargs)
|
100
105
|
end
|
101
106
|
|
102
|
-
def quote_option(flag, val,
|
103
|
-
shell_option(flag, val, escape: false,
|
107
|
+
def quote_option(flag, val, **kwargs)
|
108
|
+
shell_option(flag, val, escape: false, **kwargs)
|
104
109
|
end
|
105
110
|
|
106
|
-
def basic_option(flag, val,
|
107
|
-
shell_option(flag, val, escape: false, force: false,
|
111
|
+
def basic_option(flag, val, **kwargs)
|
112
|
+
shell_option(flag, val, escape: false, force: false, **kwargs)
|
108
113
|
end
|
109
114
|
end
|
110
115
|
end
|
@@ -29,27 +29,29 @@ module Squared
|
|
29
29
|
raise $?.to_s
|
30
30
|
end
|
31
31
|
|
32
|
-
def copy_dir(src, dest, glob = ['**/*'], create: false, link: nil, force: false, pass: nil,
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
def copy_dir(src, dest, glob = ['**/*'], create: false, link: nil, force: false, pass: nil, hidden: false,
|
33
|
+
verbose: true)
|
34
|
+
base = Pathname.new(src)
|
35
|
+
target = Pathname.new(dest)
|
36
|
+
raise "#{target.cleanpath} (not found)" if !create && !target.parent.exist?
|
36
37
|
|
37
38
|
subdir = {}
|
38
|
-
|
39
|
+
target.mkpath if create
|
40
|
+
flags = hidden ? [File::FNM_DOTMATCH] : []
|
39
41
|
if pass
|
40
42
|
exclude = []
|
41
|
-
Array(pass).each { |val| exclude.concat(Dir.glob(
|
43
|
+
Array(pass).each { |val| exclude.concat(Dir.glob(val, *flags, base: base)) }
|
42
44
|
end
|
43
45
|
Array(glob).each do |val|
|
44
|
-
Dir.glob(
|
45
|
-
next if exclude&.include?(
|
46
|
+
Dir.glob(val, *flags, base: base) do |file|
|
47
|
+
next if exclude&.include?(file) || (entry = base + file).directory?
|
46
48
|
|
47
|
-
dir =
|
49
|
+
dir = target.join(file).dirname
|
48
50
|
if (data = subdir[dir.to_s])
|
49
|
-
data <<
|
51
|
+
data << entry
|
50
52
|
else
|
51
53
|
dir.mkpath
|
52
|
-
subdir[dir.to_s] = [
|
54
|
+
subdir[dir.to_s] = [entry]
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
@@ -57,23 +59,24 @@ module Squared
|
|
57
59
|
soft = 0
|
58
60
|
subdir.each do |dir, files|
|
59
61
|
if link
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
files.dup.yield_self do |items|
|
63
|
+
files.clear
|
64
|
+
items.each do |file|
|
65
|
+
if file.exist?
|
66
|
+
if file.symlink?
|
67
|
+
next unless force
|
68
|
+
else
|
69
|
+
files << file
|
70
|
+
next
|
71
|
+
end
|
72
|
+
end
|
73
|
+
if link == 'hard'
|
74
|
+
FileUtils.ln(file, dir, force: force, verbose: false)
|
66
75
|
else
|
67
|
-
|
68
|
-
next
|
76
|
+
FileUtils.ln_s(file, dir, force: force, verbose: false)
|
69
77
|
end
|
78
|
+
soft += 1
|
70
79
|
end
|
71
|
-
if link == 'hard'
|
72
|
-
FileUtils.ln(file, dir, force: force, verbose: false)
|
73
|
-
else
|
74
|
-
FileUtils.ln_s(file, dir, force: force, verbose: false)
|
75
|
-
end
|
76
|
-
soft += 1
|
77
80
|
end
|
78
81
|
end
|
79
82
|
next if files.empty?
|
@@ -81,15 +84,16 @@ module Squared
|
|
81
84
|
out = FileUtils.cp(files, dir, verbose: false)
|
82
85
|
count += out.size
|
83
86
|
end
|
84
|
-
puts [
|
87
|
+
puts [target.realpath, subdir.size, soft > 0 ? "#{count}+#{soft}" : count].join(' => ') if verbose
|
85
88
|
end
|
86
89
|
|
87
90
|
def copy_guard(src, dest, link: nil, force: false, verbose: true)
|
88
91
|
unless force
|
89
|
-
|
90
|
-
|
92
|
+
target = Pathname.new(dest)
|
93
|
+
if target.directory?
|
94
|
+
src = Array(src).reject { |val| target.join(File.basename(val)).exist? }
|
91
95
|
return if src.empty?
|
92
|
-
elsif
|
96
|
+
elsif target.exist?
|
93
97
|
return
|
94
98
|
end
|
95
99
|
end
|
data/lib/squared/common/utils.rb
CHANGED
@@ -88,18 +88,6 @@ module Squared
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
def time_offset(val = nil)
|
92
|
-
val = DateTime.parse(val) if val.is_a?(::String)
|
93
|
-
cur = DateTime.now
|
94
|
-
ret = 0
|
95
|
-
if (r = /^([+-])(\d+):(\d+):(\d+)$/.match((val || cur).strftime('%::z')))
|
96
|
-
ret += (r[1] == '+' ? -1 : 1) * ((r[2].to_i * 60 * 60) + (r[3].to_i * 60) + r[4].to_i) * 1000
|
97
|
-
end
|
98
|
-
return ret unless val
|
99
|
-
|
100
|
-
(cur.strftime('%Q').to_i + time_offset) - (val.strftime('%Q').to_i + ret)
|
101
|
-
end
|
102
|
-
|
103
91
|
def time_since(val, ms: true)
|
104
92
|
s = ms ? '%s%L' : '%s'
|
105
93
|
Time.now.utc.strftime(s).to_i - Time.parse(val).utc.strftime(s).to_i
|
data/lib/squared/common.rb
CHANGED
data/lib/squared/config.rb
CHANGED
@@ -26,7 +26,7 @@ module Squared
|
|
26
26
|
def link(project, main = project.dependfile.basename, name = nil, **kwargs, &blk)
|
27
27
|
return unless project.enabled?
|
28
28
|
|
29
|
-
ret =
|
29
|
+
ret = new(main, name, project: project, **kwargs)
|
30
30
|
ret.instance_eval(&blk) if block_given?
|
31
31
|
ret
|
32
32
|
end
|
@@ -169,7 +169,7 @@ module Squared
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def style(name, *args)
|
172
|
-
apply_style
|
172
|
+
apply_style theme, name, args
|
173
173
|
self
|
174
174
|
end
|
175
175
|
|
@@ -212,7 +212,7 @@ module Squared
|
|
212
212
|
file = nil
|
213
213
|
ext[0] = mime
|
214
214
|
elsif file
|
215
|
-
keys.
|
215
|
+
keys.prepend(file)
|
216
216
|
alt = basepath("#{main}.{#{ext.join(',')}}")
|
217
217
|
file = Dir[alt].first
|
218
218
|
else
|
@@ -242,15 +242,16 @@ module Squared
|
|
242
242
|
[
|
243
243
|
{ pat: /\A((?:[^:]|(?<! ):(?! ))+)\z/, styles: theme[:banner] },
|
244
244
|
{ pat: /\A(.*?)(<[^>]+>)(.+)\z/m, styles: theme[:undefined], index: 2 },
|
245
|
-
{ pat: /\A(
|
246
|
-
{ pat: /\A(
|
245
|
+
{ pat: /\A((?~ : ))( : (?!undefined).+)\z/m, styles: theme[:key] },
|
246
|
+
{ pat: /\A((?~: ): )(-?[\d.]+)(\s*)\z/m, styles: theme[:number],
|
247
247
|
index: 2 },
|
248
|
-
{ pat: /\A(
|
249
|
-
{ pat: /\A(
|
250
|
-
{ pat: /\A(
|
251
|
-
{ pat: /\A(.+ : )(true|false)(\s*)\z/m, styles: theme[:boolean],
|
248
|
+
{ pat: /\A((?~: ): ")(.+)("\s*)\z/m, styles: theme[:string], index: 2 },
|
249
|
+
{ pat: /\A((?~: ): \{)(.+)(\}\s*)\z/m, styles: theme[:hash], index: 2 },
|
250
|
+
{ pat: /\A((?~: ): \[)(.+)(\]\s*)\z/m, styles: theme[:array],
|
252
251
|
index: 2 },
|
253
|
-
{ pat: /\A(
|
252
|
+
{ pat: /\A((?~: ): )(true|false)(\s*)\z/m, styles: theme[:boolean],
|
253
|
+
index: 2 },
|
254
|
+
{ pat: /\A((?~: ): (?!undefined))([^"\[{].*)\z/m, styles: theme[:value],
|
254
255
|
index: 2 }
|
255
256
|
]
|
256
257
|
end, border: theme[:border])
|
@@ -293,7 +294,7 @@ module Squared
|
|
293
294
|
if stdin?
|
294
295
|
puts out.map!(&:last).join("\n")
|
295
296
|
else
|
296
|
-
out.map! { |item|
|
297
|
+
out.map! { |item| '%-*s : %s' % [pad, item[0], item[1]] }
|
297
298
|
end
|
298
299
|
end
|
299
300
|
|
@@ -309,7 +310,7 @@ module Squared
|
|
309
310
|
return unless Rake::TaskManager.record_task_metadata
|
310
311
|
|
311
312
|
val = "#{ext.first}[#{target ? '' : "file?=#{File.basename(main)}.#{ext.last},"}keys+]"
|
312
|
-
args = *name.split(':').
|
313
|
+
args = *name.split(':').append(command, val)
|
313
314
|
if project
|
314
315
|
project.workspace.task_desc(*args)
|
315
316
|
else
|
@@ -347,7 +348,7 @@ module Squared
|
|
347
348
|
end
|
348
349
|
|
349
350
|
def basepath(file)
|
350
|
-
project ? project.basepath(file) : Pathname.
|
351
|
+
project ? project.basepath(file) : Pathname.pwd + file
|
351
352
|
end
|
352
353
|
end
|
353
354
|
end
|
data/lib/squared/version.rb
CHANGED