-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Write Jekyll::Utils::Exec.run for running shell commands. #5640
Conversation
fdf8c82
to
6f6ed7a
Compare
6f6ed7a
to
4012abd
Compare
@@ -106,21 +105,16 @@ def run_jekyll(args) | |||
|
|||
# rubocop:disable Metrics/AbcSize |
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.
can we remove the disabling of this check for this method now that it's been refactored?
system("bundle", "install", "--quiet") | ||
else | ||
system("bundle", "install") | ||
_, output = Jekyll::Utils::Exec.run("bundle", "install", "--quiet") |
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.
why do we not care about the return value here?
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.
More importantly, why do you care about the output and not the status when you tell bundler to shut up while it's doing work?
4012abd
to
6e2449b
Compare
Updated. |
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.
Thank you for undertaking this @parkr ❤️.
Just a couple of queries..
unless options["blank"] || options["skip-bundle"] | ||
bundle_install path | ||
end | ||
|
||
Jekyll.logger.info "New jekyll site installed in #{path.cyan}." | ||
Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"] | ||
end |
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.
out of curiosity, why was this moved to further ahead?
It was initially:
install directory > display success message > initiate 'bundle install'
now its:
install directory > initiate 'bundle install' > display install success message
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 change here would warrant a change to the test file here
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.
Doesn't it seem like we should actually install Jekyll before we claim that Jekyll was installed?
We could add an additional message before bundle_install
that the directory was setup, but is it worth it?
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.
Doesn't it seem like we should actually install Jekyll before we claim that Jekyll was installed?
One wouldn't be able to run jekyll new
if Jekyll wasn't installed already. 😁
(I get it that was not your point.. 😀 )
By the time install-success message
is displayed, the new project site would have already been created at the path specified.
The user is then informed of the initiation of the automated bundle install
.. (which runs in context to the newly generated Gemfile
)
But like I mentioned in the previous comment, if Parker decides to stick with his vision, he'll have to edit the test file accordingly as well.
system("bundle", "install") | ||
process, output = Jekyll::Utils::Exec.run("bundle", "install") | ||
output.to_s.each_line do |line| | ||
Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty? |
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 always 👍 for a little color out there.. but is Bundler:
really necessary? (Though it doesn't hurt to be extra descriptive..)
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.
but is
Bundler:
really necessary?
Yes. Nice to know where the output is coming from.
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.
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 like how it is in Before
.. In After
, I need to consciously ignore the Bundler:
.. but thats just my nit.....
end | ||
|
||
p.value | ||
p | ||
end | ||
# rubocop:enable Metrics/AbcSize |
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.
Since we removed rubocop:disable
, we could probably remove rubocop:enable
as well
Updated the tests, as prescribed by @ashmaroli 👍 |
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.
👍 Works fine. Just a UX feedback.
system("bundle", "install") | ||
process, output = Jekyll::Utils::Exec.run("bundle", "install") | ||
output.to_s.each_line do |line| | ||
Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty? |
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.
@jekyllbot: merge +minor |
This fixes #5463 by taking @envygeeks's
run_in_shell
command and port it directly into the Jekyll codebase.Any commands Jekyll has to run should be run with this method.
/cc @jekyll/core @ashmaroli