Skip to content

Instantly share code, notes, and snippets.

@mmmpa
Created May 8, 2014 05:51
Show Gist options
  • Save mmmpa/ae85a9d8c8a74248cd87 to your computer and use it in GitHub Desktop.
Save mmmpa/ae85a9d8c8a74248cd87 to your computer and use it in GitHub Desktop.
namespace :twitter do
task :tweet, ['message'] do |t, args|
require 'twitter'
YOUR_CONSUMER_KEY = ''
YOUR_CONSUMER_SECRET = ''
YOUR_OAUTH_TOKEN = ''
YOUR_OAUTH_TOKEN_SECRET = ''
client = Twitter::REST::Client.new do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
client.update(args.message)
end
task :tweet_test do
Rake::Task['twitter:tweet'].invoke('from rake')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment