From 1f67fdfb11caeb1d9b32d8dfb685bab3be452f76 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 16 Aug 2021 11:48:48 -0700 Subject: [PATCH] Move methods and rename to match interface --- plugins/commands/serve/client/project.rb | 17 ++++++++++++++++- plugins/commands/serve/client/target.rb | 20 +++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/plugins/commands/serve/client/project.rb b/plugins/commands/serve/client/project.rb index ad1f49883..7b0c94ac0 100644 --- a/plugins/commands/serve/client/project.rb +++ b/plugins/commands/serve/client/project.rb @@ -15,7 +15,7 @@ module VagrantPlugins end def self.load(raw_project, broker:) - p = SDK::Args::Project.decode(raw_project) + p = raw_project.is_a?(String) ? SDK::Args::Project.decode(raw_project) : raw_project self.new(connect(proto: p, broker: broker), broker) end @@ -46,6 +46,21 @@ module VagrantPlugins broker: broker ) end + + # TODO: fix + def local_data_path + Pathname.new('.') + end + + # @return [String] name of the Vagrantfile for this target + def vagrantfile_name + client.vagrantfile_name(Empty.new) + end + + # @return [Pathname] path to the Vagrnatfile for this target + def vagrantfile_path + Pathname.new(client.vagrantfile_path(Empty.new).path) + end end end end diff --git a/plugins/commands/serve/client/target.rb b/plugins/commands/serve/client/target.rb index 71430b170..9807b0100 100644 --- a/plugins/commands/serve/client/target.rb +++ b/plugins/commands/serve/client/target.rb @@ -45,7 +45,7 @@ module VagrantPlugins end # @return [String] name of target - def get_name + def name client.name(Empty.new).name end @@ -87,21 +87,16 @@ module VagrantPlugins client.provider(Empty.new) end + # TODO: needs to be added + def provider_name + "virtualbox" + end + # @return [Project] project this target is within def project Project.load(client.project(Empty.new), broker: broker) end - # @return [String] name of the Vagrantfile for this target - def vagrantfile_name - client.vagrantfile_name(Empty.new) - end - - # @return [Pathname] path to the Vagrnatfile for this target - def vagrantfile_path - Pathname.new(client.vagrantfile_path(Empty.new.path)) - end - # @return [Time] time target was last updated def updated_at Time.parse(client.updated_at(Empty.new).updated_at) @@ -109,7 +104,7 @@ module VagrantPlugins # @return [Symbol] state of the target def state - STATES[client.get_state(Empty.new).state] + client.state(Empty.new).state end # @return [Machine] specialize target into a machine client @@ -118,7 +113,6 @@ module VagrantPlugins client.specialize(Google::Protobuf::Any.new).value, broker: broker ) - # req mechine and load end end end