lib/guard/docker.rb
# Called once when Guard starts. Please override initialize method to init stuff.
#
# @raise [:task_has_failed] when start has failed
# @return [Object] the task result
#
Called once when Guard starts. Please override initialize method to init stuff.
Called once when Guard starts . Please override initialize method to init stuff .
def start
      failed 'You must specify an image' unless @image
      return false unless @image
      stop
      cmd = []
      cmd << 'docker run --rm'
      cmd << "-p #{@host_port}:#{@container_port}" if @host_port && @container_port
      @env_vars.each do |key, value|
        cmd << "-e #{key}=#{value}"
      end if @env_vars
      if @tag
        cmd << "--name=guard-#{@image}-#{@tag}"
        cmd << "#{@image}:#{@tag}"
      else
        cmd << "--name=guard-#{@image}"
        cmd << @image
      end
      spawn(cmd.join(' '))
      success "#{@image} is running"
    end
def start failed 'You must specify an image' unless @image return false unless @image stop cmd = [ ] cmd << 'docker run --rm' cmd << "-p #{@host_port}:#{@container_port}" if @host_port && @container_port @env_vars . each do | key , value | cmd << "-e #{key}=#{value}" end if @env_vars if @tag cmd << "--name=guard-#{@image}-#{@tag}" cmd << "#{@image}:#{@tag}" else cmd << "--name=guard-#{@image}" cmd << @image end spawn ( cmd . join ( ' ' ) ) success "#{@image} is running" end
Called once when Guard starts.
Called once when Guard starts .
the task result
the task result
Object
[:task_has_failed] when start has failed
[ : task_has_failed ] when start has failed