diff options
author | Brandon Mathis <brandon@imathis.com> | 2011-09-04 08:37:22 -0500 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2011-09-04 08:37:22 -0500 |
commit | ed0c220523f81a9f29009f8bbb75ff50052465d4 (patch) | |
tree | ed925f206fc9d72fe806856a07525ec0118a3972 /Rakefile | |
parent | 3cedd387a0fd4522023ef335307cbc096a3c2005 (diff) | |
parent | f03c4cdb2abe524e097fdfc67194e8d9fc0d19ab (diff) | |
download | my_new_personal_website-ed0c220523f81a9f29009f8bbb75ff50052465d4.tar.xz my_new_personal_website-ed0c220523f81a9f29009f8bbb75ff50052465d4.zip |
Merge branch 'master' of https://github.com/fhemberger/octopress into fhemberger-master
Conflicts:
plugins/category_generator.rb
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -27,6 +27,9 @@ 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]" task :install, :theme do |t, args| + if File.directory?(source_dir) || File.directory?("sass") + abort("rake aborted!") if ask("A theme is already installed, proceeding will overwrite existing files. Are you sure?", ['y', 'n']) == 'n' + end # copy theme into working Jekyll directories theme = args.theme || 'classic' puts "## Copying "+theme+" theme into ./#{source_dir} and ./sass" @@ -301,6 +304,20 @@ def ok_failed(condition) end end +def get_stdin(message) + print message + STDIN.gets.chomp +end + +def ask(message, valid_options) + if valid_options + answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer) + else + answer = get_stdin(message) + end + answer +end + desc "list tasks" task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" |