Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

please pull: "make more newbie friendly: 'jekyll new blog' creates blog scaffold" #632

Closed
wants to merge 1 commit into from

2 participants

@tpo

Thank you!

@parkr
Owner

Thank you for the suggestion! We're going to include this feature, but approach it in a different way.

@parkr parkr closed this
@tpo
@parkr
Owner

I'll try to remember to post it here once it's been added in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 0 deletions.
  1. +1 −0  History.txt
  2. +34 −0 bin/jekyll
View
1  History.txt
@@ -7,6 +7,7 @@
* Allow multiple plugin dirs to be specified (#438)
* Inline TOC token support for RDiscount (#333)
* Add the option to specify the paginated url format (#342)
+ * 'jekyll new blog' will generate a scaffold for a new site (#631)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
View
34 bin/jekyll
@@ -10,6 +10,7 @@ Basic Command Line Usage:
jekyll <path to write generated site> # . -> <path>
jekyll <path to source> <path to write generated site> # <path> -> <path>
jekyll import <importer name> <options> # imports posts using named import script
+ jekyll new blog # creates directory 'blog' containing the jekyll site structure
Configuration is read from '<source>/_config.yml' but can be overriden
using the following options:
@@ -200,6 +201,39 @@ if ARGV.size > 0
end
exit(0)
+
+ elsif ARGV[0] == 'new'
+ if ARGV[1].to_s == ""
+ puts "You need to add the name of the directory to be created"
+ exit(1)
+ end
+
+ blog = ARGV[1]
+ FileUtils.mkdir blog
+ Dir.chdir(blog) do
+ FileUtils.mkdir '_includes'
+ FileUtils.mkdir '_layouts'
+ FileUtils.mkdir '_posts'
+ FileUtils.mkdir '_site'
+
+ File.open('_layouts/default.html', 'w') do |f|
+ f.puts "<html>\n<body>\n{{ content }}\n</body>\n</html>"
+ end
+
+ File.open('_posts/2012-08-28-hello-world.markdown', 'w') do |f|
+ f.puts "---\nlayout: default\n---\n* hello world\n"
+ end
+
+ File.open('index.markdown', 'w') do |f|
+ f.puts "---\nlayout: default\n---\n[first post](2012/08/28/hello-world.html)\n"
+ end
+ end
+
+ puts "Generated basic structure in #{blog}"
+ puts "Please do 'cd #{blog} && jekyll --server'"
+ puts "You then should be able to reach your site at http://localhost:4000"
+
+ exit(0)
end
end
Something went wrong with that request. Please try again.