Class: InstanceAgent::Plugins::CodeDeployPlugin::CopyCommand
- Inherits:
-
Object
- Object
- InstanceAgent::Plugins::CodeDeployPlugin::CopyCommand
- Defined in:
- lib/instance_agent/plugins/codedeploy/install_instruction.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #execute(cleanup_file) ⇒ Object
-
#initialize(source, destination) ⇒ CopyCommand
constructor
A new instance of CopyCommand.
- #to_h ⇒ Object
Constructor Details
#initialize(source, destination) ⇒ CopyCommand
Returns a new instance of CopyCommand.
225 226 227 228 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 225 def initialize(source, destination) @source = source @destination = destination end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
224 225 226 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 224 def destination @destination end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
224 225 226 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 224 def source @source end |
Instance Method Details
#execute(cleanup_file) ⇒ Object
230 231 232 233 234 235 236 237 238 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 230 def execute(cleanup_file) raise "File already exists at #{@destination}" if File.exists?(@destination) cleanup_file.puts(@destination) if File.symlink?(@source) FileUtils.symlink(File.readlink(@source), @destination) else FileUtils.copy(@source, @destination, :preserve => true) end end |
#to_h ⇒ Object
240 241 242 |
# File 'lib/instance_agent/plugins/codedeploy/install_instruction.rb', line 240 def to_h {:type => :copy, :source => @source, :destination => @destination} end |