def define
      namespace rake_namespace do
        desc 'Print bash exports with IP/ports of running services'
        task :env do
          @shell.interactive = false # suppress useless 'port' output

          tty = STDOUT.tty?
          tlt = Rake.application.top_level_tasks.include?('docker:compose:env')

          # user invoked this task directly; print some helpful tips on
          # how we intend it to be used.
          print_usage if tty && tlt

          export_env(print: tlt)

          @shell.interactive = true
        end

        desc 'Run command on host, linked to services in containers'
        task :host, [:command] => ['docker:compose:env'] do |_task, args|
          if host_services
            @session.up(*host_services, detached: true)
          else
            @session.up(detached: true)
          end

          exec(args[:command])
        end
      end
    end
def define
      namespace rake_namespace do
        desc 'Print bash exports with IP/ports of running services'
        task :env do
          @shell.interactive = false # suppress useless 'port' output

          tty = STDOUT.tty?
          tlt = Rake.application.top_level_tasks.include?('docker:compose:env')

          # user invoked this task directly; print some helpful tips on
          # how we intend it to be used.
          print_usage if tty && tlt

          export_env(print: tlt)

          @shell.interactive = true
        end

        desc 'Run command on host, linked to services in containers'
        task :host, [:command] => ['docker:compose:env'] do |_task, args|
          if host_services
            @session.up(*host_services, detached: true)
          else
            @session.up(detached: true)
          end

          exec(args[:command])
        end
      end
    end
Construct Rake wrapper tasks for docker-compose. If a block is given,
 yield self to the block before defining any tasks so their behavior
 can be configured by calling #server_env=, #file= and so forth.