Sha256: 7b3ec9f54c08b602f70fcf008e9f3fb35309a51fd9ca78b545f590eae7f40758

Contents?: true

Size: 734 Bytes

Versions: 23

Compression:

Stored size: 734 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) == 0
          "\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

23 entries across 23 versions & 1 rubygems

Version Path
shipit-engine-0.20.1 lib/tasks/dev.rake
shipit-engine-0.20.0 lib/tasks/dev.rake
shipit-engine-0.19.0 lib/tasks/dev.rake
shipit-engine-0.18.1 lib/tasks/dev.rake
shipit-engine-0.18.0 lib/tasks/dev.rake
shipit-engine-0.17.0 lib/tasks/dev.rake
shipit-engine-0.16.0 lib/tasks/dev.rake
shipit-engine-0.15.0 lib/tasks/dev.rake
shipit-engine-0.14.0 lib/tasks/dev.rake
shipit-engine-0.13.0 lib/tasks/dev.rake
shipit-engine-0.12.1 lib/tasks/dev.rake
shipit-engine-0.12.0 lib/tasks/dev.rake
shipit-engine-0.11.0 lib/tasks/dev.rake
shipit-engine-0.10.0 lib/tasks/dev.rake
shipit-engine-0.9.0 lib/tasks/dev.rake
shipit-engine-0.8.9 lib/tasks/dev.rake
shipit-engine-0.8.8 lib/tasks/dev.rake
shipit-engine-0.8.7 lib/tasks/dev.rake
shipit-engine-0.8.6 lib/tasks/dev.rake
shipit-engine-0.8.5 lib/tasks/dev.rake