You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
709B

  1. #!/usr/bin/env ruby
  2. require 'cross-post'
  3. require 'twitter'
  4. require 'oauth'
  5. require 'launchy'
  6. require 'awesome_print'
  7. config = CrossPost::Config.new
  8. consumer_key = config['twitter.consumer.key']
  9. consumer_secret = config['twitter.consumer.secret']
  10. client = OAuth::Consumer.new consumer_key,
  11. consumer_secret,
  12. site: Twitter::REST::Client::BASE_URL
  13. request_token = client.get_request_token
  14. url = request_token.authorize_url
  15. puts url
  16. Launchy.open url
  17. print 'PIN ? '
  18. pin = gets.chomp
  19. access_token = request_token.get_access_token oauth_verifier: pin
  20. config['twitter.access.token'] = access_token.token
  21. config['twitter.access.secret'] = access_token.secret
  22. config.save