Sha256: 03b9f8e4075a9f80a57c5c747e9abaadbc7e89b5ba45c5e510b524c0c30d79e7

Contents?: true

Size: 876 Bytes

Versions: 9

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true

class CategoryDirector < KDirector::Directors::BaseDirector
  defaults(builder_type: CategoryBuilder, on_exist: :write, on_action: :execute)

  def category(name, description)
    builder.category(name, description)

    self
  end

  def generate
    generate_require_all_cmdlets

    self
  end

  def save_categories(**opts)
    cd(:builder_data)
    add('categories.json', content: builder.to_json, **opts)

    self
  end

  def osave_categories(**opts)
    save_categories(**{ open: true }.merge(opts))
  end

  private

  def generate_require_all_cmdlets
    cd(:lib)
    add('_.rb',
      template_file: 'cmdlets_require_all.rb',
      cmdlets: data_access.cmdlet.all_cmdlets)

    cd(:handlebars_lib)
    add('_.rb', 
      template_file: 'handlebars_helper_require_all.rb',
      cmdlets: data_access.cmdlet.all_cmdlets)

  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cmdlet-0.7.0 .builders/director/category_director.rb
cmdlet-0.6.2 .builders/director/category_director.rb
cmdlet-0.6.1 .builders/director/category_director.rb
cmdlet-0.6.0 .builders/director/category_director.rb
cmdlet-0.5.0 .builders/director/category_director.rb
cmdlet-0.4.2 .builders/director/category_director.rb
cmdlet-0.4.1 .builders/director/category_director.rb
cmdlet-0.4.0 .builders/director/category_director.rb
cmdlet-0.3.0 .builders/director/category_director.rb