Class: Shoestring::CopyConfigFile

Inherits:
Base
  • Object
show all
Defined in:
lib/shoestring/copy_config_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

check

Constructor Details

#initialize(name, source_file, destination_file) ⇒ CopyConfigFile

Returns a new instance of CopyConfigFile.



7
8
9
10
11
# File 'lib/shoestring/copy_config_file.rb', line 7

def initialize(name, source_file, destination_file)
  @name = name
  @source_file = source_file
  @destination_file = destination_file
end

Instance Attribute Details

#destination_fileObject (readonly)

Returns the value of attribute destination_file.



5
6
7
# File 'lib/shoestring/copy_config_file.rb', line 5

def destination_file
  @destination_file
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/shoestring/copy_config_file.rb', line 5

def name
  @name
end

#source_fileObject (readonly)

Returns the value of attribute source_file.



5
6
7
# File 'lib/shoestring/copy_config_file.rb', line 5

def source_file
  @source_file
end

Instance Method Details

#checkObject



13
14
15
16
17
18
# File 'lib/shoestring/copy_config_file.rb', line 13

def check
  unless File.exists?(destination_file)
    FileUtils.cp source_file, destination_file
  end
  puts "#{name}: check!"
end