-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack. For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide |
Hi |
This needs a test to make sure the feature is behaving as expected and to make sure it will continue to work when new changes are made. |
@colby-swandale I'll start working on the test. Will update the pr asap. 😉 |
spec/commands/exec_spec.rb
Outdated
|
||
bundle "exec --gemfile CustomGemfile test" | ||
|
||
expect(ENV["BUNDLE_GEMFILE"]).to eq("CustomGemfile") |
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 dont think this will test what you want it to, because the bundle
helper actually runs bundler in a subprocess
@segiddins Thankyou so much for your comment 😄 I understood what I was doing wrong. I've updated the test now. |
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 is pretty much ready to merge
lib/bundler/cli/exec.rb
Outdated
@@ -23,6 +23,10 @@ def initialize(options, args) | |||
def run | |||
validate_cmd! | |||
SharedHelpers.set_bundle_environment | |||
|
|||
# setting the gemfile if mentioned |
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 comment doesn't seem all that useful, the code already explains this
Great! Thank you! 🎉 @bundlerbot r+ |
📌 Commit 546d0a5 has been approved by |
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided
💔 Test failed - status-travis |
@colby-swandale I don't understand why the jobs corresponding to the failing tests were canceled. What needs to be done? 🤔 |
@@ -6,6 +6,22 @@ | |||
system_gems(system_gems_to_install, :path => :bundle_path) | |||
end | |||
|
|||
it "works with --gemfile flag" do | |||
create_file "CustomGemfile", <<-G |
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.
Thinking more about this test, do you need 2 different Gemfiles?
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 did that to ensure that the environment variable was set correctly both the times and rackup
produced the version corresponding to the mentioned gemfiles.
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.
You're already testing bundle exec
with the --gemfile
option. So testing it again is redundant, can you please remove it.
lib/bundler/shared_helpers.rb
Outdated
@@ -230,6 +230,11 @@ def write_to_gemfile(gemfile_path, contents) | |||
filesystem_access(gemfile_path) {|g| File.open(g, "w") {|file| file.puts contents } } | |||
end | |||
|
|||
def custom_gemfile(gemfile) |
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 a bit confused about this method's name, it's setting an ENV var for the given Gemfile if it exists, so i'm not sure what custom_gemfile
means here. This logic also seems pretty particular to bundle exec
, does this need to be a method in SharedHelpers?
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.
It was mentioned in the issue that the flag could be extended to other commands as well for consistency. So I made a shared helper which could be used later.
I used "custom" in the sense that it was mentioned by the user. if it is not mentioned then the default gemfiles will be used.
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.
@colby-swandale does this explanation make sense? is there a requirement to change the name of the function? 🤔
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.
You should be able to use the custom Gemfile logic in the CLI
Looking at the code in CLI There seemed to be no need of the shared helper. I removed it. Also removed the redundant test. Thankyou for the help @colby-swandale 😄 |
e32dc4a
to
94b7104
Compare
Thanks! @bundlerbot r+ |
📌 Commit 94b7104 has been approved by |
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided
@bundlerbot retry |
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided
☀️ Test successful - status-travis |
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided (cherry picked from commit c489248)
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided (cherry picked from commit c489248)
Add gemfile flag to exec command ### What was the end-user problem that led to this PR? This PR resolves the issue #5924 ### What was your diagnosis of the problem? - added a `gemfile` flag in `cli.rb` - if `options[:gemfile]` is set I created a SharedHelper method `custom_gemfile` which used the predefined `find_file` function to find and set the environment variable with the argument provided (cherry picked from commit c489248)
What was the end-user problem that led to this PR?
This PR resolves the issue #5924
What was your diagnosis of the problem?
gemfile
flag incli.rb
options[:gemfile]
is set I created a SharedHelper methodcustom_gemfile
which used the predefinedfind_file
function to find and set the environment variable with the argument provided