Sha256: 2852a3395682c4f3b55fd8116c11a345661f5b3c8776084c7eed89133e402052

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

module RepoAnalyzer
  class BundlerStatsExtractor < ProjectInfoExtractor
    private

    def extracted_info
      stats['gems'] = gems_info
      stats
    end

    def gems_info
      gem_names.inject([]) do |memo, gem_name|
        result = `bundle exec bundle-stats show '#{gem_name}' -f json`
        memo << JSON.parse(result)
        memo
      end
    end

    def gem_names
      stats['gems'].map { |gem| gem['name'] }
    end

    def stats
      @stats ||= JSON.parse(`bundle exec bundle-stats stats -f json`)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repo_analyzer-1.6.0 app/extractors/repo_analyzer/bundler_stats_extractor.rb