Add mapping for pathnames
This commit is contained in:
parent
a0797da229
commit
3aa4e1bab4
@ -208,6 +208,7 @@ require Vagrant.source_root.join("plugins/commands/serve/mappers/environment.rb"
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/guest.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/known_types.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/machine.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/pathname.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/project.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/state_bag.rb").to_s
|
||||
require Vagrant.source_root.join("plugins/commands/serve/mappers/target.rb").to_s
|
||||
|
||||
33
plugins/commands/serve/mappers/pathname.rb
Normal file
33
plugins/commands/serve/mappers/pathname.rb
Normal file
@ -0,0 +1,33 @@
|
||||
module VagrantPlugins
|
||||
module CommandServe
|
||||
class Mappers
|
||||
class PathnameToProto < Mapper
|
||||
def initialize
|
||||
super(
|
||||
inputs: [Input.new(type: Pathname)],
|
||||
output: SDK::Args::Path,
|
||||
func: method(:converter),
|
||||
)
|
||||
end
|
||||
|
||||
def converter(path)
|
||||
SDK::Args::Path.new(path: path.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
class PathnameFromProto < Mapper
|
||||
def initialize
|
||||
super(
|
||||
inputs: [Input.new(type: SDK::Args::Path)],
|
||||
output: Pathname,
|
||||
func: method(:converter),
|
||||
)
|
||||
end
|
||||
|
||||
def converter(path)
|
||||
Pathname.new(path.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user