Class: Moonshot::BuildMechanism::VersionProxy

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ResourcesHelper
Defined in:
lib/moonshot/build_mechanism/version_proxy.rb

Overview

This proxies build request do different mechanisms. One for semver compliant releases and another for everything else.

Instance Attribute Summary

Attributes included from ResourcesHelper

#resources

Instance Method Summary collapse

Constructor Details

#initialize(release:, dev:) ⇒ VersionProxy

Returns a new instance of VersionProxy.



14
15
16
17
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 14

def initialize(release:, dev:)
  @release = release
  @dev = dev
end

Instance Method Details

#build_cli_hook(parser) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 42

def build_cli_hook(parser)
  # Expose any command line arguments provided by the build mechanisms. We
  # don't know the version at this point, so we can't call the hook on only
  # the one we're going to use, which may result in options being exposed that
  # are only applicable for one of the build mechanisms.
  parser = @release.build_cli_hook(parser) if @release.respond_to?(:build_cli_hook)
  parser = @dev.build_cli_hook(parser) if @dev.respond_to?(:build_cli_hook)

  parser
end

#build_hook(version) ⇒ Object



34
35
36
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 34

def build_hook(version)
  active(version).build_hook(version)
end

#doctor_hookObject



19
20
21
22
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 19

def doctor_hook
  @release.doctor_hook
  @dev.doctor_hook
end

#post_build_hook(version) ⇒ Object



38
39
40
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 38

def post_build_hook(version)
  active(version).post_build_hook(version)
end

#pre_build_hook(version) ⇒ Object



30
31
32
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 30

def pre_build_hook(version)
  active(version).pre_build_hook(version)
end

#resources=(r) ⇒ Object



24
25
26
27
28
# File 'lib/moonshot/build_mechanism/version_proxy.rb', line 24

def resources=(r)
  super
  @release.resources = r
  @dev.resources = r
end