Class: Gemkeeper::CLI::Commands::List

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/gemkeeper/cli/commands/list.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gemkeeper/cli/commands/list.rb', line 11

def call(**options)
  config = Configuration.load(options[:config])

  gem_files = Dir.glob(File.join(config.gems_path, "gems", "*.gem"))

  if gem_files.empty?
    puts "No gems cached in Geminabox"
    puts "  Gems directory: #{config.gems_path}"
    return
  end

  puts "Cached gems:"
  gem_files.sort.each do |gem_file|
    gem_name = File.basename(gem_file, ".gem")
    puts "  #{gem_name}"
  end
end