Sha256: a14221524b280ec5d54d4c13a3840993ceea4d3f4a7cba9cdc835832a6dfa8f8
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'em-eventsource' module Gisha class Commands::Deploy attr_accessor :url, :key_id, :app_name, :revision def initialize(url, key_id, app_name, revision) @url = url @key_id = key_id @app_name = app_name @revision = revision end def exec EM.run do source = EventMachine::EventSource.new(deploy_url) source.inactivity_timeout = 180 source.on('start') do |message| write(message) end source.on('chunk') do |message| write(message) end source.on('stop') do |message| write(message) source.close EM.stop end source.error do |error| write(error) source.close EM.stop raise ArgumentError, error end source.start end end private def deploy_url "#{url}?key_id=#{key_id}&app_name=#{app_name}&revision=#{revision}" end def repo_name repo_path.split('/').last end def write(msg) @stdout ||= begin $stdout.sync = true $stdout end @stdout.write msg end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gisha-0.1.1 | lib/gisha/commands/deploy.rb |
gisha-0.1.0 | lib/gisha/commands/deploy.rb |