diff --git a/docs/_docs/usage.md b/docs/_docs/usage.md index 9bd8da8f..76d2bd96 100644 --- a/docs/_docs/usage.md +++ b/docs/_docs/usage.md @@ -7,7 +7,8 @@ The Jekyll gem makes a `jekyll` executable available to you in your terminal. You can use this command in a number of ways: -* `jekyll new` - Creates a new Jekyll site scaffold +* `jekyll new` - Creates a new Jekyll site with default gem-based theme +* `jekyll new --blank` - Creates a new blank Jekyll site scaffold * `jekyll build` or `jekyll b` - Performs a one off build your site to `./_site` (by default) * `jekyll serve` or `jekyll s` - Builds your site any time a source file changes and serves it locally * `jekyll doctor` - Outputs any deprecation or configuration issues diff --git a/features/create_sites.feature b/features/create_sites.feature index c1f75931..fd63ff60 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -6,9 +6,18 @@ Feature: Create sites Scenario: Blank site Given I do not have a "test_blank" directory When I run jekyll new test_blank --blank - Then the test_blank/_layouts directory should exist + Then the test_blank/_data directory should exist + And the test_blank/_drafts directory should exist + And the test_blank/_includes directory should exist + And the test_blank/_layouts directory should exist And the test_blank/_posts directory should exist - And the "test_blank/index.html" file should exist + And the test_blank/_sass directory should exist + And the test_blank/assets/css directory should exist + And the "test_blank/_layouts/default.html" file should exist + And the "test_blank/_sass/main.scss" file should exist + And the "test_blank/assets/css/main.scss" file should exist + And the "test_blank/_config.yml" file should exist + And the "test_blank/index.md" file should exist Scenario: Basic site Given I have an "index.html" file that contains "Basic Site" diff --git a/lib/blank_template/_config.yml b/lib/blank_template/_config.yml new file mode 100644 index 00000000..a0cd66a2 --- /dev/null +++ b/lib/blank_template/_config.yml @@ -0,0 +1,3 @@ +url: "" # the base hostname & protocol for your site, e.g. http://example.com +baseurl: "" # the subpath of your site, e.g. /blog +title: "" # the name of your site, e.g. ACME Corp. diff --git a/lib/blank_template/_layouts/default.html b/lib/blank_template/_layouts/default.html new file mode 100644 index 00000000..a82592fb --- /dev/null +++ b/lib/blank_template/_layouts/default.html @@ -0,0 +1,12 @@ + + + + + + {{ page.title }} - {{ site.title }} + + + + {{ content}} + + diff --git a/lib/blank_template/_sass/main.scss b/lib/blank_template/_sass/main.scss new file mode 100644 index 00000000..126160d3 --- /dev/null +++ b/lib/blank_template/_sass/main.scss @@ -0,0 +1,9 @@ +$backgroundColor: #ffffff; +$bodyColor: #000000; +$bodyFont: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; + +body { + background: $backgroundColor; + color: $bodyColor; + font-family: $bodyFont; +} diff --git a/lib/blank_template/assets/css/main.scss b/lib/blank_template/assets/css/main.scss new file mode 100644 index 00000000..9f418944 --- /dev/null +++ b/lib/blank_template/assets/css/main.scss @@ -0,0 +1,4 @@ +--- +--- + +@import "main"; diff --git a/lib/blank_template/index.md b/lib/blank_template/index.md new file mode 100644 index 00000000..6aeae8ba --- /dev/null +++ b/lib/blank_template/index.md @@ -0,0 +1,8 @@ +--- +layout: default +title: "Happy Jekyllin'!" +--- + +## You're ready to go! + +Start developping your Jekyll website. diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index dc5d7284..df98590c 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -41,10 +41,16 @@ module Jekyll after_install(new_blog_path, options) end + def blank_template + File.expand_path("../../blank_template", __dir__) + end + def create_blank_site(path) + FileUtils.cp_r blank_template + "/.", path + FileUtils.chmod_R "u+w", path + Dir.chdir(path) do - FileUtils.mkdir(%w(_layouts _posts _drafts)) - FileUtils.touch("index.html") + FileUtils.mkdir(%w(_data _drafts _includes _posts)) end end diff --git a/test/test_new_command.rb b/test/test_new_command.rb index 6bb6ed3c..7419ec6e 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -14,6 +14,10 @@ class TestNewCommand < JekyllUnitTest File.expand_path("../lib/site_template", __dir__) end + def blank_template + File.expand_path("../lib/blank_template", __dir__) + end + context "when args contains a path" do setup do @path = "new-site" @@ -86,7 +90,8 @@ class TestNewCommand < JekyllUnitTest end should "create blank project" do - blank_contents = %w(/_drafts /_layouts /_posts /index.html) + 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)