Move methods and rename to match interface

This commit is contained in:
Chris Roberts 2021-08-16 11:48:48 -07:00 committed by Paul Hinze
parent d2ed78861e
commit 1f67fdfb11
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 23 additions and 14 deletions

View File

@ -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

View File

@ -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