Class: Kybus::CLI::Bot::Config::DeploymentFileProvide

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

Instance Method Summary collapse

Methods inherited from FileProvider

autoregister!, #bot_name, #bot_name_class, #bot_name_constantize, #bot_name_snake_case, #generate, #initialize, #keep_files

Constructor Details

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

Instance Method Details

#generate_secret_tokenObject



32
33
34
# File 'lib/kybus/cli/bot/file_providers/deployment_file_provider.rb', line 32

def generate_secret_token
  SecureRandom.alphanumeric(64)
end

#make_contentsObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kybus/cli/bot/file_providers/deployment_file_provider.rb', line 19

def make_contents
  <<~YAML
    name: #{bot_name_snake_case}
    cloud_provider: #{@config[:cloud_provider]}
    dynamo:
      capacity: #{@config[:dynamo_capacity]}
      table_name: #{@config[:dynamo_table]}
    chat_provider: #{@config[:bot_provider]}
    bot_token: #{@config[:bot_token]}
    secret_token: #{generate_secret_token}
  YAML
end

#saving_pathObject



11
12
13
# File 'lib/kybus/cli/bot/file_providers/deployment_file_provider.rb', line 11

def saving_path
  './kybusbot.yaml'
end

#skip_file?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/kybus/cli/bot/file_providers/deployment_file_provider.rb', line 15

def skip_file?
  !@config[:with_deployment_file]
end