Sha256: 935dedcc0a763aab51625cf4a8d7e3dab8680bba32809ee92e47e0ba2d967d91

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module Lono::Bundler
  class Info < CLI::Base
    def run
      file = LB.config.lockfile
      unless File.exist?(file)
        logger.info "No #{file} found".color(:red)
        logger.info "Maybe run: lono bundle"
        return
      end

      name = @options[:component]
      all = lockfile.components.find_all { |c| c.name == @options[:component] }
      all = all.select { |c| c.type == @options[:type] } if @options[:type]
      if all.size > 1
        logger.info "Multiple components found with different types"
      end

      all.each do |found|
        show(found)
      end
      unless all.size > 0
        logger.info "Could not find component in #{LB.config.lockfile}: #{name}".color(:red)
      end
    end

    def show(component)
      props = component.props.reject { |k,v| k == :name }.stringify_keys # for sort
      puts "#{component.name}:"
      props.keys.sort.each do |k|
        v = props[k]
        puts "    #{k}: #{v}" unless v.blank?
      end
    end

    def lockfile
      Lockfile.instance
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/bundler/info.rb
lono-8.0.0.pre.rc5 lib/lono/bundler/info.rb
lono-8.0.0.pre.rc4 lib/lono/bundler/info.rb
lono-8.0.0.pre.rc3 lib/lono/bundler/info.rb
lono-8.0.0.pre.rc2 lib/lono/bundler/info.rb
lono-8.0.0.pre.rc1 lib/lono/bundler/info.rb