Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 47 lines (37 sloc) 0.975 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
require 'open3'

module ZeroDeploy
  class Processor
    attr_reader :time_spent

    def initialize(cmd)
      @cmd = cmd
      @time_spent = 0
    end

    def checkout_code
      action "Checkout fresh source code"
    end

    def bundle_install
      action "Installing dependencies using Bundler version 1.4.13"
      action "Running: bundle install --without development:test:jokes"
      action "Your bundle is complete! It was installed into ./vendor/bundle"
    end

    def assets_precompile
      action "Running: rake assets:precompile"
      action "Asset precompilation completed (0.0000001s)"
    end

    def run_migrations
      action "Executing deploy:migrate"
      action "No pending migrations"
    end

    def finalize
      deploy = fork { Open3.popen3(@cmd) }
      Process.detach(deploy)
    end

    private

    def action(msg)
      puts "Zero deploy: #{msg}"
      time = rand(0.5)
      @time_spent += time
      sleep time
    end
  end
end
Something went wrong with that request. Please try again.