Skip to content

Instantly share code, notes, and snippets.

@omps
Created April 24, 2016 10:06
Show Gist options
  • Save omps/b953fbfb61431c1f938a5dd47e63d506 to your computer and use it in GitHub Desktop.
Save omps/b953fbfb61431c1f938a5dd47e63d506 to your computer and use it in GitHub Desktop.
rake deploy task
desc "Default deploy task"
task :deploy do
# Check if preview posts exist, which should not be published
if File.exists?(".preview-mode")
puts "## Found posts in preview mode, regenerating files ..."
File.delete(".preview-mode")
Rake::Task[:generate].execute
end
Rake::Task[:copydot].invoke(source_dir, public_dir)
Rake::Task["#{deploy_default}"].execute
# Tweet
next if not File.exists? 'tweet_queue'
puts "Tweeting..."
open('tweet_queue', 'r') do |file|
while (line = file.gets)
puts "Tweeting '#{line.gsub("\n", "")}' for @#{client.current_user.screen_name}..."
client.update(line)
end
end
puts "Deleting queue..."
rm 'tweet_queue'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment