Class: Karafka::Cli::Install
Overview
Install Karafka Cli action
Constant Summary collapse
- INSTALL_DIRS =
Directories created by default
%w( app/models app/controllers app/responders app/workers config log tmp/pids ).freeze
- INSTALL_FILES_MAP =
Where should we map proper files from templates
{ 'app.rb.example' => Karafka.boot_file.basename, 'config.ru.example' => 'config.ru', 'sidekiq.yml.example' => 'config/sidekiq.yml.example', 'application_worker.rb.example' => 'app/workers/application_worker.rb', 'application_controller.rb.example' => 'app/controllers/application_controller.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
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/karafka/cli/install.rb', line 30 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 |