aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
committerLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
commit2fe9da91f5a4b5ba3edaee47ee24dbce523e739e (patch)
treecca3792ae030b550015633b4b855451fa8455bc3 /Rakefile
parente1020ed888439a480cb13af2585f9fea5283c609 (diff)
parent4790b939807be4d9abcc567f02773ff24b99320d (diff)
downloadmy_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.tar.xz
my_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.zip
Merge branch 'master' of github.com:imathis/octopress
Conflicts: plugins/category_generator.rb
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile22
1 files changed, 14 insertions, 8 deletions
diff --git a/Rakefile b/Rakefile
index d4dcb549..471b2277 100644
--- a/Rakefile
+++ b/Rakefile
@@ -7,7 +7,8 @@ require "stringex"
ssh_user = "user@domain.com"
ssh_port = "22"
document_root = "~/website.com/"
-rsync_delete = true
+rsync_delete = false
+rsync_args = "" # Any extra arguments to pass to rsync
deploy_default = "rsync"
# This will be configured for you when you run config_deploy
@@ -91,10 +92,13 @@ end
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
desc "Begin a new post in #{source_dir}/#{posts_dir}"
task :new_post, :title do |t, args|
+ if args.title
+ title = args.title
+ else
+ title = get_stdin("Enter a title for your post: ")
+ end
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
mkdir_p "#{source_dir}/#{posts_dir}"
- args.with_defaults(:title => 'new-post')
- title = args.title
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
@@ -151,7 +155,7 @@ task :new_page, :filename do |t, args|
end
# usage rake isolate[my-post]
-desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker."
+desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
task :isolate, :filename do |t, args|
stash_dir = "#{source_dir}/#{stash_dir}"
FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
@@ -237,7 +241,7 @@ task :rsync do
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
end
puts "## Deploying website via Rsync"
- ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
+ ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{rsync_args} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
end
desc "deploy public directory to github pages"
@@ -299,12 +303,14 @@ task :setup_github_pages, :repo do |t, args|
if args.repo
repo_url = args.repo
else
- repo_url = get_stdin("Enter the read/write url for your repository: ")
+ puts "Enter the read/write url for your repository"
+ puts "(For example, 'git@github.com:your_username/your_username.github.com)"
+ repo_url = get_stdin("Repository url: ")
end
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?
+ unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?
# If octopress is still the origin remote (from cloning) rename it to octopress
system "git remote rename origin octopress"
if branch == 'master'