Sha256: 0cbc22cd43846f3431758d9940a5da999fdb48d026311ae8ababab2bb8d836be

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: false

module Appifier
  module Actors
    module Retrivers
      class Git
        def self.get(origin:, destination:); 
          raise 'not yest implemented'
        end
      end

      class Archive
        def self.get(origin:, destination:)
          raise "Archive : #{origin} not found" unless File::exist? origin
          untar_gz archive: origin, destination: destination
        end
      end
    end

    class Retriever
      extend Carioca::Injector
      inject service: :output

      TYPE = { archive: Appifier::Actors::Retrivers::Archive, git: Appifier::Actors::Retrivers::Git }

      def initialize(origin:, type: :archive, destination: File.expand_path(Appifier::DEFAULT_TEMPLATES_PATH))
        @origin = origin
        @type = type
        @destination = destination
        output.info "retrieving template from #{origin}"
      end

      def get
        TYPE[@type].get origin: @origin, destination: @destination
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appifier-0.1.2 lib/appifier/actors/retriever.rb