Sha256: bd527a2bf8cf64b12b92d919ac57a1a2744aa589788e98345e6a3c847dd719f8

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

namespace :gemfile_info do
  desc 'Show a description about each gem in your Gemfile.'
  task :desc do
    gemfile = Rails.root + "Gemfile"
    gem_list = []
    File.open(gemfile.to_path) do |file|
      file.each do |line|        
        if line =~ /^gem/ || line =~ /^\s\sgem/
          gem_name = line.strip.split(/\s/)[1]&.gsub(/[,('|")]/, '')
          if gem_name&.present?
            gem_list << gem_name
          end
        end 
      end
    end
    
    gem_list.each do |gem_name|
      puts %x[gem list #{gem_name} -le --details]
      puts "\n"
    end
    puts "Total Gems: #{gem_list.size}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemfile_info-0.1.0 lib/tasks/gemfile_info.rake