Class: Kybus::CLI::Bot::Config::ConfigDefaultGenerator

Inherits:
FileProvider
  • Object
show all
Defined in:
lib/kybus/cli/bot/file_providers/config_default_generator.rb

Instance Method Summary collapse

Methods inherited from FileProvider

autoregister!, #bot_name, #bot_name_class, #bot_name_constantize, #bot_name_snake_case, #generate, #initialize, #skip_file?

Constructor Details

This class inherits a constructor from Kybus::CLI::Bot::FileProvider

Instance Method Details

#keep_filesObject



13
14
15
# File 'lib/kybus/cli/bot/file_providers/config_default_generator.rb', line 13

def keep_files
  ['models/migrations/.keep']
end

#make_contentsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kybus/cli/bot/file_providers/config_default_generator.rb', line 17

def make_contents
  content = <<~YAML
    logger:
      stdout: yes
      severity: debug
    bots:
      main:
        pool_size: 1
        inline_args: true
        provider:#{' '}
          name: REPLACE_ME
          token: REPLACE_ME
          debug: true
        state_repository:
  YAML

  if @config[:db_adapter] == 'sequel'
    content << <<~SEQUEL
              name: sequel
              endpoint: 'sqlite://#{bot_name_snake_case}_botmeta.db'
      database: 'sqlite://#{bot_name_snake_case}.db'
    SEQUEL
  elsif @config[:db_adapter] == 'dynamoid'
    content << <<-DYNAMOID
        name: json
        storage: ./storage
    DYNAMOID
  end
end

#saving_pathObject



9
10
11
# File 'lib/kybus/cli/bot/file_providers/config_default_generator.rb', line 9

def saving_path
  'config/config.default.yaml'
end