Class: Vanagon::Engine::Local
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#build_host_name ⇒ Object
Return the target name to build on.
-
#dispatch(command, return_output = false) ⇒ Object
Dispatches the command for execution.
-
#initialize(platform, target = nil, **opts) ⇒ Local
constructor
A new instance of Local.
-
#name ⇒ Object
Get the engine name.
- #retrieve_built_artifact(artifacts_to_fetch, no_packaging) ⇒ Object
- #ship_workdir(workdir) ⇒ Object
Methods inherited from Base
#get_remote_workdir, #parse_target_defaults, #select_target, #setup, #startup, #teardown, #validate_platform
Constructor Details
#initialize(platform, target = nil, **opts) ⇒ Local
Returns a new instance of Local.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vanagon/engine/local.rb', line 8 def initialize(platform, target = nil, **opts) # local engine can't be used with a target super(platform, 'local machine') # We inherit a set of required attributes from Base, # and rather than instantiate a new empty array for # required attributes, we can just clear out the # existing ones. @required_attributes.clear end |
Instance Method Details
#build_host_name ⇒ Object
Return the target name to build on
25 26 27 28 29 30 31 32 |
# File 'lib/vanagon/engine/local.rb', line 25 def build_host_name if @build_host_name.nil? validate_platform @build_host_name = @target end @build_host_name end |
#dispatch(command, return_output = false) ⇒ Object
Dispatches the command for execution
35 36 37 |
# File 'lib/vanagon/engine/local.rb', line 35 def dispatch(command, return_output = false) Vanagon::Utilities.local_command(command, return_command_output: return_output) end |
#name ⇒ Object
Get the engine name
20 21 22 |
# File 'lib/vanagon/engine/local.rb', line 20 def name 'local' end |
#retrieve_built_artifact(artifacts_to_fetch, no_packaging) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vanagon/engine/local.rb', line 43 def retrieve_built_artifact(artifacts_to_fetch, no_packaging) output_path = 'output/' FileUtils.mkdir_p(output_path) unless no_packaging artifacts_to_fetch << "#{@remote_workdir}/output/*" end artifacts_to_fetch.each do |path| FileUtils.cp_r(Dir.glob(path), "output/") end end |
#ship_workdir(workdir) ⇒ Object
39 40 41 |
# File 'lib/vanagon/engine/local.rb', line 39 def ship_workdir(workdir) FileUtils.cp_r(Dir.glob("#{workdir}/*"), @remote_workdir) end |