Class: Karafka::Cli::Install
Overview
Install Karafka Cli action
Constant Summary collapse
- INSTALL_DIRS =
Directories created by default
%w[ app/consumers app/responders config log tmp/pids ].freeze
- INSTALL_FILES_MAP =
Where should we map proper files from templates
{ 'karafka.rb.example' => Karafka.boot_file.basename, 'application_consumer.rb.example' => 'app/consumers/application_consumer.rb', 'application_responder.rb.example' => 'app/responders/application_responder.rb' }.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call ⇒ Object
Install all required things for Karafka application in current directory.
Methods inherited from Base
bind_to, desc, #initialize, option
Constructor Details
This class inherits a constructor from Karafka::Cli::Base
Instance Method Details
#call ⇒ Object
Install all required things for Karafka application in current directory
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/karafka/cli/install.rb', line 27 def call INSTALL_DIRS.each do |dir| FileUtils.mkdir_p Karafka.root.join(dir) end INSTALL_FILES_MAP.each do |source, target| target = Karafka.root.join(target) next if File.exist?(target) source = Karafka.core_root.join("templates/#{source}") FileUtils.cp_r(source, target) end end |