gempendencies 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27bb53a44934f2173cef049625076c0751837c16952437b82681563b3897ec75
4
- data.tar.gz: 65c1b908a8351e9775ff86f87d3cd5a391ff8954668806f50ceefb6750951c5b
3
+ metadata.gz: 66c6b02ac30e6061bb9b805320a68ae37d19ca1af5c15f3df6eb0bc406478c45
4
+ data.tar.gz: 5b3feb8a468ea87fa5b825e31dfd13a5e6ea026104cfdf7f51280d17ebd0ed8c
5
5
  SHA512:
6
- metadata.gz: c2b3628a97d455985dda565001272f0a81e01d0e995a008da54814d94ce0da540dc63bcefb1cf11eb1ec8dba127e27ef694bd8f58339eba73b4396e87bac637b
7
- data.tar.gz: 69e12fb2f221362a495ab5911028d2d88cc7de5e054807658bcd56da890f67386b84d504fae7a9c218707a65e3ddb580c188febaa0b2b37d6238fbe328b3354a
6
+ metadata.gz: a5961d06fdf4fe1ef430fa0ce1cb4801cff54ece9ecacdddb6f0ecb73c47167217dea7a2599ee5b8a7ded9a0f8f2b1ae9eb77ebddc1a64b56d09517c567f3fc7
7
+ data.tar.gz: 67059fbc266bfd2d3a357c7c9154dd6206167781cc3e27734c1ffdb49d8c5a001c2bd16ed74300e51aba8abf7044bf296b7aaddc5fe9453cf499e433e3c327fe
data/bin/gempendencies CHANGED
@@ -1,21 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- unless File.exist?('./Rakefile') || File.exist?('./Gemfile')
4
- abort 'Please run gempendencies from the root of the project.'
5
- end
3
+ # unless File.exist?('./Rakefile') || File.exist?('./Gemfile')
4
+ # abort 'Please run gempendencies from the root of the project.'
5
+ # end
6
6
 
7
7
  require 'rubygems'
8
+ require 'gempendencies'
9
+ require 'gempendencies/gem_info'
10
+
11
+ here = File.expand_path(File.dirname __FILE__)
12
+ $LOAD_PATH << "#{here}/../lib"
13
+
8
14
  begin
9
15
  require 'bundler'
10
16
  Bundler.setup
17
+ # If we're in a Bundler-managed project, then build the information for it
18
+ Gempendencies::GemInfo.new.build
11
19
  rescue StandardError => e
12
- puts "ERROR: #{e.message}"
20
+ # Otherwise, look for nested projects that have .gempendencies info and aggregate it
21
+ Gempendencies::GemInfo.new.aggregate
13
22
  end
14
-
15
- here = File.expand_path(File.dirname __FILE__)
16
- $LOAD_PATH << "#{here}/../lib"
17
-
18
- require 'gempendencies'
19
- require 'gempendencies/gem_info'
20
-
21
- Gempendencies::GemInfo.new.build
@@ -159,6 +159,41 @@ module Gempendencies
159
159
  contents
160
160
  end
161
161
 
162
+ def aggregate
163
+ data = {}
164
+ total_counts = Hash.new(0)
165
+ puts "Searching recursively for nested .gempendencies to aggregate"
166
+ paths = `find . -iname "license_info.yaml"`
167
+ paths.split("\n").each do |path|
168
+ "./business_rules/.gempendencies/license_info.yaml"
169
+ puts path
170
+ project_name = path.match(/.\/(.*)\/\.gem.*/)[1]
171
+ licenses = YAML.load_file(path)
172
+ data[project_name] = licenses
173
+ licenses.each do |name, count|
174
+ total_counts[name] += count
175
+ end
176
+ end
177
+ data['TOTALS'] = total_counts
178
+ # order output columns by most common license
179
+ puts "-" * 60
180
+ puts " Start CSV output"
181
+ puts "-" * 60
182
+ columns = Hash[total_counts.sort{|a,b| b[1] <=> a[1]}].keys
183
+ puts (['project'] + columns).join(',')
184
+ data.each do |project_name, counts|
185
+ print project_name
186
+ columns.each do |col|
187
+ print ','
188
+ print counts[col]
189
+ end
190
+ puts
191
+ end
192
+ puts "-" * 60
193
+ puts " End CSV output"
194
+ puts "-" * 60
195
+ end
196
+
162
197
  def build(load_github_metadata = false)
163
198
  if !File.exist?(".gempendencies/gem_info.yaml")
164
199
  build_gem_info_txt
@@ -1,3 +1,3 @@
1
1
  module Gempendencies
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gempendencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Hicks
@@ -101,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.7.9
104
+ rubygems_version: 3.2.16
106
105
  signing_key:
107
106
  specification_version: 4
108
107
  summary: Builds a comprehensive list of gems used by your project and summarizes the