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

Write Jekyll::Utils::Exec.run for running shell commands. #5640

Merged
merged 6 commits into from
Jan 18, 2017

Conversation

parkr
Copy link
Member

@parkr parkr commented Dec 7, 2016

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

@@ -106,21 +105,16 @@ def run_jekyll(args)

# rubocop:disable Metrics/AbcSize
Copy link
Member

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")
Copy link
Member

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?

Copy link
Contributor

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?

@parkr
Copy link
Member Author

parkr commented Dec 8, 2016

Updated.

Copy link
Member

@ashmaroli ashmaroli left a 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
Copy link
Member

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Member

@ashmaroli ashmaroli Dec 23, 2016

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?
Copy link
Member

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..)

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not we colorize the output rather than Bundler:?

jekyll-new-output

Copy link
Member

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
Copy link
Member

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

@pathawks
Copy link
Member

pathawks commented Jan 6, 2017

Updated the tests, as prescribed by @ashmaroli 👍

Copy link
Member

@DirtyF DirtyF left a 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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not we colorize the output rather than Bundler:?

jekyll-new-output

@parkr
Copy link
Member Author

parkr commented Jan 18, 2017

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit 477b2f0 into master Jan 18, 2017
@jekyllbot jekyllbot deleted the jekyll-utils-exec branch January 18, 2017 19:15
jekyllbot added a commit that referenced this pull request Jan 18, 2017
@jekyll jekyll locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rake spec (script/test) outputs bundle commands
7 participants