Sha256: 9fa1ac52df2aa1e14cfe3770be200c4e164b9e0e9cfd1f718c12097455a38929
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require_relative '../../command' module Sumcli module Commands class Add class Service class Postgres < Sumcli::Command DOCKER_FILE = 'docker-compose.yml' def initialize(name, version, options) @name = name @version = version @options = options end def execute(input: $stdin, output: $stdout) generator.copy_file 'lib/sumcli/templates/add/service/database.yml.erb', 'config/database.yml' generator.copy_file 'lib/sumcli/templates/add/service/database.yml.ctmpl.erb', 'config/database.yml.ctmpl' output.puts "\n #{@name} added to docker-compose" if self.send("add_#{@name}") end def add_postgres content = <<-TEXT db: image: 'postgres:#{@version}' ports: - '5432' TEXT generator.safe_inject_into_file DOCKER_FILE, content, after: "services:\n" end def ask_to_set(ver) prompt.yes?("The default version of #{@name} is #{ver}." + "\n\nDo you want to add with version #{@version}?") end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sumcli-0.4.0 | lib/sumcli/commands/add/service/postgres.rb |