diff options
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -1,5 +1,6 @@ require "rubygems" require "bundler/setup" +require "stringex" ## -- Rsync Deploy config -- ## # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file @@ -10,16 +11,18 @@ deploy_default = "rsync" # This will be configured for you when you run config_deploy deploy_branch = "gh-pages" -## -- Misc Configs, you probably have no reason to changes these -- ## +## -- Misc Configs -- ## -public_dir = "public" # compiled site directory -source_dir = "source" # source file directory -deploy_dir = "_deploy" # deploy directory (for Github pages deployment) -stash_dir = "_stash" # directory to stash posts for speedy generation -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 +public_dir = "public" # compiled site directory +source_dir = "source" # source file directory +blog_index_dir = 'source' # directory for your blog's index page (if you put your index in source/blog/index.html, set this to 'source/blog') +deploy_dir = "_deploy" # deploy directory (for Github pages deployment) +stash_dir = "_stash" # directory to stash posts for speedy generation +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 +55,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") @@ -61,7 +64,7 @@ task :new_post, :title do |t, args| require './plugins/titlecase.rb' args.with_defaults(:title => 'new-post') title = args.title - filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.downcase.gsub(/&/,'and').gsub(/[,'":\?!\(\)\[\]]/,'').gsub(/[\W\.]/, '-').gsub(/-+$/,'')}.#{new_post_ext}" + filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}" puts "Creating new post: #{filename}" open(filename, 'w') do |post| system "mkdir -p #{source_dir}/#{posts_dir}"; @@ -121,7 +124,7 @@ end desc "Clean out caches: _code_cache, _gist_cache, .sass-cache" task :clean do - system "rm -rf _code_cache/** _gist_cache/** .sass-cache/**" + system "rm -rf _code_cache/** _gist_cache/** .sass-cache/** source/stylesheets/screen.css" end desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom" @@ -150,6 +153,8 @@ 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 "mv -f #{source_dir}/index.html #{blog_index_dir}" if blog_index_dir != source_dir + system "cp -f #{source_dir}.old/index.html #{source_dir}" if blog_index_dir != source_dir puts "## Updated #{source_dir} ##" end @@ -251,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 |