Sha256: df6e554771b172738c39d7e7dedc920407d565bcc6b64dbe0b6a2250e8d6bc68

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 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)
          pretty_path = j.root.sub("#{Lono.root}/",'').sub(ENV["HOME"], "~")
          presenter.rows << [j.name, pretty_path, 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

15 entries across 15 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/extension/list.rb
lono-7.5.1 lib/lono/extension/list.rb
lono-7.5.0 lib/lono/extension/list.rb
lono-7.4.11 lib/lono/extension/list.rb
lono-7.4.10 lib/lono/extension/list.rb
lono-7.4.9 lib/lono/extension/list.rb
lono-7.4.8 lib/lono/extension/list.rb
lono-7.4.7 lib/lono/extension/list.rb
lono-7.4.6 lib/lono/extension/list.rb
lono-7.4.5 lib/lono/extension/list.rb
lono-7.4.4 lib/lono/extension/list.rb
lono-7.4.3 lib/lono/extension/list.rb
lono-7.4.2 lib/lono/extension/list.rb
lono-7.4.1 lib/lono/extension/list.rb
lono-7.4.0 lib/lono/extension/list.rb