Allow RUBY_TARGET to be inherited from sudo#513
Conversation
|
For some reason, I'm seeing this when I test this locally: |
|
I guess that problem happens even on the tagged versions, so I might be doing something wrong. UPDATE: Figured it out; I need to run this from the |
|
Oh, I see:
|
7d0b23f to
60c59f5
Compare
60c59f5 to
c7b6f47
Compare
gem/exe/rb-sys-dock
Outdated
| if OPTIONS[:build] | ||
| with_bundle = +"test -f Gemfile && bundle install && #{input_cmd} && bundle exec rake native:$RUBY_TARGET gem" | ||
| without_bundle = "#{input_cmd} && rake native:$RUBY_TARGET gem" | ||
| with_bundle = +"test -f Gemfile && bundle install && #{input_cmd} && bundle exec rake native:#{ruby_target} gem RUBY_TARGET=#{ruby_target}" |
There was a problem hiding this comment.
I'm not quite sure why adding the environment variable at the end works, but why adding it via export RUBY_TARGET=#{ruby_target} && before this line does not.
There was a problem hiding this comment.
This NAME=VALUE feature is a well-documented rake feature:
- https://github.com/ruby/rake/blob/09a1cd41d13d0c2c23a0775f860a8c5e71d43911/doc/command_line_usage.rdoc#label-Rake+Command+Line+Usage
- https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Tasks+with+Arguments
In another Rake task, I confirmed NAME=VALUE bundle exec rake doesn't work.
|
We
We may need to add it to sudoers.d? |
|
We should probably make it include the defaults from rake-compiler-dock too... |
|
Yeah, I solved it by directly inserting |
The one downside is that things wont work properly without |
|
Ah, interesting. Let me try this out. |
Previously RUBY_TARGET was never passed along because `sudo -u` was run. Add this variable to the sudoers file to preserve this varaible.
c7b6f47 to
092b887
Compare
|
Thanks for that tip. I think this works. |
|
@ianks Thanks for your help! Could you tag a new release so I can try upgrading a gem again? |
Previously RUBY_TARGET was never passed along because
sudo -uwas run. Add this variable to the sudoers file to preserve this varaible.