Sha256: 1168404a1a290c23d61318373167a99e50c0a85a5f04ebf031ec05de9309c0dc

Contents?: true

Size: 866 Bytes

Versions: 22

Compression:

Stored size: 866 Bytes

Contents

require "open3"

class Bard::CLI < Thor
  class CI
    class Local < Struct.new(:project_name, :branch, :sha)
      def run
        start

        start_time = Time.new.to_i
        while building?
          elapsed_time = Time.new.to_i - start_time
          yield elapsed_time, nil
          sleep(2)
        end

        @stdin.close
        @console = @stdout_and_stderr.read
        @stdout_and_stderr.close

        success?
      end

      def exists?
        true
      end

      def console
        @console
      end

      attr_accessor :last_response

      private

      def start
        @stdin, @stdout_and_stderr, @wait_thread = Open3.popen2e("CLEAN=true bin/rake ci")
      end

      def building?
        ![nil, false].include?(@wait_thread.status)
      end

      def success?
        @wait_thread.value.success?
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bard-0.68.0 lib/bard/ci/local.rb
bard-0.67.0 lib/bard/ci/local.rb
bard-0.66.0 lib/bard/ci/local.rb
bard-0.65.0 lib/bard/ci/local.rb
bard-0.64.1 lib/bard/ci/local.rb
bard-0.64.0 lib/bard/ci/local.rb
bard-0.63.0 lib/bard/ci/local.rb
bard-0.62.2 lib/bard/ci/local.rb
bard-0.62.1 lib/bard/ci/local.rb
bard-0.62.0 lib/bard/ci/local.rb
bard-0.61.0 lib/bard/ci/local.rb
bard-0.60.0 lib/bard/ci/local.rb
bard-0.59.3 lib/bard/ci/local.rb
bard-0.59.2 lib/bard/ci/local.rb
bard-0.59.1 lib/bard/ci/local.rb
bard-0.59.0 lib/bard/ci/local.rb
bard-0.58.0 lib/bard/ci/local.rb
bard-0.57.0 lib/bard/ci/local.rb
bard-0.56.0 lib/bard/ci/local.rb
bard-0.55.0 lib/bard/ci/local.rb