squared 0.0.10 → 0.0.11

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: 71eae17e75e9ebe9a4fbe250f49da6397b169f06ac85c7f77170b9fc575bd63e
4
- data.tar.gz: f68b5c36da52802d0b952c54a406d6d6bde3085308c465c2f058c8c944dce894
3
+ metadata.gz: d000551aa00185dae3ea1bc7e3a61c64af96dce7d717339483d8cb572ca12d43
4
+ data.tar.gz: 229f06052512ee06d16e43688602753a867025e8cf39b6b1c6dfafa69805fdbc
5
5
  SHA512:
6
- metadata.gz: 515aa7c65dd969fb9dd165a38716695a6c08ccbf0597ef3d7936bcd70750c2c54f661fc44e9dc303d34b8d99947d27939039654ca5ffd43afcf33f917deb2866
7
- data.tar.gz: cfe3827d03d56619de9d3c60a4df2b249ff1f802bc9a6be407b96c5db95fb14faf6b3719e657c83dc046287d62272f1cf2e676fdad67da345abc93675e511474
6
+ metadata.gz: 5efe60578369457075929b95ba8ea628d39d7324d40f84c397e07606c8c5fe48f07f797b940d7ca34a80321bb3f1435494c36afcd95432cbe8924e4353099f56
7
+ data.tar.gz: daf832c4fbcf0e80459317be7b91781cfea9b653b3368cdbc090101d67ca59aff8b38940c2803100e322ca14bd25f45ccf37ef27bb348312b724c45babeb3393
data/README.ruby.md CHANGED
@@ -34,7 +34,14 @@ Projects from any accessible folder can be added either relative to `REPO_ROOT`
34
34
 
35
35
  ```ruby
36
36
  require "squared"
37
- require "squared/workspace/repo" # Repo (optional)
37
+
38
+ require "squared/workspace"
39
+ require "squared/workspace/repo" # Optional
40
+ require "squared/workspace/project/node" #
41
+ require "squared/workspace/project/python" #
42
+ require "squared/workspace/project/ruby" #
43
+ # OR
44
+ require "squared/app" # All workspace related modules
38
45
 
39
46
  # NODE_ENV = production
40
47
  # REPO_ROOT = /workspaces
@@ -52,7 +59,7 @@ require "squared/workspace/repo" # Repo (optional)
52
59
 
53
60
  Workspace::Application
54
61
  .new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
55
- .banner("group", "project", styles: %i[yellow black], border: "bold") # name | project | path | ref | group?
62
+ .banner("group", "project", styles: %i[yellow black], border: "bold") # name | project | path | ref | group? | parent? | version?
56
63
  .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
57
64
  .run("rake install", ref: :ruby)
58
65
  .depend(false, group: "default")
@@ -63,13 +70,17 @@ Workspace::Application
63
70
  "CFLAGS" => "-fPIC -O1"
64
71
  })
65
72
  .add("optparse", doc: "rake rdoc", group: "default") # Uses bundler/gem_tasks (without C extensions)
66
- .add("logger", copy: { from: "lib", glob: "**/*.rb", gemdir: "~/.rvm/gems/ruby-3.3.5/gems/logger-1.6.1" }, clean: ["tmp/"]) # autodetect: true
67
- .add("e-mc", "emc", copy: { from: "publish", into: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
68
- .add("pi-r", "pir", copy: { from: "publish", into: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
73
+ .add("logger", copy: { from: "lib", glob: "**/*.rb", into: "~/.rvm/gems/ruby-3.3.5/gems/logger-1.6.1" }, clean: ["tmp/"]) # autodetect: true
74
+ .add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
75
+ .add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
69
76
  .add("squared", script: ["build:stage1", "build:stage2"], group: "app") do # Copy target (main)
70
- add("publish/sqd-cli", "cli", exclude: [:git])
71
- add("publish/sqd-serve")
77
+ add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
78
+ add("publish/sqd-serve") # rake sqd-serve:build
72
79
  add("publish/sqd-admin", group: "sqd", exclude: [:base])
80
+ # OR
81
+ with(exclude: [:base]) { add("publish/*", "packages") } # rake packages:sqd-serve:build
82
+ # OR
83
+ add(["publish/sqd-cli", "publish/sqd-serve", "publish/sqd-admin"], true, exclude: [:base]) # rake squared:sqd-serve:build
73
84
  end
74
85
  .add("squared/sqd", exclude: [:git]) do
75
86
  variable_set :script, "build:sqd" # Override detection
@@ -77,7 +88,7 @@ Workspace::Application
77
88
  variable_set :clean, ["build/sqd/"]
78
89
  end
79
90
  .style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
80
- .build(default: "status", parallel: ["pull", "fetch", "rebase", "copy", "clean"]) do |workspace|
91
+ .build(default: "status", parallel: ["pull", "fetch", "rebase", "copy", "clean", "outdated:ruby"]) do |workspace|
81
92
  workspace
82
93
  .enable_aixterm
83
94
  .style({
@@ -97,28 +108,28 @@ Workspace::Application
97
108
  .new(ENV["SQUARED_HOME"], prefix: "rb", common: false) # Local styles
98
109
  .group("ruby", "default", run: "rake build", copy: "rake install", clean: "rake clean", ref: :ruby, override: {
99
110
  pathname: {
100
- run: "rake compile" # rake rb:pathname:build
111
+ run: "rake compile" # rake rb:pathname:build
101
112
  }
102
113
  })
103
- .with(:python) do # ref=Symbol | group=String
104
- banner("path", command: false, styles: "yellow") #
105
- doc("make html") # rake rb:doc:python
106
- run(false) # rake rb:build:python (disabled)
107
- exclude(%i[base git]) # Project::Git.ref (superclass)
108
- add("android-docs", "android") # rake rb:android:doc
109
- add("chrome-docs", "chrome") # rake rb:chrome:doc
110
- end #
114
+ .with(:python) do # ref=Symbol | group=String
115
+ banner([:name, ': ', :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
116
+ doc("make html") # rake rb:doc:python
117
+ run(false) # rake rb:build:python (disabled)
118
+ exclude(%i[base git]) # Project::Git.ref (superclass)
119
+ add("android-docs", "android") # rake rb:android:doc
120
+ add("chrome-docs", "chrome") # rake rb:chrome:doc
121
+ end #
111
122
  .style("inline", "bold")
112
123
  .build
113
124
  ```
114
125
 
115
- **NOTE**: The use of "**ref**" (class name) is only necessary when running `repo:init` for the first time into an empty directory.
126
+ **NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
116
127
 
117
128
  ## Usage
118
129
 
119
130
  ```sh
120
- rake -T # List tasks
121
- rake # rake status (usually "build")
131
+ rake -T # List tasks
132
+ rake # rake status (usually "build")
122
133
 
123
134
  # GIT_OPTIONS=rebase
124
135
  rake pull # All except "default" + "app"
@@ -145,6 +156,7 @@ rake build:app # squared + cli + sqd-serve
145
156
  rake squared:build:workspace # cli + sqd-serve
146
157
  rake pull:sqd # sqd-admin
147
158
  rake squared:pull:workspace # sqd-serve + sqd-admin
159
+ rake squared:outdated:workspace # cli + sqd-serve + sqd-admin
148
160
  ```
149
161
 
150
162
  ## Methods
@@ -179,14 +191,21 @@ Non-task:
179
191
  ### Build
180
192
 
181
193
  ```ruby
194
+ # :env :run :opts
182
195
  # LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -c
183
196
  BUILD_${NAME} # gcc a.c -o a.o
184
- BUILD_${NAME}_OPTS # -c
185
- BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (json)
186
-
187
- # Scripts
188
- BUILD_${NAME}_DEV # pattern,0,1
189
- BUILD_${NAME}_PROD # pattern,0,1
197
+ BUILD_OPTS_${NAME} # -c
198
+ BUILD_ENV_${NAME} # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
199
+
200
+ # :env :opts :script
201
+ # NODE_ENV="production" NO_COLOR="1" npm run --loglevel=error --workspaces=false build:dev
202
+ BUILD_${NAME} # build:dev
203
+ BUILD_OPTS_${NAME} # --loglevel=error --workspaces=false
204
+ BUILD_ENV_${NAME} # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
205
+ BUILD_DEV_${NAME} # pattern,0,1 (:dev)
206
+ BUILD_PROD_${NAME} # pattern,0,1 (:prod)
207
+
208
+ BUILD_${NAME}=0 # skip project
190
209
  ```
191
210
 
192
211
  These options also support the project specific suffix `${NAME}`. (e.g. LOG_FILE_SQUARED)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'workspace'
4
+ require_relative 'workspace/repo'
5
+ require_relative 'workspace/project/node'
6
+ require_relative 'workspace/project/python'
7
+ require_relative 'workspace/project/ruby'
8
+ require_relative 'config'
9
+
10
+ Common = Squared::Common
@@ -2,10 +2,14 @@
2
2
 
3
3
  module Squared
4
4
  module Common
5
- KEY = {
5
+ ARG = {
6
6
  PIPE: 1,
7
+ OUT: nil,
7
8
  FAIL: false,
8
- COMMON: true
9
+ COMMON: true,
10
+ BANNER: true,
11
+ SPACE: ' => ',
12
+ COLOR: ENV.fetch('NO_COLOR', '').empty?
9
13
  }
10
14
  VAR = {
11
15
  project: {},
@@ -70,6 +74,7 @@ module Squared
70
74
  end
71
75
 
72
76
  def __freeze__
77
+ ARG.freeze
73
78
  VAR.each_value(&:freeze)
74
79
  VAR[:theme].each_value(&:freeze)
75
80
  VAR.freeze
@@ -77,17 +82,6 @@ module Squared
77
82
 
78
83
  module_function
79
84
 
80
- def env(key, default = nil, equals: nil, ignore: nil, **)
81
- ret = ENV.fetch(key, '')
82
- return ret == equals.to_s unless equals.nil?
83
-
84
- ret.empty? || (ignore && as_a(ignore).any? { |val| ret == val.to_s }) ? default : ret
85
- end
86
-
87
- def message(*args, hint: nil)
88
- args.reject(&:empty?).join(' => ') + (hint ? " (#{hint})" : '')
89
- end
90
-
91
85
  def as_a(obj, meth = nil, flat: nil, compact: false)
92
86
  return [] if obj.nil?
93
87
 
@@ -1,14 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
+ require 'forwardable'
4
5
 
5
6
  module Squared
6
7
  module Common
7
- class JoinSet < ::Set
8
- def self.to_s
9
- super.to_s.match(/[^:]+$/)[0]
8
+ class SymSet
9
+ extend Forwardable
10
+
11
+ def_delegators :@data, :each, :each_with_index, :entries, :to_a, :include?
12
+
13
+ def initialize(data = [])
14
+ @data = Set.new(data)
10
15
  end
11
16
 
17
+ def add(val)
18
+ @data.add(val.to_sym)
19
+ end
20
+
21
+ def to_s
22
+ @data.to_s.sub('Set', SymSet.to_s)
23
+ end
24
+
25
+ alias inspect to_s
26
+ end
27
+
28
+ class JoinSet < ::Set
12
29
  def initialize(data = [], delim: ' ')
13
30
  super(data.compact)
14
31
  @delim = delim
@@ -40,7 +40,7 @@ module Squared
40
40
  private
41
41
 
42
42
  def sub_style(val, *args, styles: nil, pat: nil, index: 1)
43
- return val unless ENV.fetch('NO_COLOR', '').empty? && !__get__(:no_color)
43
+ return val unless ARG[:COLOR]
44
44
 
45
45
  if pat && index != 0
46
46
  return val unless (data = pat.match(val))
@@ -106,7 +106,7 @@ module Squared
106
106
  out
107
107
  end
108
108
 
109
- def check_style(*args, empty: true)
109
+ def check_style(args, empty: true)
110
110
  ret = []
111
111
  colors = __get__(:colors)
112
112
  as_a(args, flat: true, compact: true).each do |val|
@@ -123,7 +123,7 @@ module Squared
123
123
  ret if empty || !ret.empty?
124
124
  end
125
125
 
126
- def apply_style(data, key, *args, empty: true)
126
+ def apply_style(data, key, args, empty: true)
127
127
  return if data.is_a?(::Symbol) && (data = __get__(:theme)[data]).nil?
128
128
 
129
129
  set = ->(k, v) { data[k] = check_style(v, empty: empty) }
@@ -155,7 +155,7 @@ module Squared
155
155
  end
156
156
  end
157
157
 
158
- def log_title(level, color: true)
158
+ def log_title(level, color: ARG[:COLOR])
159
159
  theme = __get__(:theme)[:logger]
160
160
  styles = theme[level = log_sym(level)] || theme[level = :unknown]
161
161
  case (ret = +level.to_s.upcase)
@@ -165,7 +165,7 @@ module Squared
165
165
  color ? sub_style(ret, *styles) : ret
166
166
  end
167
167
 
168
- def log_message(level, *args, subject: nil, hint: nil, color: true)
168
+ def log_message(level, *args, subject: nil, hint: nil, color: ARG[:COLOR])
169
169
  args = args.map(&:to_s)
170
170
  if args.size > 1
171
171
  title = log_title(level, color: false)
@@ -183,20 +183,38 @@ module Squared
183
183
  end
184
184
  end
185
185
 
186
- def raise_error(*args, hint: nil, kind: ArgumentError)
187
- raise kind, message(*args, hint: hint)
186
+ def puts_oe(*args, pipe: 1)
187
+ if pipe.is_a?(::Pathname)
188
+ begin
189
+ File.open(pipe, 'a') do |f|
190
+ br = File::SEPARATOR == '\\' ? "\r\n" : "\n"
191
+ args.flatten.each { |val| f.write("#{strip_style(val.chomp)}#{br}") }
192
+ end
193
+ return
194
+ rescue StandardError
195
+ pipe = 2
196
+ end
197
+ end
198
+ (pipe == 2 ? $stderr : $stdout).puts(*args)
188
199
  end
189
200
 
190
201
  module_function
191
202
 
192
- def emphasize(val, title: nil, cols: nil, sub: nil, pipe: nil)
203
+ def message(*args, hint: nil, empty: false)
204
+ (empty ? args.reject { |val| val.nil? || val.empty? } : args).join(ARG[:SPACE]) + (hint ? " (#{hint})" : '')
205
+ end
206
+
207
+ def emphasize(val, title: nil, footer: nil, cols: nil, sub: nil, border: nil, pipe: nil)
193
208
  n = 0
194
- if title
195
- title = title.to_s
196
- n = title.size
209
+ set = lambda do |l|
210
+ ret = as_a(l, :to_s)
211
+ n = ret.max_by(&:size).size
212
+ ret
197
213
  end
214
+ title = set.(title) if title
215
+ footer = set.(footer) if footer
198
216
  if val.is_a?(::Array)
199
- lines = val
217
+ lines = val.map(&:to_s)
200
218
  else
201
219
  lines = val.to_s.lines.map(&:chomp)
202
220
  lines[0] = "#{val.class}: #{lines.first}" if (err = val.is_a?(::StandardError))
@@ -208,24 +226,50 @@ module Squared
208
226
  end
209
227
  out = []
210
228
  bord = '-' * (n + 4)
229
+ bord = sub_style(bord, styles: border) if border
211
230
  sub = [sub] if sub && !sub.is_a?(::Array)
212
231
  pr = lambda do |line|
213
232
  s = line.ljust(n)
214
233
  sub&.each { |h| s = sub_style(s, **h) }
215
- "| #{s} |"
234
+ s = "| #{s} |"
235
+ if border
236
+ s = sub_style(s, pat: /^(\|)(.+)$/m, styles: border)
237
+ s = sub_style(s, pat: /^(.+)(\|)$/m, styles: border, index: 2)
238
+ end
239
+ s
216
240
  end
217
241
  out << bord
218
- out << pr.(title) << bord if title
242
+ if title
243
+ out += title.map { |t| pr.(t) }
244
+ out << bord
245
+ end
219
246
  lines.each { |line| out << pr.(line) }
220
247
  out << bord
248
+ out += footer if footer
221
249
  if block_given?
222
250
  yield out
223
- elsif pipe.respond_to?(:puts)
251
+ elsif pipe
252
+ case pipe
253
+ when 0
254
+ pipe = $stdin
255
+ when 2
256
+ pipe = $stderr
257
+ else
258
+ pipe = $stdout unless pipe.respond_to?(:puts)
259
+ end
224
260
  pipe.puts out
225
261
  else
226
262
  err ? warn(out) : puts(out)
227
263
  end
228
264
  end
265
+
266
+ def strip_style(val)
267
+ val.gsub(/\x1B\[(\d+;?)+m/, '')
268
+ end
269
+
270
+ def raise_error(*args, hint: nil, kind: ArgumentError)
271
+ raise kind, message(*args, hint: hint, empty: true)
272
+ end
229
273
  end
230
274
  end
231
275
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'readline'
4
+
5
+ module Squared
6
+ module Common
7
+ module Prompt
8
+ module_function
9
+
10
+ def confirm(msg, default = nil, agree: 'Y', cancel: 'N', attempts: 5, timeout: 15)
11
+ require 'timeout'
12
+ agree = /^#{agree}$/i if agree.is_a?(::String)
13
+ cancel = /^#{cancel}$/i if cancel.is_a?(::String)
14
+ Timeout.timeout(timeout) do
15
+ begin
16
+ while (ch = Readline.readline(msg, true))
17
+ ch = ch.chomp
18
+ ch = default if ch.empty?
19
+ case ch
20
+ when agree
21
+ return true
22
+ when cancel
23
+ return false
24
+ end
25
+ attempts -= 1
26
+ exit 1 unless attempts >= 0
27
+ end
28
+ rescue Interrupt
29
+ puts
30
+ exit 0
31
+ else
32
+ false
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -8,43 +8,15 @@ module Squared
8
8
  module System
9
9
  module_function
10
10
 
11
- def shell(*cmd, **kwargs)
11
+ def shell(*args, **kwargs)
12
12
  if RUBY_VERSION =~ /^2\.[0-5]\./
13
13
  exception = kwargs.delete(:exception)
14
- ret = system(*cmd, **kwargs)
14
+ ret = system(*args, **kwargs)
15
15
  raise $?.to_s if !ret && exception
16
16
 
17
17
  ret
18
18
  else
19
- system(*cmd, **kwargs)
20
- end
21
- end
22
-
23
- def confirm(msg, default = nil, agree: 'Y', cancel: 'N', attempts: 5, timeout: 15)
24
- require 'readline'
25
- require 'timeout'
26
- agree = /^#{agree}$/i if agree.is_a?(::String)
27
- cancel = /^#{cancel}$/i if cancel.is_a?(::String)
28
- Timeout.timeout(timeout) do
29
- begin
30
- while (ch = Readline.readline(msg, true))
31
- ch = ch.chomp
32
- ch = default if ch.empty?
33
- case ch
34
- when agree
35
- return true
36
- when cancel
37
- return false
38
- end
39
- attempts -= 1
40
- exit 1 unless attempts >= 0
41
- end
42
- rescue Interrupt
43
- puts
44
- exit 0
45
- else
46
- false
47
- end
19
+ system(*args, **kwargs)
48
20
  end
49
21
  end
50
22
 
@@ -56,8 +28,7 @@ module Squared
56
28
  subdir = []
57
29
  files = 0
58
30
  dest.mkpath if create
59
- glob = [glob] unless glob.is_a?(::Array)
60
- glob.each do |val|
31
+ (glob.is_a?(::Array) ? glob : [glob]).each do |val|
61
32
  Dir.glob(src.join(val)) do |path|
62
33
  ent = Pathname.new(path)
63
34
  next if ent.directory?
@@ -72,13 +43,12 @@ module Squared
72
43
  files += 1
73
44
  end
74
45
  end
75
- puts [dest.realpath, subdir.size.to_s, files.to_s].join(' => ') if verbose
46
+ puts [dest.realpath, subdir.size.to_s, files.to_s].join(Common::ARG[:SPACE]) if verbose
76
47
  end
77
48
 
78
49
  def copy_f(src, dest, overwrite: true, verbose: false)
79
50
  unless overwrite
80
- path = Pathname.new(dest)
81
- if path.directory?
51
+ if (path = Pathname.new(dest)).directory?
82
52
  src = [src] unless src.is_a?(::Array)
83
53
  src = src.reject { |val| path.join(File.basename(val)).exist? }
84
54
  elsif path.exist?
@@ -16,8 +16,9 @@ module Squared
16
16
  warn e if warning
17
17
  end
18
18
 
19
- def invoked?(name)
20
- ::Rake::Task.tasks.any? { |obj| obj.already_invoked && obj.name == name.to_s }
19
+ def invoked?(*name)
20
+ val = name.size > 1 ? name.join(':') : name.first.to_s
21
+ ::Rake::Task.tasks.any? { |obj| obj.already_invoked && obj.name == val }
21
22
  end
22
23
  end
23
24
  end
@@ -5,17 +5,18 @@ module Squared
5
5
  module Utils
6
6
  module_function
7
7
 
8
- def env_value(key, suffix: nil)
9
- if suffix
10
- ret = ENV["#{key}_#{suffix}"]
11
- return ret unless ret.nil?
12
- end
13
- ENV.fetch(key, '')
8
+ def env(key, default = nil, suffix: @envname, equals: nil, ignore: nil)
9
+ ret = env_value(key, suffix: suffix)
10
+ return ret == equals.to_s unless equals.nil?
11
+
12
+ ret.empty? || (ignore && as_a(ignore).any? { |val| ret == val.to_s }) ? default : ret
14
13
  end
15
14
 
16
- def env_bool(key, default = false, suffix: nil)
17
- return default if key.nil?
15
+ def env_value(key, default = '', suffix: nil)
16
+ suffix && (ret = ENV["#{key}_#{suffix}"]) ? ret : ENV.fetch(key, default)
17
+ end
18
18
 
19
+ def env_bool(key, default = false, suffix: nil)
19
20
  if key.is_a?(::String)
20
21
  case env_value(key, suffix: suffix)
21
22
  when ''
@@ -26,21 +27,29 @@ module Squared
26
27
  true
27
28
  end
28
29
  else
29
- key
30
+ key.nil? ? default : key
30
31
  end
31
32
  end
32
33
 
33
- def env_pipe(key, default = 1, suffix: nil)
34
- if key.is_a?(::String)
34
+ def env_pipe(key, default = 1, suffix: nil, root: nil)
35
+ if default.is_a?(String)
36
+ begin
37
+ default = (root ? root.join(default) : Pathname.new(default)).realdirpath
38
+ rescue StandardError => e
39
+ default = 1
40
+ warn e
41
+ end
42
+ end
43
+ case key
44
+ when ::String
35
45
  case (ret = env_value(key, suffix: suffix))
36
46
  when '0', '1', '2'
37
- ret.to_i
38
- else
39
- default
47
+ return ret.to_i
40
48
  end
41
- else
42
- key.is_a?(::Numeric) && key >= 0 && key <= 2 ? key : default
49
+ when ::Numeric
50
+ return key if key >= 0 && key <= 2
43
51
  end
52
+ default
44
53
  end
45
54
 
46
55
  def env_match(key, default = nil, suffix: nil, options: 0, timeout: nil)
@@ -6,6 +6,7 @@ require 'rake'
6
6
  require_relative 'common/base'
7
7
  require_relative 'common/class'
8
8
  require_relative 'common/format'
9
+ require_relative 'common/prompt'
9
10
  require_relative 'common/shell'
10
11
  require_relative 'common/system'
11
12
  require_relative 'common/task'