aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile13
1 files changed, 6 insertions, 7 deletions
diff --git a/Rakefile b/Rakefile
index c1594c7b..54f98d17 100644
--- a/Rakefile
+++ b/Rakefile
@@ -58,6 +58,7 @@ desc "Watch the site and regenerate when it changes"
task :watch do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass."
+ system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
@@ -73,6 +74,7 @@ desc "preview the site in a web browser"
task :preview do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
+ system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
@@ -89,7 +91,6 @@ end
desc "Begin a new post in #{source_dir}/#{posts_dir}"
task :new_post, :title do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
- require './plugins/titlecase.rb'
mkdir_p "#{source_dir}/#{posts_dir}"
args.with_defaults(:title => 'new-post')
title = args.title
@@ -99,10 +100,9 @@ task :new_post, :title do |t, args|
end
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
- system "mkdir -p #{source_dir}/#{posts_dir}/";
post.puts "---"
post.puts "layout: post"
- post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\""
+ post.puts "title: \"#{title.gsub(/&/,'&')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
post.puts "comments: true"
post.puts "categories: "
@@ -114,7 +114,6 @@ end
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
task :new_page, :filename do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
- require './plugins/titlecase.rb'
args.with_defaults(:filename => 'new-page')
page_dir = source_dir
if args.filename =~ /(^.+\/)?([\w_-]+)(\.)?(.+)?/
@@ -131,7 +130,7 @@ task :new_page, :filename do |t, args|
open(file, 'w') do |page|
page.puts "---"
page.puts "layout: page"
- page.puts "title: \"#{$2.gsub(/[-_]/, ' ').titlecase}\""
+ page.puts "title: \"#{$2.gsub(/[-_]/, ' ')}\""
page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
page.puts "comments: true"
page.puts "sharing: true"
@@ -231,7 +230,7 @@ multitask :push do
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
Rake::Task[:copydot].invoke(public_dir, deploy_dir)
puts "\n## copying #{public_dir} to #{deploy_dir}"
- system "cp -R #{public_dir}/* #{deploy_dir}"
+ cp_r "#{public_dir}/*", deploy_dir
cd "#{deploy_dir}" do
system "git add ."
system "git add -u"
@@ -283,7 +282,7 @@ desc "Set up _deploy folder and deploy branch for Github Pages deployment"
task :setup_github_pages do
repo_url = get_stdin("Enter the read/write url for your repository: ")
user = repo_url.match(/:([^\/]+)/)[1]
- branch = (repo_url.match(/\/\w+.github.com/).nil?) ? 'gh-pages' : 'master'
+ branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master'
project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''
unless `git remote -v`.match(/origin.+?octopress.git/).nil?
# If octopress is still the origin remote (from cloning) rename it to octopress