Sha256: 6da3b7098c8382c3d329be58efe5edd814a411fb529c99bda311f2d8cd91660f

Contents?: true

Size: 735 Bytes

Versions: 15

Compression:

Stored size: 735 Bytes

Contents

namespace :dev do
  desc "Appends chunks to the last deploy, or specify with DEPLOY=id"
  task stream: :environment do
    require 'faker'
    logger = Logger.new(STDOUT)

    deploy = Shipit::Deploy.find(ENV['DEPLOY']) if ENV['DEPLOY']
    deploy ||= Deploy.last

    raise "Couldn't find Deploy" unless deploy

    deploy.update_attribute(:output, nil)

    logger.info "Starting to stream data to deploy ##{deploy.id}"

    loop do
      sentence = Faker::Lorem.sentence.split.map do |word|
        if rand(4).zero?
          "\e[#{rand(30..37)}m#{word}\e[0m"
        else
          word
        end
      end.join(' ')

      logger.error sentence

      deploy.chunks.create(text: sentence + "\n")
      sleep 1
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 lib/tasks/dev.rake
shipit-engine-0.30.0 lib/tasks/dev.rake
shipit-engine-0.29.0 lib/tasks/dev.rake
shipit-engine-0.28.1 lib/tasks/dev.rake
shipit-engine-0.28.0 lib/tasks/dev.rake
shipit-engine-0.27.1 lib/tasks/dev.rake
shipit-engine-0.27.0 lib/tasks/dev.rake
shipit-engine-0.26.0 lib/tasks/dev.rake
shipit-engine-0.25.1 lib/tasks/dev.rake
shipit-engine-0.25.0 lib/tasks/dev.rake
shipit-engine-0.24.0 lib/tasks/dev.rake
shipit-engine-0.23.1 lib/tasks/dev.rake
shipit-engine-0.23.0 lib/tasks/dev.rake
shipit-engine-0.22.0 lib/tasks/dev.rake
shipit-engine-0.21.0 lib/tasks/dev.rake