This repository has been archived by the owner on Jun 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoph Petschnig
committed
Apr 28, 2013
1 parent
b3184eb
commit b9fe283
Showing
2 changed files
with
1 addition
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
namespace :twitter do | ||
desc "Fetch new tweets and translate them" | ||
task :translate => :environment do | ||
level = Rails.env == 'production' ? ::ActiveSupport::BufferedLogger::INFO : ::ActiveSupport::BufferedLogger::DEBUG | ||
logger = ::ActiveSupport::BufferedLogger.new( | ||
File.join(Rails.root, 'log', "#{Time.new.strftime('%Y-%m')}.rake.twitter.translate.#{Rails.env}.log"), level) | ||
logger.auto_flushing = true | ||
Rails.logger = logger | ||
TranslationJob.fetch_and_translate | ||
end | ||
|
||
desc "Fetch new tweets, translate them and tweet them" | ||
task :tweet_translation => :environment do | ||
level = Rails.env == 'production' ? ::ActiveSupport::BufferedLogger::INFO : ::ActiveSupport::BufferedLogger::DEBUG | ||
logger = ::ActiveSupport::BufferedLogger.new( | ||
File.join(Rails.root, 'log', "#{Time.new.strftime('%Y-%m')}.rake.twitter.tweet_translation.#{Rails.env}.log"), level) | ||
logger.auto_flushing = true | ||
Rails.logger = logger | ||
logger.info '** Starting rake twitter:tweet_translation '.ljust(80, '*') | ||
TranslationJob.fetch_translate_and_tweet | ||
logger.info '** Finished. '.ljust(80, '*') | ||
end | ||
end |