shageman / cobradeps

Print and export the dependencies within component-based Ruby/Rails #cbra applications
MIT License
41 stars 4 forks source link

Specifying multiple groups within the Gemfile fails to produce a graph. #7

Open daveshah opened 4 years ago

daveshah commented 4 years ago

When attempting to generate a dependency graph at the end of 2.1 in the CBRA book, running cobradeps -g component_diagram . succeeded (in that no errors were shown) but the resulting graph was empty. I decided to re-run with the text option to determine if this was a problem with graphviz, but this produced the following (also, an empty dependency list):

➜  sportsball git:(master): cobradeps -t component_diagram .
APP

DEPENDENCIES

 ALL PARTS

After visiting this repo and combing through the README, I decided to modify my Gemfile to see if changing the way this dependency is specified would produce different results.

If I modify my Gemfile so that I specify the component dependency this way: gem 'app_component', path: 'components/app_component', group: :direct cobradeps succeeds in producing a graph (and the text output works as well).

This works independently of me adding Bundler.require(:direct, *Rails.groups) to my application.rb (I opted to remove this since this seemed to be the case).

If I modify my Gemfile so that I specify the component dependency this way: gem 'app_component', path: 'components/app_component', group: [:default, :direct] cobradeps silently fails (as outlined initially).

I'm currently seeing this issue on Bundler version 2.0.2 and cobradeps version 0.4.1.

shageman commented 4 years ago

Do you mind posting your original Gemfile component statement?

Is it this one? https://github.com/shageman/component-based-rails-applications-book/blob/master/c2s01/sportsball/Gemfile

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Friday, February 14, 2020 4:32 AM, Dave Shah notifications@github.com wrote:

When attempting to generate a dependency graph at the end of 2.1 in the CBRA book, running cobradeps -g component_diagram . succeeded (in that no errors were shown) but the resulting graph was empty. I decided to re-run with the text option to determine if this was a problem with graphviz, but this produced the following (also, an empty dependency list):

➜ sportsball git:(master): cobradeps -t component_diagram . APP

DEPENDENCIES

ALL PARTS

After visiting this repo and combing through the README, I decided to modify my Gemfile to see if changing the way this dependency is specified would produce different results.

If I modify my Gemfile so that I specify the component dependency this way: gem 'app_component', path: 'components/app_component', group: :direct cobradeps succeeds in producing a graph (and the text output works as well).

This works independently of me adding Bundler.require(:direct, *Rails.groups) to my application.rb (I opted to remove this since this seemed to be the case).

If I modify my Gemfile so that I specify the component dependency this way: gem 'app_component', path: 'components/app_component', group: [:default, :direct] cobradeps silently fails (as outlined initially).

I'm currently seeing this issue on Bundler version 2.0.2 (cobradeps -v produces no version information)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

daveshah commented 4 years ago

Here's the Gemfile in it's entirety (with the component statement @ the very bottom):

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'app_component', path: 'components/app_component', group: [:default, :direct]
shageman commented 4 years ago

Ah, ok... So Rails 6 adds the :default group to plugins it generates. I hadn't run into this before. I will put it on my list to take a look at this, but would be happy to accept a pull request if you see a solution.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Saturday, February 15, 2020 4:13 AM, Dave Shah notifications@github.com wrote:

Here's the Gemfile in it's entirety (with the component statement @ the very bottom):

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

gem 'rails', '~> 6.0.2', '>= 6.0.2.1'

Use sqlite3 as the database for Active Record

gem 'sqlite3', '~> 1.4'

Use Puma as the app server

gem 'puma', '~> 4.1'

Use SCSS for stylesheets

gem 'sass-rails', '>= 6'

Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker

gem 'webpacker', '~> 4.0'

Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks

gem 'turbolinks', '~> 5'

Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

gem 'jbuilder', '~> 2.7'

Use Redis adapter to run Action Cable in production

gem 'redis', '~> 4.0'

Use Active Model has_secure_password

gem 'bcrypt', '~> 3.1.7'

Use Active Storage variant

gem 'image_processing', '~> 1.2'

Reduces boot times through caching; required in config/boot.rb

gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do

Call 'byebug' anywhere in the code to stop execution and get a debugger console

gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end

group :development do

Access an interactive console on exception pages or by calling 'console' anywhere in the code.

gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2'

Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring

gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end

group :test do

Adds support for Capybara system testing and selenium driver

gem 'capybara', '>= 2.15' gem 'selenium-webdriver'

Easy installation and use of web drivers to run system tests with browsers

gem 'webdrivers' end

Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'app_component', path: 'components/app_component', group: [:default, :direct]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

daveshah commented 4 years ago

but would be happy to accept a pull request if you see a solution.

Glad to hear! I ended up forking this earlier today to see where the problem was. I started down the path of a small refactor to get a unit test around this. (Then the kiddos woke up so I probably won't get back to this until later this evening 🤣 )

I'll post what I have a bit later on 👍

drwl commented 4 years ago

@daveshah I'm running into this as well. Any chance you're able to post what you've got so far?