Class: Sumcli::Commands::Add::Service
- Inherits:
-
Sumcli::Command
- Object
- Sumcli::Command
- Sumcli::Commands::Add::Service
- Defined in:
- lib/sumcli/commands/add/service.rb
Constant Summary collapse
- DOCKER_FILE =
'docker-compose.yml'
Instance Method Summary collapse
- #add_postgres ⇒ Object
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(name, options) ⇒ Service
constructor
A new instance of Service.
Methods inherited from Sumcli::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(name, options) ⇒ Service
Returns a new instance of Service.
12 13 14 15 |
# File 'lib/sumcli/commands/add/service.rb', line 12 def initialize(name, ) @name = name @options = end |
Instance Method Details
#add_postgres ⇒ Object
23 24 25 26 |
# File 'lib/sumcli/commands/add/service.rb', line 23 def add_postgres() generator.inject_into_file DOCKER_FILE, " db:\n" + " image: 'postgres:9.6.3'\n" + " ports:\n" + " - '5432'", after: "services:\n" end |
#execute(input: $stdin, output: $stdout) ⇒ Object
17 18 19 20 21 |
# File 'lib/sumcli/commands/add/service.rb', line 17 def execute(input: $stdin, output: $stdout) self.send("add_#{@name}") output.puts @name + ' added to docker-compose' end |