squared 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d000551aa00185dae3ea1bc7e3a61c64af96dce7d717339483d8cb572ca12d43
4
- data.tar.gz: 229f06052512ee06d16e43688602753a867025e8cf39b6b1c6dfafa69805fdbc
3
+ metadata.gz: 2d9e8c772c9f4d0ce5c54dbeb1b9583d2e477f155036faf34cfc547659c34ec4
4
+ data.tar.gz: 87de412a78c0071eabd4b26713cbf84978a92fca6ea1a6dfe18653ddf22c90ee
5
5
  SHA512:
6
- metadata.gz: 5efe60578369457075929b95ba8ea628d39d7324d40f84c397e07606c8c5fe48f07f797b940d7ca34a80321bb3f1435494c36afcd95432cbe8924e4353099f56
7
- data.tar.gz: daf832c4fbcf0e80459317be7b91781cfea9b653b3368cdbc090101d67ca59aff8b38940c2803100e322ca14bd25f45ccf37ef27bb348312b724c45babeb3393
6
+ metadata.gz: '08475f426b15c41dab20fbead5d7c1ead70f5d80384e0a0772cbe7b101512a4402a1bb1231b2550f7da16aac2796f8411f6a6e3e570ae728d59b03f88fea5960'
7
+ data.tar.gz: 5c0334640b20dda82641925cd94b41d76be4cd4e603355fef593a5cd69731ac926febab67f3ffa494267291ec9d89efba2f8a9ac4dde978ab2814a0f8a481a67
data/README.ruby.md CHANGED
@@ -59,7 +59,7 @@ require "squared/app" # All workspace related modules
59
59
 
60
60
  Workspace::Application
61
61
  .new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
62
- .banner("group", "project", styles: %i[yellow black], border: "bold") # name | project | path | ref | group? | parent? | version?
62
+ .banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
63
63
  .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
64
64
  .run("rake install", ref: :ruby)
65
65
  .depend(false, group: "default")
@@ -112,7 +112,7 @@ Workspace::Application
112
112
  }
113
113
  })
114
114
  .with(:python) do # ref=Symbol | group=String
115
- banner([:name, ': ', :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
115
+ banner([:name, ": ", :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
116
116
  doc("make html") # rake rb:doc:python
117
117
  run(false) # rake rb:build:python (disabled)
118
118
  exclude(%i[base git]) # Project::Git.ref (superclass)
@@ -125,6 +125,58 @@ Workspace::Application
125
125
 
126
126
  **NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
127
127
 
128
+ ### Graph
129
+
130
+ ```ruby
131
+ Workspace::Application
132
+ .new(main: "squared")
133
+ .with(:python) do
134
+ add("android-docs", "android")
135
+ add("chrome-docs", "chrome", graph: "android")
136
+ end
137
+ .with(:node) do
138
+ graph(["build", "copy"]) # Optional
139
+ add("e-mc", "emc")
140
+ add("pi-r", "pir", graph: "emc")
141
+ add("squared-express", "express", graph: "pir")
142
+ add("squared", graph: ["chrome", "express"])
143
+ end
144
+ .with(:ruby) do
145
+ add("pathname")
146
+ add("fileutils", graph: "pathname")
147
+ add("optparse")
148
+ add("rake", graph: ["fileutils", "optparse"])
149
+ end
150
+ .build
151
+ ```
152
+
153
+ ```sh
154
+ rake pir:graph # emc + pir
155
+ rake express:graph # emc + pir + express
156
+ rake chrome:graph # android + chrome
157
+ rake graph:python # same
158
+ rake squared:graph # android + chrome + emc + pir + express + squared
159
+ rake graph:node # same
160
+ rake rake:graph # pathname + fileutils + optparse + rake
161
+ rake graph:ruby # same
162
+ rake graph # graph:node + graph:ruby
163
+ ```
164
+
165
+ ### Batch
166
+
167
+ ```ruby
168
+ Workspace::Series.batch(:ruby, :node, {
169
+ stage: %i[graph test],
170
+ reset: %i[stash pull]
171
+ })
172
+ ```
173
+
174
+ ### Rename
175
+
176
+ ```ruby
177
+ Workspace::Series.rename("depend", "install")
178
+ ```
179
+
128
180
  ## Usage
129
181
 
130
182
  ```sh
@@ -165,6 +217,7 @@ Task:
165
217
 
166
218
  * run
167
219
  * depend
220
+ * graph
168
221
  * test
169
222
  * doc
170
223
  * clean
@@ -5,10 +5,12 @@ module Squared
5
5
  ARG = {
6
6
  PIPE: 1,
7
7
  OUT: nil,
8
+ VERBOSE: nil,
8
9
  FAIL: false,
9
10
  COMMON: true,
10
11
  BANNER: true,
11
12
  SPACE: ' => ',
13
+ GRAPH: ['│', '─', '├', '└', '┬'],
12
14
  COLOR: ENV.fetch('NO_COLOR', '').empty?
13
15
  }
14
16
  VAR = {
@@ -86,15 +88,15 @@ module Squared
86
88
  return [] if obj.nil?
87
89
 
88
90
  unless obj.is_a?(::Array)
89
- obj = if !obj.is_a?(::Hash) && obj.respond_to?(:to_a) && (val = obj.to_a).is_a?(::Array)
91
+ obj = if obj.respond_to?(:to_a) && !obj.is_a?(::Hash) && (val = obj.to_a).is_a?(::Array)
90
92
  val
91
93
  else
92
94
  [obj]
93
95
  end
94
96
  end
95
97
  obj = obj.flatten(flat.is_a?(::Numeric) ? flat : nil) if flat
96
- obj = obj.map(&meth) if meth
97
- compact ? obj.compact : obj
98
+ obj = obj.compact if compact
99
+ meth ? obj.map(&meth) : obj
98
100
  end
99
101
  end
100
102
  end
@@ -8,10 +8,14 @@ module Squared
8
8
  class SymSet
9
9
  extend Forwardable
10
10
 
11
- def_delegators :@data, :each, :each_with_index, :entries, :to_a, :include?
11
+ def self.to_s
12
+ super.match(/[^:]+$/)[0]
13
+ end
14
+
15
+ def_delegators :@data, :+, :each, :each_with_index, :entries, :to_a, :include?
12
16
 
13
17
  def initialize(data = [])
14
- @data = Set.new(data)
18
+ @data = ::Set.new(data)
15
19
  end
16
20
 
17
21
  def add(val)
@@ -26,6 +30,10 @@ module Squared
26
30
  end
27
31
 
28
32
  class JoinSet < ::Set
33
+ def self.to_s
34
+ super.match(/[^:]+$/)[0]
35
+ end
36
+
29
37
  def initialize(data = [], delim: ' ')
30
38
  super(data.compact)
31
39
  @delim = delim
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'pathname'
3
4
  require 'logger'
4
5
 
5
6
  require_relative 'base'
@@ -137,15 +138,15 @@ module Squared
137
138
  def log_sym(level)
138
139
  if level.is_a?(::Numeric)
139
140
  case level
140
- when Logger::DEBUG
141
+ when ::Logger::DEBUG
141
142
  :debug
142
- when Logger::INFO
143
+ when ::Logger::INFO
143
144
  :info
144
- when Logger::WARN
145
+ when ::Logger::WARN
145
146
  :warn
146
- when Logger::ERROR
147
+ when ::Logger::ERROR
147
148
  :error
148
- when Logger::FATAL
149
+ when ::Logger::FATAL
149
150
  :fatal
150
151
  else
151
152
  :unknown
@@ -186,8 +187,8 @@ module Squared
186
187
  def puts_oe(*args, pipe: 1)
187
188
  if pipe.is_a?(::Pathname)
188
189
  begin
189
- File.open(pipe, 'a') do |f|
190
- br = File::SEPARATOR == '\\' ? "\r\n" : "\n"
190
+ ::File.open(pipe, 'a') do |f|
191
+ br = ::File::SEPARATOR == '\\' ? "\r\n" : "\n"
191
192
  args.flatten.each { |val| f.write("#{strip_style(val.chomp)}#{br}") }
192
193
  end
193
194
  return
@@ -204,22 +205,23 @@ module Squared
204
205
  (empty ? args.reject { |val| val.nil? || val.empty? } : args).join(ARG[:SPACE]) + (hint ? " (#{hint})" : '')
205
206
  end
206
207
 
207
- def emphasize(val, title: nil, footer: nil, cols: nil, sub: nil, border: nil, pipe: nil)
208
+ def emphasize(val, title: nil, footer: nil, right: false, cols: nil, sub: nil, border: nil, pipe: nil)
208
209
  n = 0
209
- set = lambda do |l|
210
- ret = as_a(l, :to_s)
211
- n = ret.max_by(&:size).size
210
+ max = ->(v) { n = [n, v.max_by(&:size).size].max }
211
+ set = lambda do |v|
212
+ ret = as_a(v, :to_s)
213
+ max.(ret)
212
214
  ret
213
215
  end
214
- title = set.(title) if title
215
- footer = set.(footer) if footer
216
+ title &&= set.(title)
217
+ footer &&= set.(footer)
216
218
  if val.is_a?(::Array)
217
219
  lines = val.map(&:to_s)
218
220
  else
219
221
  lines = val.to_s.lines.map(&:chomp)
220
- lines[0] = "#{val.class}: #{lines.first}" if (err = val.is_a?(::StandardError))
222
+ lines[0] = "#{val.class}: #{lines.first}" if (err = val.is_a?(StandardError))
221
223
  end
222
- n = cols || [n, lines.max_by(&:size).size].max
224
+ n = cols || max.(lines)
223
225
  if $stdout.tty?
224
226
  require 'io/console'
225
227
  (n = [n, $stdout.winsize[1] - 4].min) rescue nil
@@ -227,10 +229,10 @@ module Squared
227
229
  out = []
228
230
  bord = '-' * (n + 4)
229
231
  bord = sub_style(bord, styles: border) if border
230
- sub = [sub] if sub && !sub.is_a?(::Array)
232
+ sub = as_a(sub)
231
233
  pr = lambda do |line|
232
234
  s = line.ljust(n)
233
- sub&.each { |h| s = sub_style(s, **h) }
235
+ sub.each { |h| s = sub_style(s, **h) }
234
236
  s = "| #{s} |"
235
237
  if border
236
238
  s = sub_style(s, pat: /^(\|)(.+)$/m, styles: border)
@@ -245,7 +247,16 @@ module Squared
245
247
  end
246
248
  lines.each { |line| out << pr.(line) }
247
249
  out << bord
248
- out += footer if footer
250
+ if footer
251
+ unless sub.empty? && !right
252
+ footer.map! do |s|
253
+ s = s.rjust(n + 4) if right
254
+ sub.each { |h| s = sub_style(s, **h) }
255
+ s
256
+ end
257
+ end
258
+ out += footer
259
+ end
249
260
  if block_given?
250
261
  yield out
251
262
  elsif pipe
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'readline'
4
-
5
3
  module Squared
6
4
  module Common
7
5
  module Prompt
8
6
  module_function
9
7
 
10
8
  def confirm(msg, default = nil, agree: 'Y', cancel: 'N', attempts: 5, timeout: 15)
9
+ require 'readline'
11
10
  require 'timeout'
12
11
  agree = /^#{agree}$/i if agree.is_a?(::String)
13
12
  cancel = /^#{cancel}$/i if cancel.is_a?(::String)
@@ -15,8 +14,7 @@ module Squared
15
14
  begin
16
15
  while (ch = Readline.readline(msg, true))
17
16
  ch = ch.chomp
18
- ch = default if ch.empty?
19
- case ch
17
+ case (ch.empty? ? default : ch)
20
18
  when agree
21
19
  return true
22
20
  when cancel
@@ -9,9 +9,10 @@ module Squared
9
9
  module_function
10
10
 
11
11
  def shell_escape(val, quote: false)
12
- return Shellwords.escape(val) unless ::Rake::Win32.windows?
12
+ val = val.to_s
13
+ return ::Shellwords.escape(val) unless ::Rake::Win32.windows?
13
14
 
14
- quote ? shell_quote(opt, force: false) : opt
15
+ quote ? shell_quote(val, force: false) : val
15
16
  end
16
17
 
17
18
  def shell_quote(val, force: true)
@@ -22,7 +23,7 @@ module Squared
22
23
  end
23
24
 
24
25
  def shell_split(val, quote: false, join: false)
25
- ret = Shellwords.split(val).map do |opt|
26
+ ret = ::Shellwords.split(val).map do |opt|
26
27
  if (data = /^(--?[^= ]+)(=|\s+)?(["'])?(.+?)\3?$/m.match(opt))
27
28
  next opt unless data[2] && !data[3]
28
29
 
@@ -12,50 +12,48 @@ module Squared
12
12
  if RUBY_VERSION =~ /^2\.[0-5]\./
13
13
  exception = kwargs.delete(:exception)
14
14
  ret = system(*args, **kwargs)
15
- raise $?.to_s if !ret && exception
15
+ return ret if ret || !exception
16
16
 
17
- ret
17
+ raise $?.to_s
18
18
  else
19
19
  system(*args, **kwargs)
20
20
  end
21
21
  end
22
22
 
23
23
  def copy_d(src, dest, glob: ['**/*'], create: false, verbose: true)
24
- src = Pathname.new(src)
25
- dest = Pathname.new(dest)
24
+ src = ::Pathname.new(src)
25
+ dest = ::Pathname.new(dest)
26
26
  raise "#{dest} (not found)" if !create && !dest.exist?
27
27
 
28
28
  subdir = []
29
29
  files = 0
30
30
  dest.mkpath if create
31
31
  (glob.is_a?(::Array) ? glob : [glob]).each do |val|
32
- Dir.glob(src.join(val)) do |path|
33
- ent = Pathname.new(path)
34
- next if ent.directory?
32
+ ::Dir.glob(src.join(val)) do |path|
33
+ next if (path = ::Pathname.new(path)).directory?
35
34
 
36
- target = dest.join(ent.relative_path_from(src))
35
+ target = dest.join(path.relative_path_from(src))
37
36
  dir = target.dirname
38
37
  unless subdir.include?(dir.to_s)
39
38
  dir.mkpath
40
39
  subdir << dir.to_s
41
40
  end
42
- copy_f ent, target
41
+ copy_f path, target
43
42
  files += 1
44
43
  end
45
44
  end
46
- puts [dest.realpath, subdir.size.to_s, files.to_s].join(Common::ARG[:SPACE]) if verbose
45
+ puts [dest.realpath, subdir.size.to_s, files.to_s].join(' => ') if verbose
47
46
  end
48
47
 
49
48
  def copy_f(src, dest, overwrite: true, verbose: false)
50
49
  unless overwrite
51
- if (path = Pathname.new(dest)).directory?
52
- src = [src] unless src.is_a?(::Array)
53
- src = src.reject { |val| path.join(File.basename(val)).exist? }
50
+ if (path = ::Pathname.new(dest)).directory?
51
+ src = (src.is_a?(::Array) ? src : [src]).reject { |val| path.join(::File.basename(val)).exist? }
54
52
  elsif path.exist?
55
53
  return
56
54
  end
57
55
  end
58
- FileUtils.cp(src, dest, verbose: verbose)
56
+ ::FileUtils.cp(src, dest, verbose: verbose)
59
57
  end
60
58
  end
61
59
  end
@@ -1,10 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'pathname'
4
+ require 'rake'
5
+
3
6
  module Squared
4
7
  module Common
5
8
  module Utils
6
9
  module_function
7
10
 
11
+ def task_invoke(*cmd, args: [], exception: true, warning: true)
12
+ cmd.each { |name| ::Rake::Task[name].invoke(*args) }
13
+ rescue StandardError => e
14
+ raise if exception
15
+
16
+ warn e if warning
17
+ end
18
+
19
+ def task_join(*val)
20
+ case val.size
21
+ when 1
22
+ val[0].to_s
23
+ when 2
24
+ "#{val[0]}:#{val[1]}"
25
+ else
26
+ val.join(':')
27
+ end
28
+ end
29
+
30
+ def task_invoked?(name)
31
+ ::Rake::Task.tasks.any? { |obj| obj.already_invoked && obj.name == name }
32
+ end
33
+
8
34
  def env(key, default = nil, suffix: @envname, equals: nil, ignore: nil)
9
35
  ret = env_value(key, suffix: suffix)
10
36
  return ret == equals.to_s unless equals.nil?
@@ -32,9 +58,9 @@ module Squared
32
58
  end
33
59
 
34
60
  def env_pipe(key, default = 1, suffix: nil, root: nil)
35
- if default.is_a?(String)
61
+ if default.is_a?(::String)
36
62
  begin
37
- default = (root ? root.join(default) : Pathname.new(default)).realdirpath
63
+ default = (root ? root.join(default) : ::Pathname.new(default)).realdirpath
38
64
  rescue StandardError => e
39
65
  default = 1
40
66
  warn e
@@ -61,7 +87,7 @@ module Squared
61
87
  when '1'
62
88
  true
63
89
  else
64
- Regexp.new(ret, options, timeout: timeout)
90
+ ::Regexp.new(ret, options, timeout: timeout)
65
91
  end
66
92
  end
67
93
  end
@@ -1,13 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
- require 'rake'
5
-
6
3
  require_relative 'common/base'
7
4
  require_relative 'common/class'
8
5
  require_relative 'common/format'
9
6
  require_relative 'common/prompt'
10
7
  require_relative 'common/shell'
11
8
  require_relative 'common/system'
12
- require_relative 'common/task'
13
9
  require_relative 'common/utils'
@@ -2,18 +2,17 @@
2
2
 
3
3
  require 'json'
4
4
 
5
+ require_relative 'common'
6
+
5
7
  module Squared
6
8
  module Config
7
9
  class Viewer
8
- include Common
9
- include Format
10
+ include Common::Format
10
11
  include Utils
11
12
  include ::Rake::DSL
12
13
 
13
- class << self
14
- def to_s
15
- super.to_s.match(/[^:]+$/)[0]
16
- end
14
+ def self.to_s
15
+ super.match(/[^:]+$/)[0]
17
16
  end
18
17
 
19
18
  attr_reader :main, :name, :project, :theme
@@ -22,12 +21,12 @@ module Squared
22
21
  def initialize(main, name = nil, project: nil, prefix: nil, dump: nil, opts: {}, auto: true,
23
22
  common: ARG[:COMMON], pipe: ARG[:PIPE], **)
24
23
  if project
25
- main = @project.base_path(main).to_s if (@project = __get__(:project)[project.to_sym])
24
+ main = @project.basepath(main).to_s if (@project = __get__(:project)[project.to_s])
26
25
  @required = true
27
26
  end
28
27
  @name = name&.to_s || @project&.name
29
28
  @prefix = prefix
30
- @ext = File.extname(main)
29
+ @ext = File.extname(main).downcase
31
30
  @dump = dump
32
31
  @mime = {}
33
32
  @theme = common ? __get__(:theme)[:viewer] : {}
@@ -63,7 +62,6 @@ module Squared
63
62
  namespace(ns = task_name(name)) do
64
63
  view = @command && @command != name ? @command : 'view'
65
64
  params = ->(args) { exist? ? [realpath, [args.keys] + args.extras] : [args.keys, args.extras] }
66
-
67
65
  namespace view do
68
66
  if @mime['json'] && (exist? || !::Rake::Task.task_defined?("#{ns}:#{view}:json"))
69
67
  desc format_desc(view, 'json')
@@ -81,7 +79,6 @@ module Squared
81
79
  end
82
80
  end
83
81
  end
84
-
85
82
  yield self if block_given?
86
83
  end
87
84
 
@@ -96,8 +93,8 @@ module Squared
96
93
  file = realpath if !file && exist?
97
94
 
98
95
  namespace task_name(name) do
99
- desc format_desc(command, *ext, exist: exist)
100
96
  namespace command do
97
+ desc format_desc(command, *ext, exist: exist)
101
98
  task type, [:keys] do |_, args|
102
99
  if file
103
100
  read_keys(obj, type, file.to_s, args.to_a, ext: ext)
@@ -121,7 +118,7 @@ module Squared
121
118
  end
122
119
 
123
120
  def also(path, type = nil, name: nil, gem: nil, parse: nil, opts: {})
124
- return self if @mime.frozen? || !(file = base_path(path)).exist?
121
+ return self if @mime.frozen? || !(file = basepath(path)).exist?
125
122
 
126
123
  ext = mime_type(file)
127
124
  type = type&.to_s || ext
@@ -170,19 +167,25 @@ module Squared
170
167
  end
171
168
 
172
169
  def read_keys(reader, type, file, keys, ext: [type])
173
- if (mime = mime_type(file)) && base_path(file).exist?
170
+ if file && (mime = mime_type(file)) && basepath(file).exist?
174
171
  raise_error(file, mime, hint: 'invalid') unless ext.include?(mime)
175
172
  else
176
173
  if ext.include?(mime)
177
174
  alt = file
178
175
  file = nil
179
176
  ext[0] = mime
180
- else
177
+ elsif file
181
178
  keys.unshift(file)
182
- alt = base_path("#{main}.{#{ext.join(',')}}")
179
+ alt = basepath("#{main}.{#{ext.join(',')}}")
183
180
  file = Dir[alt].first
181
+ else
182
+ alt = main
183
+ args = { hint: 'no keys' }
184
+ end
185
+ unless file
186
+ args ||= { hint: 'not found', kind: LoadError }
187
+ raise_error(reader.name, "#{File.basename(alt, '.*')}.#{ext.first}", **args)
184
188
  end
185
- raise_error(reader.name, "#{File.basename(alt, '.*')}.#{ext.first}", hint: 'not found') unless file
186
189
  end
187
190
  project&.log&.info "#{Viewer}(#{type}) => #{file} {#{keys.join(', ')}}"
188
191
  doc = if reader.respond_to?(:load_file)
@@ -197,19 +200,19 @@ module Squared
197
200
  .realpath
198
201
  .to_s
199
202
  .sub(Regexp.new("^#{Regexp.escape(File.join(Dir.pwd, ''))}"), '')
200
- sub = unless stdin?
201
- [
202
- { pat: /^((?:[^:]|(?<! ):(?! ))+)$/, styles: theme[:banner] },
203
- { pat: /^(.*?)(<[^>]+>)(.+)$/m, styles: theme[:undefined], index: 2 },
204
- { pat: /^(.+)( : (?!undefined).+)$/m, styles: theme[:key] },
205
- { pat: /^(.+ : )(-?[\d.]+)(\s*)$/m, styles: theme[:number], index: 2 },
206
- { pat: /^(.+ : ")(.+)("\s*)$/m, styles: theme[:string], index: 2 },
207
- { pat: /^(.+ : \{)(.+)(\}\s*)$/m, styles: theme[:hash], index: 2 },
208
- { pat: /^(.+ : \[)(.+)(\]\s*)$/m, styles: theme[:array], index: 2 },
209
- { pat: /^(.+ : (?!undefined))([^"\[{].*)$/m, styles: theme[:value], index: 2 }
210
- ]
211
- end
212
- emphasize(lines, title: title, sub: sub)
203
+ emphasize(lines, title: title, sub: unless stdin?
204
+ [
205
+ { pat: /^((?:[^:]|(?<! ):(?! ))+)$/, styles: theme[:banner] },
206
+ { pat: /^(.*?)(<[^>]+>)(.+)$/m, styles: theme[:undefined], index: 2 },
207
+ { pat: /^(.+)( : (?!undefined).+)$/m, styles: theme[:key] },
208
+ { pat: /^(.+ : )(-?[\d.]+)(\s*)$/m, styles: theme[:number], index: 2 },
209
+ { pat: /^(.+ : ")(.+)("\s*)$/m, styles: theme[:string], index: 2 },
210
+ { pat: /^(.+ : \{)(.+)(\}\s*)$/m, styles: theme[:hash], index: 2 },
211
+ { pat: /^(.+ : \[)(.+)(\]\s*)$/m, styles: theme[:array], index: 2 },
212
+ { pat: /^(.+ : (?!undefined))([^"\[{].*)$/m, styles: theme[:value],
213
+ index: 2 }
214
+ ]
215
+ end)
213
216
  end
214
217
 
215
218
  def print_keys(type, data, keys, file: nil)
@@ -253,8 +256,8 @@ module Squared
253
256
  end
254
257
  end
255
258
 
256
- def base_path(file)
257
- project ? project.base_path(file) : Pathname.new(file).realdirpath
259
+ def basepath(file)
260
+ project ? project.basepath(file) : Pathname.new(file).realdirpath
258
261
  end
259
262
 
260
263
  def task_name(val)
@@ -280,7 +283,7 @@ module Squared
280
283
  end
281
284
 
282
285
  def realpath
283
- base_path(file = main + @ext).to_s rescue file
286
+ basepath(file = main + @ext).to_s rescue file
284
287
  end
285
288
 
286
289
  def exist?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.0.11'
4
+ VERSION = '0.0.12'
5
5
  end