-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
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
@@ -310,8 +314,8 @@ def default_command_to_run(input_args) | |||
input_cmd = input_args.empty? ? "true" : input_args.join(" ") | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 -u
was run. Add this variable to the sudoers file to preserve this varaible.