Class: ActiveMatrix::Generators::BotGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/active_matrix/bot/bot_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_bot_fileObject



16
17
18
# File 'lib/generators/active_matrix/bot/bot_generator.rb', line 16

def create_bot_file
  template 'bot.rb.erb', "app/bots/#{file_name}_bot.rb"
end

#create_bot_testObject



20
21
22
# File 'lib/generators/active_matrix/bot/bot_generator.rb', line 20

def create_bot_test
  template 'bot_test.rb.erb', "test/bots/#{file_name}_bot_test.rb"
end

#display_usageObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/generators/active_matrix/bot/bot_generator.rb', line 24

def display_usage
  say "\nBot created! To use your bot:\n\n"
  say '1. Create an agent in Rails console:'
  say '   agent = ActiveMatrix::Agent.create!('
  say "     name: '#{file_name.dasherize}',"
  say "     matrix_connection: 'primary',"
  say "     bot_class: '#{class_name}Bot'"
  say '   )'
  say "\n2. Start the daemon:"
  say '   bundle exec activematrix start'
  say "\n"
end