Add mappers for box proto to client
This commit is contained in:
parent
d0f7d89104
commit
99694b210b
@ -160,6 +160,7 @@ end
|
||||
# NOTE: Always directly load mappers so they are automatically registered and
|
||||
# available. Using autoloading behavior will result in them being unaavailable
|
||||
# until explicitly requested by name
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/box.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/capabilities.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/command.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/direct.rb").to_s
|
||||
|
||||
20
plugins/commands/serve/mappers/box.rb
Normal file
20
plugins/commands/serve/mappers/box.rb
Normal file
@ -0,0 +1,20 @@
|
||||
module VagrantPlugins
|
||||
module CommandServe
|
||||
class Mappers
|
||||
# Build a box client from a proto instance
|
||||
class BoxFromProto < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::Args::Box)
|
||||
i << Input.new(type: Broker)
|
||||
end
|
||||
super(inputs: inputs, output: Client::Box, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto, broker)
|
||||
Client::Box.load(proto, broker: broker)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user