From 7d8f1a3ad2da7d51fdf759c89ed9a20fa36b791d Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Mon, 26 Aug 2019 10:25:42 +0200
Subject: [PATCH 0/8] jekyll/commands: remove "bundle install" step for "new"
---
lib/jekyll/commands/new.rb | 30 +-----------------------------
test/test_new_command.rb | 10 ----------
2 files changed, 1 insertion(+), 39 deletions(-)
diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb
index 0a00f2634..4fdd93592 100644
--- a/lib/jekyll/commands/new.rb
+++ b/lib/jekyll/commands/new.rb
@@ -13,7 +13,6 @@ module Jekyll
c.option "force", "--force", "Force creation even if PATH already exists"
c.option "blank", "--blank", "Creates scaffolding but with empty files"
- c.option "skip-bundle", "--skip-bundle", "Skip 'bundle install'"
c.action do |args, options|
Jekyll::Commands::New.process(args, options)
@@ -131,36 +130,9 @@ module Jekyll
"_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
end
- # After a new blog has been created, print a success notification and
- # then automatically execute bundle install from within the new blog dir
- # unless the user opts to generate a blank blog or skip 'bundle install'.
-
+ # After a new blog has been created, print a success notification
def after_install(path, options = {})
- unless options["blank"] || options["skip-bundle"]
- begin
- require "bundler"
- bundle_install path
- rescue LoadError
- Jekyll.logger.info "Could not load Bundler. Bundle install skipped."
- end
- end
-
Jekyll.logger.info "New jekyll site installed in #{path.cyan}."
- Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"]
- end
-
- def bundle_install(path)
- Jekyll.logger.info "Running bundle install in #{path.cyan}..."
- Dir.chdir(path) do
- exe = Gem.bin_path("bundler", "bundle")
- process, output = Jekyll::Utils::Exec.run("ruby", exe, "install")
-
- output.to_s.each_line do |line|
- Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty?
- end
-
- raise SystemExit unless process.success?
- end
end
end
end
diff --git a/test/test_new_command.rb b/test/test_new_command.rb
index c71cf4188..79538ab03 100644
--- a/test/test_new_command.rb
+++ b/test/test_new_command.rb
@@ -47,9 +47,7 @@ class TestNewCommand < JekyllUnitTest
should "display a success message" do
output = capture_output { Jekyll::Commands::New.process(@args) }
success_message = "New jekyll site installed in #{@full_path.cyan}. "
- bundle_message = "Running bundle install in #{@full_path.cyan}... "
assert_includes output, success_message
- assert_includes output, bundle_message
end
should "copy the static files in site template to the new directory" do
@@ -93,9 +91,7 @@ class TestNewCommand < JekyllUnitTest
blank_contents = dir_contents(blank_template)
blank_contents += %w(/_data /_drafts /_includes /_posts)
output = capture_output { Jekyll::Commands::New.process(@args, "--blank") }
- bundle_message = "Running bundle install in #{@full_path.cyan}..."
assert_same_elements blank_contents, dir_contents(@full_path)
- refute_includes output, bundle_message
end
should "force created folder" do
@@ -103,12 +99,6 @@ class TestNewCommand < JekyllUnitTest
output = capture_output { Jekyll::Commands::New.process(@args, "--force") }
assert_match %r!New jekyll site installed in!, output
end
-
- should "skip bundle install when opted to" do
- output = capture_output { Jekyll::Commands::New.process(@args, "--skip-bundle") }
- bundle_message = "Bundle install skipped."
- assert_includes output, bundle_message
- end
end
context "when multiple args are given" do
--
2.39.1