Class: Kybus::CLI::Bot::ComposefileGenerator

Inherits:
FileProvider show all
Defined in:
lib/kybus/cli/bot/file_providers/composefile_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, #keep_files

Constructor Details

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

Instance Method Details

#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
46
47
48
49
50
# File 'lib/kybus/cli/bot/file_providers/composefile_generator.rb', line 17

def make_contents
  content = <<~DOCKERCOMPOSE
    version: '3'
    services:
      app:
        build: .
        volumes:
          - .:/app
  DOCKERCOMPOSE

  if @config[:db_adapter] == 'dynamoid'
    content << <<-LOCALSTACK
  localstack:
    image: localstack/localstack
    ports:
      - "4566:4566"
    environment:
      - SERVICES=dynamodb
    LOCALSTACK
  elsif @config[:db_adapter] == 'sequel'
    content << <<-DATABASE
  db:
    image: postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: app_development
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    DATABASE
  end

  content
end

#saving_pathObject



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

def saving_path
  'docker-compose.yml'
end

#skip_file?Boolean

Returns:

  • (Boolean)


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

def skip_file?
  !@config[:with_docker_compose]
end