Sha256: c472f9c381b01a583530e5752b98a24e699710f916f8ea6ee4794460e143c4fd

Contents?: true

Size: 984 Bytes

Versions: 21

Compression:

Stored size: 984 Bytes

Contents

require 'itamae/resource/remote_file'

module Itamae
  module Resource
    class RemoteFile

      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

      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

      alias_method :find_source_file_without_daddy_convention, :find_source_file
      alias_method :find_source_file, :find_source_file_with_daddy_convention
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
daddy-0.9.9 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.8 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.7 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.6 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.5 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.4 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.3 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.2 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.1 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.9.0 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.8.1 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.8.0 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.9 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.8 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.7 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.6 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.5 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.4 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.3 lib/daddy/itamae/ext/resource/remote_file.rb
daddy-0.7.2 lib/daddy/itamae/ext/resource/remote_file.rb