Sha256: f68a293d2917c6275edbd483c956426d4e278a8f3f0039560882fe9b6cd84535

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module Helper
  def build_variants(dir)
    Dir.glob("#{dir}/*").
      map { |s| File.basename(s).split(/[_\-]/).take(2) }.
      uniq
  end

  def metrics_filename(module_name, build_variant)
    "#{module_name}_#{build_variant}-module.json"
  end

  def composable_stats_report_path(module_name, build_variant)
    "#{module_name}_#{build_variant}-composables.csv"
  end

  def composable_report_path(module_name, build_variant)
    "#{module_name}_#{build_variant}-composables.txt"
  end

  def class_report_path(module_name, build_variant)
    "#{module_name}_#{build_variant}-classes.txt"
  end

  def build_markdown_table(headers, rows)
    [].tap do |table|
      table << "| #{headers.join(' | ')} |"
      table << "| #{headers.map { |h| '---' }.join(' | ')} |"
      rows.each do |row|
        table << "| #{row.join(' | ')} |"
      end
    end.join("\n")
  end

  def folding(summary, details)
    <<~HTML
    <details>
    <summary>

    #{summary}

    </summary>

    #{details}

    </details>
    HTML
  end

  def installed?(command)
    system("which #{command} > /dev/null")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-compose_compiler_metrics-0.0.2 lib/compose_compiler_metrics/helper.rb