Class: Appifier::Actors::Retriever

Inherits:
Object
  • Object
show all
Extended by:
Carioca::Injector
Defined in:
lib/appifier/actors/retriever.rb

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(origin:, type: :archive, destination: File.expand_path(Appifier::DEFAULT_TEMPLATES_PATH)) ⇒ Retriever

Returns a new instance of Retriever.



35
36
37
38
39
40
# File 'lib/appifier/actors/retriever.rb', line 35

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

Instance Method Details

#getObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/appifier/actors/retriever.rb', line 42

def get
  template = TYPE[@type].get origin: @origin, destination: @destination
  result = Appifier::Components::Template.validate!(template: template)
  unless result[:error].empty?
    output.ko "Template #{template} retrieving cancelled" 
    Appifier::Components::Template.rm(template) unless result[:error].empty?

  end 
  return result
end