Colorize interpolated output in logger.info #5239

Merged
merged 1 commit into from Aug 16, 2016

Projects

None yet

4 participants

@ashmaroli
Contributor
ashmaroli commented Aug 12, 2016 edited

Colorize interpolated output in Jekyll.logger.info as a way of highlighting relevant text.

blog_path

theme_name n path


Documentation:

This does not color every interpolated string automatically.
To colorize, simply add the colorator method (use cyan for homogeneity) within the expression.

"#{variable}" -> "#{variable.cyan}"

# if an expression doesn't result in a string, convert to one and then colorize.
"#{variable.method}" -> "#{variable.method.to_s.cyan}"
@envygeeks
Member

Please interpolate instead of doing "+", that's why we enforce double quotes.

@envygeeks
Member

LGTM. I like it. This does improve readability.

@envygeeks
Member
@mattr-
Member
mattr- commented Aug 16, 2016

LGTM.

@ashmaroli
Contributor

squashing commits..

@mattr- mattr- and 1 other commented on an outdated diff Aug 16, 2016
lib/jekyll/commands/new_theme.rb
@@ -22,14 +22,20 @@ def process(args, opts)
end
new_theme_name = args.join("_")
- theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
+ @theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
+
+ update_logger
+ end
+
+ def update_logger
@mattr-
mattr- Aug 16, 2016 Member

I didn't notice this before, but the addition of the update_logger method complicates this command quite a bit. I think we're better off without the extra method. Please make that change, and I'll reapprove.

@ashmaroli
ashmaroli Aug 16, 2016 Contributor

I agree, it was added to satisfy rubocop with an earlier commit. I forgot to remove it when I reverted back to using interpolation within the strings.

@ashmaroli
Contributor

Looks like Rubocop doesnt want to keep it simple. 😦

@mattr-
Member
mattr- commented Aug 16, 2016

I recommend wrapping that method to disable that Rubocop check for now:

# rubocop:disable Metrics/AbcSize
def method
...
end
# rubocop:enable Metrics/AbcSize
@envygeeks
Member

You'll need to squash before we can approve @ashmaroli, looks like Jekyllbot resets your approvals once you commit again, that's pretty clever and great programming by @parkr.

@ashmaroli ashmaroli colorize interpolated text in Jekyll.logger.info
a9f9227
@ashmaroli
Contributor

Squashed..
I like Jekyllbot resetting approvals. It makes sense too, as the new commit may have brought in changes not acceptable to the maintainers.
+1 to Parker for that.

@mattr-
Member
mattr- commented Aug 16, 2016

LGTM. Thanks for making the updates! 🤘

@ashmaroli
Contributor

You're welcome 😃 🤘

@ashmaroli
Contributor

There's that travis bug again.. Restart required..

@mattr-
Member
mattr- commented Aug 16, 2016 edited

LGTM. 👍 :shipit:

@envygeeks
Member

LGTM. @jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit b82b93c into jekyll:master Aug 16, 2016

1 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
jekyll/lgtm Approved by @mattr-. Requires 1 more LGTM.
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ashmaroli ashmaroli deleted the ashmaroli:colorize-embed branch Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment