Class: Dev::Template::Docker::Application
- Inherits:
-
ApplicationInterface
- Object
- BaseInterface
- ApplicationInterface
- Dev::Template::Docker::Application
- Defined in:
- lib/firespring_dev_commands/templates/docker/application.rb
Overview
Contains all default rake tasks for a docker application
Instance Method Summary collapse
-
#create_build_task! ⇒ Object
Create the rake task which runs a docker compose build for the application name.
-
#create_down_task! ⇒ Object
Create the rake task which runs a docker compose down for the application name.
-
#create_logs_task! ⇒ Object
Create the rake task which runs a docker compose logs for the application name.
-
#create_pull_task! ⇒ Object
Create the rake task which runs a docker compose pull for the application name.
-
#create_push_task! ⇒ Object
Create the rake task which runs a docker compose push for the application name.
-
#create_reload_task! ⇒ Object
Create the rake task which stops, cleans, and starts the application.
-
#create_sh_task! ⇒ Object
Create the rake task which runs a docker compose exec bash for the application name.
-
#create_up_no_deps_task! ⇒ Object
Create the rake task which runs a docker compose up --no-deps for the application name.
-
#create_up_task! ⇒ Object
Create the rake task which runs a docker compose up for the application name.
Methods inherited from ApplicationInterface
Methods inherited from BaseInterface
Constructor Details
This class inherits a constructor from Dev::Template::ApplicationInterface
Instance Method Details
#create_build_task! ⇒ Object
Create the rake task which runs a docker compose build for the application name
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 9 def create_build_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:build) desc "Builds the #{application} container" task build: %w(init_docker) do LOG.debug "In #{application} build" Dev::Docker::Compose.new(services: [application]).build end end end end |
#create_down_task! ⇒ Object
Create the rake task which runs a docker compose down for the application name
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 98 def create_down_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:down) desc "Stops the #{application} container" task down: %w(init_docker) do LOG.debug "In #{application} down" # docker-copmose down shuts down everything (you can't only specify a single service) # therefore, stop the service manually and prune ununsed resources (just like a down would) Dev::Docker::Compose.new(services: [application]).stop Dev::Docker.new.prune_containers Dev::Docker.new.prune_networks Dev::Docker.new.prune_volumes if ENV['REMOVE_VOLUMES'].to_s.strip == 'true' Dev::Docker.new.prune_images end end end end |
#create_logs_task! ⇒ Object
Create the rake task which runs a docker compose logs for the application name
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 80 def create_logs_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:logs) desc "Shows logs for the #{application} container" task logs: %w(init_docker) do LOG.debug "In #{application} logs" Dev::Docker::Compose.new(services: [application]).logs end end end end |
#create_pull_task! ⇒ Object
Create the rake task which runs a docker compose pull for the application name
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 158 def create_pull_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:pull) desc "Pull the #{application} container from the configured image repository" task pull: %w(init_docker) do LOG.debug "In #{application} pull" Dev::Docker::Compose.new(services: [application]).pull end end end end |
#create_push_task! ⇒ Object
Create the rake task which runs a docker compose push for the application name
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 140 def create_push_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:push) desc "Push the #{application} container to the configured image repository" task push: %w(init_docker) do LOG.debug "In #{application} push" Dev::Docker::Compose.new(services: [application]).push end end end end |
#create_reload_task! ⇒ Object
Create the rake task which stops, cleans, and starts the application
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 123 def create_reload_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:reload) desc "Reloads the #{application} container" task reload: %w(init_docker down up) do # Run the down and then the up commands end end end end |
#create_sh_task! ⇒ Object
Create the rake task which runs a docker compose exec bash for the application name
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 63 def create_sh_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:sh) desc "Open a shell into a running #{application} container" task sh: %W(init_docker #{application}:up) do Dev::Docker::Compose.new(services: [application]).sh end end end end |
#create_up_no_deps_task! ⇒ Object
Create the rake task which runs a docker compose up --no-deps for the application name
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 45 def create_up_no_deps_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:up_no_deps) desc "Starts up the #{application} container but no dependencies" task up_no_deps: %w(init_docker) do LOG.debug "In #{application} up_no_deps" Dev::Docker::Compose.new(services: [application], options: ['--no-deps']).up end end end end |
#create_up_task! ⇒ Object
Create the rake task which runs a docker compose up for the application name
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/firespring_dev_commands/templates/docker/application.rb', line 27 def create_up_task! application = @name exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do return if exclude.include?(:up) desc "Starts up the #{application} container and it's dependencies" task up: %w(init_docker) do LOG.debug "In #{application} up" Dev::Docker::Compose.new(services: [application]).up end end end end |