colorize interpolated text in Jekyll.logger.info

This commit is contained in:
Ashwin Maroli 2016-08-12 23:02:17 +05:30
parent 9f8876a332
commit a9f92278d3
3 changed files with 6 additions and 4 deletions

View File

@ -34,7 +34,7 @@ module Jekyll
create_site new_blog_path create_site new_blog_path
end end
Jekyll.logger.info "New jekyll site installed in #{new_blog_path}." Jekyll.logger.info "New jekyll site installed in #{new_blog_path.cyan}."
end end
def create_blank_site(path) def create_blank_site(path)

View File

@ -16,6 +16,7 @@ class Jekyll::Commands::NewTheme < Jekyll::Command
end end
end end
# rubocop:disable Metrics/AbcSize
def process(args, opts) def process(args, opts)
if !args || args.empty? if !args || args.empty?
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name." raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
@ -28,9 +29,10 @@ class Jekyll::Commands::NewTheme < Jekyll::Command
end end
theme.create! theme.create!
Jekyll.logger.info "Your new Jekyll theme, #{theme.name}," \ Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
" is ready for you in #{theme.path}!" " is ready for you in #{theme.path.to_s.cyan}!"
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md." Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
end end
# rubocop:enable Metrics/AbcSize
end end
end end

View File

@ -41,7 +41,7 @@ class TestNewCommand < JekyllUnitTest
should "display a success message" do should "display a success message" do
Jekyll::Commands::New.process(@args) Jekyll::Commands::New.process(@args)
output = Jekyll.logger.messages.last output = Jekyll.logger.messages.last
success_message = "New jekyll site installed in #{@full_path}." success_message = "New jekyll site installed in #{@full_path.cyan}."
assert_includes output, success_message assert_includes output, success_message
end end