Sha256: f2934c30604c9c9415932ca3d9e3d1fb119be95aa1371ff88b71f9e07e22bf65

Contents?: true

Size: 909 Bytes

Versions: 40

Compression:

Stored size: 909 Bytes

Contents

require 'tty-markdown'

module Inferno
  module CLI
    class Suites
      def run
        ENV['NO_DB'] = 'true'

        require_relative '../../../inferno'

        Inferno::Application.start(:suites)

        suites = Inferno::Repositories::TestSuites.new.all
        suite_hash = suites.each_with_object({}) { |suite, hash| hash[suite.id] = suite.title }

        id_column_length = suite_hash.keys.map(&:length).max + 2
        title_column_length = suite_hash.values.map(&:length).max + 1

        output = ''
        output += "| #{'Title'.ljust(title_column_length)}| #{'ID'.ljust(id_column_length)}|\n"
        output += "|-#{'-' * title_column_length}|-#{'-' * id_column_length}|\n"

        suite_hash.each do |id, title|
          output += "| #{title.ljust(title_column_length)}| #{id.ljust(id_column_length)}|\n"
        end

        puts TTY::Markdown.parse(output)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
inferno_core-0.5.4 lib/inferno/apps/cli/suites.rb
inferno_core-0.5.3 lib/inferno/apps/cli/suites.rb
inferno_core-0.5.2 lib/inferno/apps/cli/suites.rb
inferno_core-0.5.1 lib/inferno/apps/cli/suites.rb
inferno_core-0.5.0 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.44 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.43 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.42 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.41 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.40 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.39 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.38 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.35 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.34 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.33 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.32 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.31 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.30 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.29 lib/inferno/apps/cli/suites.rb
inferno_core-0.4.28 lib/inferno/apps/cli/suites.rb