Class: Cask::DSL Private

Inherits:
Object show all
Includes:
OS::Mac::Cask::DSL, OnSystem::MacOSAndLinux
Defined in:
cask/dsl.rb,
cask/dsl/base.rb,
cask/dsl/caveats.rb,
cask/dsl/version.rb,
cask/dsl/container.rb,
cask/dsl/preflight.rb,
cask/dsl/depends_on.rb,
cask/dsl/postflight.rb,
cask/dsl/conflicts_with.rb,
cask/dsl/uninstall_preflight.rb,
cask/dsl/uninstall_postflight.rb
more...

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Class representing the domain-specific language used for casks.

Defined Under Namespace

Classes: Base, Caveats, ConflictsWith, Container, DependsOn, Postflight, Preflight, UninstallPostflight, UninstallPreflight, Version

Constant Summary collapse

ORDINARY_ARTIFACT_CLASSES =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[
  Artifact::Installer,
  Artifact::App,
  Artifact::Artifact,
  Artifact::AudioUnitPlugin,
  Artifact::Binary,
  Artifact::Colorpicker,
  Artifact::Dictionary,
  Artifact::Font,
  Artifact::InputMethod,
  Artifact::InternetPlugin,
  Artifact::KeyboardLayout,
  Artifact::Manpage,
  Artifact::Pkg,
  Artifact::Prefpane,
  Artifact::Qlplugin,
  Artifact::Mdimporter,
  Artifact::ScreenSaver,
  Artifact::Service,
  Artifact::StageOnly,
  Artifact::Suite,
  Artifact::VstPlugin,
  Artifact::Vst3Plugin,
  Artifact::ZshCompletion,
  Artifact::FishCompletion,
  Artifact::BashCompletion,
  Artifact::Uninstall,
  Artifact::Zap,
].freeze
ACTIVATABLE_ARTIFACT_CLASSES =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

(ORDINARY_ARTIFACT_CLASSES - [Artifact::StageOnly]).freeze
ARTIFACT_BLOCK_CLASSES =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

[
  Artifact::PreflightBlock,
  Artifact::PostflightBlock,
].freeze
DSL_METHODS =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

Set.new([
  :appcast,
  :arch,
  :artifacts,
  :auto_updates,
  :caveats,
  :conflicts_with,
  :container,
  :desc,
  :depends_on,
  :homepage,
  :language,
  :name,
  :sha256,
  :staged_path,
  :url,
  :version,
  :appdir,
  :deprecate!,
  :deprecated?,
  :deprecation_date,
  :deprecation_reason,
  :deprecation_replacement,
  :disable!,
  :disabled?,
  :disable_date,
  :disable_reason,
  :disable_replacement,
  :discontinued?, # TODO: remove once discontinued? is removed (4.5.0)
  :livecheck,
  :livecheck_defined?,
  :livecheckable?, # TODO: remove once `#livecheckable?` is removed
  :on_system_blocks_exist?,
  :on_system_block_min_os,
  :depends_on_set_in_block?,
  *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
  *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
  *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
]).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OnSystem::MacOSAndLinux

included, #on_arch_conditional, #on_macos, #on_system_conditional

Constructor Details

#initialize(cask) ⇒ DSL

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of DSL.

[View source]

115
116
117
118
119
120
121
122
123
# File 'cask/dsl.rb', line 115

def initialize(cask)
  @cask = cask
  @depends_on_set_in_block = T.let(false, T::Boolean)
  @deprecated = T.let(false, T::Boolean)
  @disabled = T.let(false, T::Boolean)
  @livecheck_defined = T.let(false, T::Boolean)
  @on_system_blocks_exist = T.let(false, T::Boolean)
  @token = cask.token
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

582
583
584
585
586
587
588
589
# File 'cask/dsl.rb', line 582

def method_missing(method, *)
  if method
    Utils.method_missing_message(method, token)
    nil
  else
    super
  end
end

Instance Attribute Details

#caskObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def cask
  @cask
end

#deprecation_dateObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def deprecation_date
  @deprecation_date
end

#deprecation_reasonObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def deprecation_reason
  @deprecation_reason
end

#deprecation_replacementObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def deprecation_replacement
  @deprecation_replacement
end

#disable_dateObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def disable_date
  @disable_date
end

#disable_reasonObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def disable_reason
  @disable_reason
end

#disable_replacementObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def disable_replacement
  @disable_replacement
end

#on_system_block_min_osObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def on_system_block_min_os
  @on_system_block_min_os
end

#tokenObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.


112
113
114
# File 'cask/dsl.rb', line 112

def token
  @token
end

Instance Method Details

#add_implicit_macos_dependencyObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

437
438
439
440
441
# File 'cask/dsl.rb', line 437

def add_implicit_macos_dependency
  return if @depends_on.present? && @depends_on.macos.present?

  depends_on macos: ">= :#{MacOSVersion::SYMBOLS.key MacOSVersion::SYMBOLS.values.min}"
end

#appdirPathname, String

The directory apps are installed into.

Returns:

[View source]

604
605
606
607
608
# File 'cask/dsl.rb', line 604

def appdir
  return HOMEBREW_CASK_APPDIR_PLACEHOLDER if Cask.generating_hash?

  cask.config.appdir
end

#arch(arm: nil, intel: nil) ⇒ Object

Sets the cask's architecture strings.

Example

arch arm: "darwin-arm64", intel: "darwin"
[View source]

383
384
385
386
387
388
389
390
391
# File 'cask/dsl.rb', line 383

def arch(arm: nil, intel: nil)
  should_return = arm.nil? && intel.nil?

  set_unique_stanza(:arch, should_return) do
    @on_system_blocks_exist = true

    on_arch_conditional(arm:, intel:)
  end
end

#artifactsObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

451
452
453
# File 'cask/dsl.rb', line 451

def artifacts
  @artifacts ||= ArtifactSet.new
end

#auto_updates(auto_updates = nil) ⇒ Object

Asserts that the cask artifacts auto-update.

[View source]

496
497
498
# File 'cask/dsl.rb', line 496

def auto_updates(auto_updates = nil)
  set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates }
end

#caskroom_pathPathname

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

[View source]

456
457
458
# File 'cask/dsl.rb', line 456

def caskroom_path
  cask.caskroom_path
end

#caveats(*strings, &block) ⇒ Object

Provide the user with cask-specific information at install time.

[View source]

474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'cask/dsl.rb', line 474

def caveats(*strings, &block)
  @caveats ||= DSL::Caveats.new(cask)
  if block
    @caveats.eval_caveats(&block)
  elsif strings.any?
    strings.each do |string|
      @caveats.eval_caveats { string }
    end
  else
    return @caveats.to_s
  end
  @caveats
end

#conflicts_with(**kwargs) ⇒ Object

Declare conflicts that keep a cask from installing or working correctly.

[View source]

446
447
448
449
# File 'cask/dsl.rb', line 446

def conflicts_with(**kwargs)
  # TODO: Remove this constraint and instead merge multiple `conflicts_with` stanzas
  set_unique_stanza(:conflicts_with, kwargs.empty?) { DSL::ConflictsWith.new(**kwargs) }
end

#container(**kwargs) ⇒ Object

Sets the cask's container type or nested container path.

Examples

The container is a nested disk image:

container nested: "orca-#{version}.dmg"

The container should not be unarchived:

container type: :naked
[View source]

293
294
295
296
297
# File 'cask/dsl.rb', line 293

def container(**kwargs)
  set_unique_stanza(:container, kwargs.empty?) do
    DSL::Container.new(**kwargs)
  end
end

#depends_on(**kwargs) ⇒ Object

Note:

Multiple dependencies can be specified.

Declare dependencies and requirements for a cask.

[View source]

423
424
425
426
427
428
429
430
431
432
433
434
# File 'cask/dsl.rb', line 423

def depends_on(**kwargs)
  @depends_on ||= DSL::DependsOn.new
  @depends_on_set_in_block = true if @called_in_on_system_block
  return @depends_on if kwargs.empty?

  begin
    @depends_on.load(**kwargs)
  rescue RuntimeError => e
    raise CaskInvalidError.new(cask, e)
  end
  @depends_on
end

#depends_on_set_in_block?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

126
# File 'cask/dsl.rb', line 126

def depends_on_set_in_block? = @depends_on_set_in_block

#deprecate!(date:, because:, replacement: nil) ⇒ Object

Note:

A warning will be shown when trying to install this cask.

Declare that a cask is no longer functional or supported.

[View source]

528
529
530
531
532
533
534
535
# File 'cask/dsl.rb', line 528

def deprecate!(date:, because:, replacement: nil)
  @deprecation_date = Date.parse(date)
  return if @deprecation_date > Date.today

  @deprecation_reason = because
  @deprecation_replacement = replacement
  @deprecated = true
end

#deprecated?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

129
# File 'cask/dsl.rb', line 129

def deprecated? = @deprecated

#desc(description = nil) ⇒ Object

Describes the cask.

Example

desc "Open-source code editor"
[View source]

167
168
169
# File 'cask/dsl.rb', line 167

def desc(description = nil)
  set_unique_stanza(:desc, description.nil?) { description }
end

#disable!(date:, because:, replacement: nil) ⇒ Object

Note:

An error will be thrown when trying to install this cask.

Declare that a cask is no longer functional or supported.

[View source]

542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'cask/dsl.rb', line 542

def disable!(date:, because:, replacement: nil)
  @disable_date = Date.parse(date)

  if @disable_date > Date.today
    @deprecation_reason = because
    @deprecation_replacement = replacement
    @deprecated = true
    return
  end

  @disable_reason = because
  @disable_replacement = replacement
  @disabled = true
end

#disabled?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

132
# File 'cask/dsl.rb', line 132

def disabled? = @disabled

#discontinued?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

488
489
490
491
# File 'cask/dsl.rb', line 488

def discontinued?
  odisabled "`discontinued?`", "`deprecated?` or `disabled?`"
  @caveats&.discontinued? == true
end

#homepage(homepage = nil) ⇒ Object

Sets the cask's homepage.

Example

homepage "https://code.visualstudio.com/"
[View source]

201
202
203
# File 'cask/dsl.rb', line 201

def homepage(homepage = nil)
  set_unique_stanza(:homepage, homepage.nil?) { homepage }
end

#language(*args, default: false, &block) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'cask/dsl.rb', line 205

def language(*args, default: false, &block)
  if args.empty?
    language_eval
  elsif block
    @language_blocks ||= {}
    @language_blocks[args] = block

    return unless default

    if !@cask.allow_reassignment && @language_blocks.default.present?
      raise CaskInvalidError.new(cask, "Only one default language may be defined.")
    end

    @language_blocks.default = block
  else
    raise CaskInvalidError.new(cask, "No block given to language stanza.")
  end
end

#language_evalObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Raises:

[View source]

224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'cask/dsl.rb', line 224

def language_eval
  return @language_eval if defined?(@language_eval)

  return @language_eval = nil if @language_blocks.blank?

  raise CaskInvalidError.new(cask, "No default language specified.") if @language_blocks.default.nil?

  locales = cask.config.languages
                .filter_map do |language|
                  Locale.parse(language)
                rescue Locale::ParserError
                  nil
                end

  locales.each do |locale|
    key = locale.detect(@language_blocks.keys)

    next if key.nil?

    return @language_eval = @language_blocks[key].call
  end

  @language_eval = @language_blocks.default.call
end

#languagesObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

249
250
251
252
253
# File 'cask/dsl.rb', line 249

def languages
  return [] if @language_blocks.nil?

  @language_blocks.keys.flatten
end

#livecheck(&block) ⇒ Object

Automatically fetch the latest version of a cask from changelogs.

[View source]

503
504
505
506
507
508
509
510
511
512
513
# File 'cask/dsl.rb', line 503

def livecheck(&block)
  @livecheck ||= Livecheck.new(cask)
  return @livecheck unless block

  if !@cask.allow_reassignment && @livecheck_defined
    raise CaskInvalidError.new(cask, "'livecheck' stanza may only appear once.")
  end

  @livecheck_defined = true
  @livecheck.instance_eval(&block)
end

#livecheck_defined?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

135
# File 'cask/dsl.rb', line 135

def livecheck_defined? = @livecheck_defined

#livecheckable?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Deprecated.

Calling #livecheckable? is deprecated, use #livecheck_defined? instead.

Whether the cask contains a livecheck block. This is a legacy alias for #livecheck_defined?.

Returns:

  • (Boolean)
[View source]

518
519
520
521
# File 'cask/dsl.rb', line 518

def livecheckable?
  # odeprecated "`livecheckable?`", "`livecheck_defined?`"
  @livecheck_defined == true
end

#name(*args) ⇒ Object

Note:

Multiple names can be specified.

Specifies the cask's name.

Example

name "Visual Studio Code"
[View source]

151
152
153
154
155
156
# File 'cask/dsl.rb', line 151

def name(*args)
  @name ||= []
  return @name if args.empty?

  @name.concat(args.flatten)
end

#on_system_blocks_exist?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

138
# File 'cask/dsl.rb', line 138

def on_system_blocks_exist? = @on_system_blocks_exist

#os(macos: nil, linux: nil) ⇒ String?

Sets the cask's os strings.

Example

os macos: "darwin", linux: "tux"

Parameters:

  • macos (String, nil) (defaults to: nil)
  • linux (String, nil) (defaults to: nil)

Returns:

[View source]

408
409
410
411
412
413
414
415
416
# File 'cask/dsl.rb', line 408

def os(macos: nil, linux: nil)
  should_return = macos.nil? && linux.nil?

  set_unique_stanza(:os, should_return) do
    @on_system_blocks_exist = true

    on_system_conditional(macos:, linux:)
  end
end

#os_versionMacOSVersion?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

[View source]

596
597
598
# File 'cask/dsl.rb', line 596

def os_version
  nil
end

#respond_to_missing?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)
[View source]

591
592
593
# File 'cask/dsl.rb', line 591

def respond_to_missing?(*)
  true
end

#set_unique_stanza(stanza, should_return) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

[View source]

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'cask/dsl.rb', line 171

def set_unique_stanza(stanza, should_return)
  return instance_variable_get(:"@#{stanza}") if should_return

  unless @cask.allow_reassignment
    if instance_variable_defined?(:"@#{stanza}") && !@called_in_on_system_block
      raise CaskInvalidError.new(cask, "'#{stanza}' stanza may only appear once.")
    end

    if instance_variable_defined?(:"@#{stanza}_set_in_block") && @called_in_on_system_block
      raise CaskInvalidError.new(cask, "'#{stanza}' stanza may only be overridden once.")
    end
  end

  instance_variable_set(:"@#{stanza}_set_in_block", true) if @called_in_on_system_block
  instance_variable_set(:"@#{stanza}", yield)
rescue CaskInvalidError
  raise
rescue => e
  raise CaskInvalidError.new(cask, "'#{stanza}' stanza failed with: #{e}")
end

#sha256(arg = nil, arm: nil, intel: nil, x86_64: nil, x86_64_linux: nil, arm64_linux: nil) ⇒ Symbol, ...

Sets the cask's download checksum.

Example

For universal or single-architecture downloads:

sha256 "7bdb497080ffafdfd8cc94d8c62b004af1be9599e865e5555e456e2681e150ca"

For architecture-dependent downloads:

sha256 arm:          "7bdb497080ffafdfd8cc94d8c62b004af1be9599e865e5555e456e2681e150ca",
       x86_64:       "b3c1c2442480a0219b9e05cf91d03385858c20f04b764ec08a3fa83d1b27e7b2"
       x86_64_linux: "1a2aee7f1ddc999993d4d7d42a150c5e602bc17281678050b8ed79a0500cc90f"
       arm64_linux:  "bd766af7e692afceb727a6f88e24e6e68d9882aeb3e8348412f6c03d96537c75"

Parameters:

  • arg (String, Symbol, nil) (defaults to: nil)
  • arm (String, nil) (defaults to: nil)
  • intel (String, nil) (defaults to: nil)
  • x86_64 (String, nil) (defaults to: nil)
  • x86_64_linux (String, nil) (defaults to: nil)
  • arm64_linux (String, nil) (defaults to: nil)

Returns:

[View source]

350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'cask/dsl.rb', line 350

def sha256(arg = nil, arm: nil, intel: nil, x86_64: nil, x86_64_linux: nil, arm64_linux: nil)
  should_return = arg.nil? && arm.nil? && (intel.nil? || x86_64.nil?) && x86_64_linux.nil? && arm64_linux.nil?

  x86_64 ||= intel if intel.present? && x86_64.nil?
  set_unique_stanza(:sha256, should_return) do
    if arm.present? || x86_64.present? || x86_64_linux.present? || arm64_linux.present?
      @on_system_blocks_exist = true
    end

    val = arg || on_system_conditional(
      macos: on_arch_conditional(arm:, intel: x86_64),
      linux: on_arch_conditional(arm: arm64_linux, intel: x86_64_linux),
    )
    case val
    when :no_check
      val
    when String
      Checksum.new(val)
    else
      raise CaskInvalidError.new(cask, "invalid 'sha256' value: #{val.inspect}")
    end
  end
end

#staged_pathPathname

The staged location for this cask, including version number.

Returns:

[View source]

464
465
466
467
468
469
# File 'cask/dsl.rb', line 464

def staged_path
  return @staged_path if @staged_path

  cask_version = version || :unknown
  @staged_path = caskroom_path.join(cask_version.to_s)
end

#url(*args, **options, &block) ⇒ Object

Sets the cask's download URL.

Example

url "https://update.code.visualstudio.com/#{version}/#{arch}/stable"
[View source]

264
265
266
267
268
269
270
271
272
273
274
# File 'cask/dsl.rb', line 264

def url(*args, **options, &block)
  caller_location = T.must(caller_locations).fetch(0)

  set_unique_stanza(:url, args.empty? && options.empty? && !block) do
    if block
      URL.new(*args, **options, caller_location:, dsl: self, &block)
    else
      URL.new(*args, **options, caller_location:)
    end
  end
end

#version(arg = nil) ⇒ DSL::Version?

Sets the cask's version.

Example

version "1.88.1"

Parameters:

Returns:

See Also:

[View source]

310
311
312
313
314
315
316
317
318
# File 'cask/dsl.rb', line 310

def version(arg = nil)
  set_unique_stanza(:version, arg.nil?) do
    if !arg.is_a?(String) && arg != :latest
      raise CaskInvalidError.new(cask, "invalid 'version' value: #{arg.inspect}")
    end

    DSL::Version.new(arg)
  end
end