Sha256: a2424e0d17978ed68bc63c7f2ebe6ed3c8a5c3885608e04273512411527fec9c

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

require 'cli-format'

class Lono::Extension
  class List
    def initialize(options={})
      @options = options
      @stack, @blueprint, @template, @param = Lono::Conventions.new(options).values
    end

    def run
      if @blueprint
        blueprint_configsets
      else
        project_configsets
      end
    end

    def blueprint_configsets
      Lono::Extensions::Preparer.new(@options).run # register and materialize gems
      tracked_extension_names = Lono::Jade::Registry.tracked_extensions.map(&:name)

      finder = Lono::Finder::Extension.new
      jadespecs = finder.find_all

      presenter = CliFormat::Presenter.new(@options)
      presenter.header = %w[Name Path Type]
      jadespecs.each do |j|
        if tracked_extension_names.include?(j.name)
          presenter.rows << [j.name, j.root, j.source_type]
        end
      end
      presenter.show
    end

    def project_configsets
      Lono::Finder::Extension.list(filter_materialized: true, message: "Project extensions:")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lono-7.3.2 lib/lono/extension/list.rb
lono-7.3.1 lib/lono/extension/list.rb
lono-7.3.0 lib/lono/extension/list.rb
lono-7.2.3 lib/lono/extension/list.rb
lono-7.2.2 lib/lono/extension/list.rb
lono-7.2.1 lib/lono/extension/list.rb
lono-7.2.0 lib/lono/extension/list.rb