Class: Itamae::Resource::RemoteFile

Inherits:
Object
  • Object
show all
Defined in:
lib/daddy/itamae/ext/resource/remote_file.rb

Instance Method Summary collapse

Instance Method Details

#find_source_file_in_templatesObject



21
22
23
24
25
26
27
28
29
# File 'lib/daddy/itamae/ext/resource/remote_file.rb', line 21

def find_source_file_in_templates
  itamae_dir = ::File.expand_path('../../../../../../itamae', __FILE__)
  path = ::File.join(itamae_dir, source_file_dir, "#{attributes.path}.erb")
  if ::File.exist?(path)
    path
  else
    raise SourceNotFoundError, "source file is not found (searched in daddy path: #{path})"
  end
end

#find_source_file_with_daddy_conventionObject Also known as: find_source_file



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/daddy/itamae/ext/resource/remote_file.rb', line 7

def find_source_file_with_daddy_convention
  begin
    ret = find_source_file_without_daddy_convention
  rescue SourceNotFoundError => e
    if attributes.source == :auto
      ret = find_source_file_in_templates
    else
      raise e
    end
  end

  ret
end