From 0e072543dad52537ad2f445b5c718488c379144c Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Wed, 10 Aug 2011 18:14:56 -0400 Subject: [PATCH 1/3] added support for preserving customized source/index.html during template updates. Moved the blog index code to a partial in source/_includes/blog_index.html --- .../classic/source/_includes/blog_index.html | 40 +++++++++++++++++ .themes/classic/source/index.html | 43 +------------------ Rakefile | 5 +++ 3 files changed, 47 insertions(+), 41 deletions(-) create mode 100644 .themes/classic/source/_includes/blog_index.html diff --git a/.themes/classic/source/_includes/blog_index.html b/.themes/classic/source/_includes/blog_index.html new file mode 100644 index 0000000..c77ea7d --- /dev/null +++ b/.themes/classic/source/_includes/blog_index.html @@ -0,0 +1,40 @@ +
+{% assign index = true %} +{% for post in paginator.posts %} +{% assign content = post.content %} +
+ {% include article.html %} +
+{% endfor %} + +{% if site.disqus_short_name %} + +{% endif %} +
+ diff --git a/.themes/classic/source/index.html b/.themes/classic/source/index.html index 7f4c0e1..fa5310a 100644 --- a/.themes/classic/source/index.html +++ b/.themes/classic/source/index.html @@ -1,44 +1,5 @@ --- layout: default -footer: false --- -
-{% assign index = true %} -{% for post in paginator.posts %} -{% assign content = post.content %} -
- {% include article.html %} -
-{% endfor %} - -{% if site.disqus_short_name %} - -{% endif %} -
- + +{% include blog_index.html %} diff --git a/Rakefile b/Rakefile index 86e07b5..dd30963 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,10 @@ require "rubygems" require "bundler/setup" +# If you customize your site's index page setting custom_index to true +# will preserve your changes when running `rake update_source` +custom_index = false + ## -- Rsync Deploy config -- ## # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file ssh_user = "user@domain.com" @@ -150,6 +154,7 @@ task :update_source, :theme do |t, args| system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}" system "cp -Rn #{source_dir}.old/. #{source_dir}" system "cp -Rf #{source_dir}.old/_includes/custom/. #{source_dir}/_includes/custom/" + system "cp -Rf #{source_dir}.old/index.html #{source_dir}" if custom_index puts "## Updated #{source_dir} ##" end From a817f99785de6c37bcba851d89db3e6ad391749b Mon Sep 17 00:00:00 2001 From: marutanm Date: Thu, 11 Aug 2011 21:13:30 +0900 Subject: [PATCH 2/3] fix rake-list --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index dd30963..1e8ae14 100644 --- a/Rakefile +++ b/Rakefile @@ -256,6 +256,6 @@ end desc "list tasks" task :list do - puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}" + puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" puts "(type rake -T for more detail)\n\n" end From 313c3859aa07013815c51ae0a4af2e4fbe2ba808 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Thu, 11 Aug 2011 19:56:25 -0400 Subject: [PATCH 3/3] now using rack instead of Jekyll's webrick server, fixes #90 --- Rakefile | 3 ++- _config.yml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 86e07b5..2e3c93d 100644 --- a/Rakefile +++ b/Rakefile @@ -20,6 +20,7 @@ posts_dir = "_posts" # directory for blog files themes_dir = ".themes" # directory for blog files new_post_ext = "markdown" # default new post file extension when using the new_post task new_page_ext = "markdown" # default new page file extension when using the new_page task +server_port = "4000" # port for preview server eg. localhost:4000 desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]" @@ -52,7 +53,7 @@ end desc "preview the site in a web browser" task :preview do - system "trap 'kill $jekyllPid $compassPid' Exit; jekyll --auto --server & jekyllPid=$!; compass watch & compassPid=$!; wait" + system "trap 'kill $jekyllPid $compassPid $rackPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; rackup --port #{server_port} & rackPid=$!; wait" end # usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post") diff --git a/_config.yml b/_config.yml index 36ebe90..3d6fee8 100644 --- a/_config.yml +++ b/_config.yml @@ -20,7 +20,6 @@ email: # If publishing to a subdirectory as in http://site.com/project set 'root: /project' root: / -server_port: 4000 permalink: /blog/:year/:month/:day/:title/ source: source destination: public