Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to include a gem without the require line? #211

Closed
ghoneycutt opened this issue Mar 6, 2019 · 5 comments
Closed

Is it possible to include a gem without the require line? #211

ghoneycutt opened this issue Mar 6, 2019 · 5 comments

Comments

@ghoneycutt
Copy link
Contributor

.sync.yml

Gemfile:
  required:
    ':development':
      - gem: rake

output in Gemfile

gem "rake", require: false

output I would like to be able to generate

gem "rake"
@bmjen
Copy link
Contributor

bmjen commented Mar 6, 2019

No this is not currently possible with the current Gemfile.erb. Can you tell us more about your usecase that would require this functionality?

@bmjen bmjen added the question label Mar 6, 2019
@ghoneycutt
Copy link
Contributor Author

ghoneycutt commented Mar 20, 2019

https://travis-ci.org/ghoneycutt/puppet-module-rpcbind/jobs/508163523

rake tasks fail because the rake gem is not required.

SPEC_OPTS="--format documentation" bundle exec rake validate lint spec strings:generate reference
Traceback (most recent call last):
	4: from /home/travis/build/ghoneycutt/puppet-module-rpcbind/vendor/bundle/ruby/2.5.0/bin/ruby_executable_hooks:24:in `<main>'
	3: from /home/travis/build/ghoneycutt/puppet-module-rpcbind/vendor/bundle/ruby/2.5.0/bin/ruby_executable_hooks:24:in `eval'
	2: from /home/travis/build/ghoneycutt/puppet-module-rpcbind/vendor/bundle/ruby/2.5.0/bin/rake:23:in `<main>'
	1: from /home/travis/.rvm/gems/ruby-2.5.3/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
/home/travis/.rvm/gems/ruby-2.5.3/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
The command "SPEC_OPTS="--format documentation" bundle exec rake validate lint spec strings:generate reference" exited with 1.

@ghoneycutt
Copy link
Contributor Author

It makes less sense since the parameter is required which then enforces that the gem is included with require: false.

ghoneycutt added a commit to ghoneycutt/puppet-module-rpcbind that referenced this issue Jan 13, 2020
This is meant to work around
puppetlabs/pdk-templates#211 which does not
allow rake to be installed properly.
ghoneycutt added a commit to ghoneycutt/puppet-module-rpcbind that referenced this issue Jan 13, 2020
This is meant to work around
puppetlabs/pdk-templates#211 which does not
allow rake to be installed properly.
ghoneycutt added a commit to ghoneycutt/puppet-module-rpcbind that referenced this issue Jan 13, 2020
This is meant to work around
puppetlabs/pdk-templates#211 which does not
allow rake to be installed properly.
@DavidS
Copy link
Contributor

DavidS commented Jan 18, 2021

If you really want to change how require is handled in the Gemfile, adding another flag to

options << "require: false" if gem['from_env'].nil?
should make that a small change.

That said, the require flag in the Gemfile does only influence the behaviour of Bundler.require() (see https://bundler.io/gemfile.html and https://bundler.io/guides/groups.html) and has no influence on the error message you posted in #211 (comment)

@jordanbreen28
Copy link
Contributor

Closing this aging issue, please re-open if necessary.

@jordanbreen28 jordanbreen28 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants