Created
April 24, 2016 10:06
-
-
Save omps/b953fbfb61431c1f938a5dd47e63d506 to your computer and use it in GitHub Desktop.
rake deploy task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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