Giter Club home page Giter Club logo

bundler-stats's People

Contributors

etagwerker avatar gmcnaughton avatar jmmastey avatar ldlsegovia avatar olivierlacan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bundler-stats's Issues

overhaul table printing

specifically, bundler-stats show is a mess. extract the table printing as a concern (probably don't include tableprint gem since we're so light on dependencies already...)

I had to manually install `pry` to get it to work

 ✘ benallison@grey-beast  ~/ihr/ios-flagship   develop ●  bundle-stats help
Traceback (most recent call last):
	14: from /Users/benallison/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
	13: from /Users/benallison/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
	12: from /Users/benallison/.rvm/gems/ruby-2.6.3/bin/bundle-stats:23:in `<main>'
	11: from /Users/benallison/.rvm/gems/ruby-2.6.3/bin/bundle-stats:23:in `load'
	10: from /Users/benallison/.rvm/gems/ruby-2.6.3/gems/bundler-stats-1.1.0/bin/bundle-stats:9:in `<top (required)>'
	 9: from /Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 8: from /Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 7: from /Users/benallison/.rvm/gems/ruby-2.6.3/gems/bundler-stats-1.1.0/lib/bundler/stats/cli.rb:5:in `<top (required)>'
	 6: from /Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 5: from /Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 4: from /Users/benallison/.rvm/gems/ruby-2.6.3/gems/bundler-stats-1.1.0/lib/bundler/stats.rb:2:in `<top (required)>'
	 3: from /Users/benallison/.rvm/gems/ruby-2.6.3/gems/bundler-stats-1.1.0/lib/bundler/stats.rb:2:in `require_relative'
	 2: from /Users/benallison/.rvm/gems/ruby-2.6.3/gems/bundler-stats-1.1.0/lib/bundler/stats/tree.rb:1:in `<top (required)>'
	 1: from /Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/benallison/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- pry (LoadError)
 ✘ benallison@grey-beast  ~/ihr/ios-flagship   develop ●  gem install pry
Fetching method_source-1.0.0.gem
Fetching coderay-1.1.3.gem
Fetching pry-0.13.1.gem
Successfully installed coderay-1.1.3
Successfully installed method_source-1.0.0
Successfully installed pry-0.13.1
invalid options: -SNw2
(invalid options are ignored)
Parsing documentation for coderay-1.1.3
Installing ri documentation for coderay-1.1.3
Parsing documentation for method_source-1.0.0
Installing ri documentation for method_source-1.0.0
Parsing documentation for pry-0.13.1
Installing ri documentation for pry-0.13.1
Done installing documentation for coderay, method_source, pry after 1 seconds
3 gems installed
 benallison@grey-beast  ~/ihr/ios-flagship   develop ●  bundle-stats help
Commands:
  bundle-stats help [COMMAND]   # Describe available commands or one specific command
  bundle-stats show TARGET      # Prints the dependency tree for a single gem in your Gemfile
  bundle-stats stats            # Displays basic stats about the gems in your Gemfile
  bundle-stats version          # Prints the bundler-stats version
  bundle-stats versions TARGET  # Shows versions requirements for target in other dependencies

fix nofollow

Even in the README examples, there's a gem that appears to have some unique dependencies. But when nofollow is added to the command, those unique dependencies disappear.

I think nofollow is basically excluding the selected gem itself, which would always cause an empty set of unique dependencies.

[BUG] Different order in results table for different environment

Hi there,

I've noticed a weird issue when adding a feature to rails_stats which relies on bundler-stats, the order of the gems has one order in my MacBook Pro and a slightly different order in GitHub CI.

  1) Failure: RailsStats::CodeStatistics::#to_s#test_0001_outputs useful stats for a Rails project [/home/runner/work/rails_stats/rails_stats/test/lib/rails_stats/code_statistics_test.rb:48]:
--- expected
+++ actual
@@ -6,10 +6,10 @@
 |           rails_stats | 4          | 2              |
 |             simplecov | 3          | 3              |
 |       minitest-around | 1          | 1              |
+| minitest-spec-context | 0          | 0              |
 |              minitest | 0          | 0              |
-|               bundler | 0          | 0              |
 |                byebug | 0          | 0              |
-| minitest-spec-context | 0          | 0              |
+|               bundler | 0          | 0              |
 +-----------------------|------------|----------------+
                           
       Declared Gems   9   

2 runs, 10 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/runner/work/rails_stats/rails_stats/coverage. 487 / 670 LOC (72.69%) covered.

Source: fastruby/rails_stats#21

I think this could be fixed if gem_stats returned a result that was sorted by two attributes:

  • Total Dependencies (descending)
  • Name (ascending)

The patch should be pretty straightforward. If you are interested I could submit a PR for this.

[BUG] ArgumentError within GitHub CI environment: invalid value for Integer(): ""

Hi @jmmastey,

Thanks for creating this gem! It has been very useful in estimating how big a Ruby/Rails application really is. I wrote a little bit about it over here: How we estimate the size of a Rails application

I wanted to incorporate it to rails_stats as a way to get both bundler and LOC stats, so I went ahead and submitted: fastruby/rails_stats#21

Unfortunately my test suite fails with this error:

  1) Error:
50
RailsStats::CodeStatistics::#to_s#test_0001_outputs useful stats for a Rails project:
51
ArgumentError: invalid value for Integer(): ""
52
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:40:in `Integer'
53
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:40:in `terminal_width'
54
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:50:in `column_widths'
55
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:21:in `to_s'
56
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/cli.rb:69:in `draw_stats'
57
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/cli.rb:23:in `stats'
58
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
59
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
60
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
61
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
62
    /home/runner/work/rails_stats/rails_stats/lib/rails_stats/console_formatter.rb:6:in `to_s'
63
    /home/runner/work/rails_stats/rails_stats/lib/rails_stats/code_statistics.rb:11:in `to_s'
64
    /home/runner/work/rails_stats/rails_stats/test/lib/rails_stats/code_statistics_test.rb:45:in `block (4 levels) in <top (required)>'
65

I see that in your test suite you stub the method that calls tput:

def set_term_width(width)
allow(Kernel).to receive(:"`").and_return(width)
end

I assume that is a good way to get around that issue in CI.

Would you be interested in a simple patch to this method?

Please let me know.

Thanks,
Ernesto

versions should report the current version of your gem

mealhand (talk-prep) > bundle-stats versions rspec
bundle-stats for rspec

depended upon by (1)
+-------------|-------------------+
| Name | Required Version |
+-------------|-------------------+
| guard-rspec | < 4.0, >= 2.99.0 |
+-------------|-------------------+

Unknown gem tzinfo-data (ArgumentError)

Just tried to install and run bundler-stats on Ruby 2.4.2 under macOS and instantly got this error when running it without arguments:

$ bundle-stats
/Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/tree.rb:38:in `transitive_dependencies': Unknown gem tzinfo-data (ArgumentError)
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/tree.rb:13:in `summarize'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/calculator.rb:65:in `block in gem_stats'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/calculator.rb:64:in `map'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/calculator.rb:64:in `gem_stats'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/calculator.rb:40:in `stats'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/lib/bundler/stats/cli.rb:18:in `stats'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-stats-1.1.2/bin/bundle-stats:11:in `<top (required)>'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/bin/bundle-stats:23:in `load'
	from /Users/olivierlacan/.rbenv/versions/2.4.2/bin/bundle-stats:23:in `<main>'

It feels familiar but I can remember why. This gem appears in the DEPENDENCIES list in the Gemfile.lock of the app I'm working with but not anywhere else. Might be a merge conflict artifact.

Although when running bundle install this message appears:

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java.

Seems like it might be what's confusing bundler-stats. It's a listed gem that isn't installed on the platform I'm running from on purpose.

require 'pry' outside dev env throws error

Hi,

Thanks for this gem, it saved me a trip down the rabbit hole to find which gem blocked my bundle update nokogiri (like described in https://olivierlacan.com/posts/why-wont-bundle-update/ ). However when I first tried this gem, I got an exception as pry was required but it's only a dependency for development, not when running/using the gem (bundle-stats versions nokogiri worked perfectly after I removed that line)

I'm not sure what the correct fix would be, either removing that line or making sure it's only required for development purposes?

A snippet of the stack trace :

$ bundle-stats versions nokogiri
/Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats/tree.rb:1:in `require': cannot load such file -- pry (LoadError)
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats/tree.rb:1:in `<top (required)>'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats.rb:2:in `require_relative'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats.rb:2:in `<top (required)>'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats/cli.rb:5:in `require'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/lib/bundler/stats/cli.rb:5:in `<top (required)>'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/bin/bundle-stats:9:in `require'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/gems/bundler-stats-1.1.0/bin/bundle-stats:9:in `<top (required)>'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/bin/bundle-stats:23:in `load'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/bin/bundle-stats:23:in `<main>'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/bin/ruby_executable_hooks:15:in `eval'
  from /Users/toncigalic/.rvm/gems/ruby-2.3.4/bin/ruby_executable_hooks:15:in `<main>'

I hope my description makes sense and thanks again for this gem, it's really useful :D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.