Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for adding just the gems in a particular bundle group#127

Open
robertgates55 wants to merge 7 commits intobazelruby:master from
robertgates55:support_bundle_groups
Open

Add support for adding just the gems in a particular bundle group #127
robertgates55 wants to merge 7 commits intobazelruby:master from
robertgates55:support_bundle_groups

Conversation

@robertgates55
Copy link

@robertgates55 robertgates55 commented Apr 1, 2022

Interested in feedback for this. I'm trying to take the downloaded/installed gems and use them within a container image; and we make pretty extensive use of bundle groups.

Copy link
Contributor

kigster commented Apr 4, 2022
edited
Loading

I understand about bundle groups, And I can see how that might be a useful feature.

What I don't understand is your comment about using pre-installed gems in your doctor container.

As you well know many ruby gems require native extensions to be built in C. Those extensions are heavily operating system dependent. If you build a local gem on OS X you cannot copy the result straight into a docker container and expect them to work, unless the gem is pure ruby, OR you are on the same linux variant as the docker container itself. In any other situation you would still need to run bundle install to compile native extensions.

Finally there an error on CI:

registering gem parser with binaries: ["bin/ruby-parse", "bin/ruby-rewrite"]
registering gem rspec-core with binaries: ["bin/rspec"]
registering gem rubocop with binaries: ["bin/rubocop"]
create_bundle_build_file.rb:245:in `prepend': can't modify frozen String: "awesome_print" (FrozenError) 

Copy link
Contributor

@kigster kigster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing, and needs to be fixed.

.gsub('{exclude}', DEFAULT_EXCLUDES.to_s)

gems_by_group.each do |key, value|
template_out.puts GEM_GROUP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to do GEM_GROUP.dup to bypass the frozen constant error. The way it's written right now, the code is attempting to modify the frozen constant.

bundle_deps = Bundler::Definition.build(gemfile_lock.chomp('.lock'), gemfile_lock, {}).dependencies
groups = bundle_deps.map{|dep| dep.groups}.flatten.uniq
gems_by_group = groups.map{ |g| {g => bundle_deps
.select{|dep| dep.groups.include?(g)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please annotate with comments each line here and explain what it's doing.

.reject{|dep| dep.source.path? unless dep.source.nil?}
.map(&:name)}
}
.reduce Hash.new, :merge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kigster kigster kigster requested changes

@yugui yugui Awaiting requested review from yugui yugui is a code owner

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Comments

AltStyle によって変換されたページ (->オリジナル) /