Sha256: f832f7c6fc38a8dd9bbd194bfa9a9400520fc79335d9cdc87a6c75a234651864

Contents?: true

Size: 650 Bytes

Versions: 12

Compression:

Stored size: 650 Bytes

Contents

# frozen_string_literal: true

class CmdletDao
  attr_reader :k_builder

  def initialize(k_builder)
    @k_builder = k_builder
  end

  def all_cmdlets
    data_access
      .category
      .categories.flat_map { |category| read_cmdlets(category[:name]) }
      .compact
      .uniq
      .sort_by { |r| [r[:category], r[:name]] }
  end

  private

  def read_cmdlets(category_name)
    file_name = k_builder.target_folders.join(:builder_data, 'cmdlets', "#{category_name}.json")

    return JSON.parse(File.read(file_name), symbolize_names: true)[:cmdlets] if File.exist?(file_name)

    puts "Cmdlet file #{file_name} not found"
    nil
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cmdlet-0.7.0 .builders/director/cmdlet_dao.rb
cmdlet-0.6.2 .builders/director/cmdlet_dao.rb
cmdlet-0.6.1 .builders/director/cmdlet_dao.rb
cmdlet-0.6.0 .builders/director/cmdlet_dao.rb
cmdlet-0.5.0 .builders/director/cmdlet_dao.rb
cmdlet-0.4.2 .builders/director/cmdlet_dao.rb
cmdlet-0.4.1 .builders/director/cmdlet_dao.rb
cmdlet-0.4.0 .builders/director/cmdlet_dao.rb
cmdlet-0.3.0 .builders/director/cmdlet_dao.rb
cmdlet-0.2.1 .builders/director/cmdlet_dao.rb
cmdlet-0.2.0 .builders/director/cmdlet_dao.rb
cmdlet-0.1.2 .builders/director/cmdlet_dao.rb