Class: Cleon::Services::PortServices

Inherits:
Service
  • Object
show all
Defined in:
lib/cleon/services/port_services.rb

Overview

Clone services from Cleon's gem into home gem

Examples:

the following command will get services from gem 'auth'

and place service ports of Auth::Services under lib/root/ports folder
it also will place lib/root/ports.rb with all those ports required

PortCleonServices.('auth', 'ports')

Constant Summary

Constants included from ArGuards

ArGuards::GuardModel

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(get_from, place_to) ⇒ PortServices

Returns a new instance of PortServices.

Parameters:

  • get_from (String)

    the Cleon's gem where to get services from

  • place_to (String)

    the folder for placing service ports


19
20
21
22
23
# File 'lib/cleon/services/port_services.rb', line 19

def initialize(get_from, place_to)
  # TODO: inside a gem or just everywhere ?
  @get_from = get_from
  @place_to = place_to
end

Instance Method Details

#callObject


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cleon/services/port_services.rb', line 25

def call
  # TODO: create service_port template
  # TODO: check ports folder
  #       - create when not exist
  #       - fail when exist
  # TODO: clone service_port, in basics or @place_to?
  # TODO: create service_port descendant for each service in @get_from
  # TODO: create require_relative '@place_to/port_descendant'
  # TODO: create demo library class
  #       that accepts the same parameters as target service
  #       that just call appropriate port_descendant 
  bundle = Cleon::Explorer.(@get_from)
  bundle.each do |bu|
    bu[:service]
    bu[:params]
    bu[:args]
    bu[:helper]
  end
end