twitter-ruby: uninitialized constant Twitter::REST

Assuming this got fixed in #479 and reared its head due to some other issue now.

I literally only installed ruby 2.4, then did gem install t, and this is what happened.

Traceback:

/var/lib/gems/2.4.0/gems/t-3.1.0/lib/t/cli.rb:82:in `authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError)
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /var/lib/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from /var/lib/gems/2.4.0/gems/t-3.1.0/bin/t:20:in `<top (required)>'
	from /usr/local/bin/t:23:in `load'
	from /usr/local/bin/t:23:in `<main>'

gem list says:

*** LOCAL GEMS ***

addressable (2.5.2)
bigdecimal (1.3.2, default: 1.3.0)
buftok (0.2.0)
domain_name (0.5.20170404)
equalizer (0.0.11)
geokit (1.11.0)
htmlentities (4.3.4)
http (3.0.0)
http-cookie (1.0.3)
http-form_data (2.0.0)
http_parser.rb (0.6.0)
io-console (default: 0.4.6)
json (2.1.0, default: 2.0.4)
launchy (2.4.3)
memoizable (0.4.2)
multipart-post (2.0.0)
naught (1.1.0)
oauth (0.5.3)
openssl (2.0.6, default: 2.0.5)
psych (2.2.4, default: 2.2.2)
public_suffix (3.0.1)
rdoc (5.1.0, default: 5.0.0)
retryable (2.0.4)
simple_oauth (0.3.1)
t (3.1.0)
thor (0.20.0)
thread_safe (0.3.6)
twitter (6.2.0)
unf (0.1.4)
unf_ext (0.0.7.4)

Not sure how to progress. Workarounds?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 8
  • Comments: 37 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Here’s your workaround folks: edit /Library/Ruby/Gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb, or maybe /Library/Ruby/Gems/*/gems/t-*/lib/t/cli.rb if you don’t have that file. Replace the two instances of Twitter::REST::Client::BASE_URL with Twitter::REST::Request::BASE_URL and you’re good to go.

@jasonhemann

  1. Go to https://apps.twitter.com/
  2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions
  3. Locally run gem install twurl
  4. Run twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}
  5. Follow the steps it requests that you do
  6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

OK guys i know you’re impatient but this nagging absolutely has to stop. I get retarded “bump” notifications every day. This isn’t goddamn twitter. Go live out your ADHD over there. The guy obviously hasn’t been on github since november - look at his activity - so what are you trying to achieve with this? He’s busy with his real life (yeah, some people have one) and is going to get around to it… WHEN HE GETS AROUND TO IT. Stop nagging or I’ll close the bug report!

I’m working on a fix for this issue now. Sorry for the trouble.

Also not the prettiest solution: I copy the .twurlrc (from Twurl https://github.com/twitter/twurl) to .trc then run t as usual.

cheers

Let’s be nice here. This is a 12-year old open-source project. It is not unreasonable that the original maintainer might not jump in and fix bugs after all that time.

Anyone with Ruby skills and sufficient interest could contribute a fix. (I myself actually spent a little while freshening my rusty Ruby skills to see if I could fix this issue, but I just have not had time to devote to it.)

166 people have contributed to this repo over the years, so I suspect there are multiple people out there who would be able and willing to fix this.

Here’s your workaround folks: edit /Library/Ruby/Gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb, or maybe /Library/Ruby/Gems/*/gems/t-*/lib/t/cli.rb if you don’t have that file. Replace the two instances of Twitter::REST::Client::BASE_URL with Twitter::REST::Request::BASE_URL and you’re good to go.

This worked for me too! I was almost giving up.

expanding on @rvagg: ubuntu 17.10, file was located at /var/lib/gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb

@sferik would love some help getting this fixed so i can use t again!

Holy shit happy new year. Also having this issue. When is a fork coming to Rubygem that will be maintained, jesus.

For those just running into this issue (like myself), this solution worked for me.

The path to my cli.rb file was listed in the error message output after I entered my API keys (my path was different from the paths listed above).

Once I edited both instances of Twitter::REST::Request::BASE_URL, the installation completed.

Thanks @sferik, looking forward to being able to use the CLI client 👍

Yeah, I guess if moving the constant out to a different location was a deliberate move, then this should be flagged as a breaking change, thus a major release should’ve been released. Got here from getting the same error when running a fresh install of https://github.com/sferik/t (gem install t).

I’d suggest unpublishing v6.2.0 (gem yank?) and republishing it as v7.0.0.

@jasonhemann

1. Go to https://apps.twitter.com/

2. Ensure your app (whether newly created or otherwise) has Read, Write and Access direct messages permissions

3. Locally run `gem install twurl`

4. Run `twurl authorize --consumer-key {YOUR APP'S CONSUMER KEY} --consumer-secret {YOUR APP'S CONSUMER SECRET}`

5. Follow the steps it requests that you do

6. Copy ~/.twurlr to ~/.trc

Essentially what @ialexs seems to mean is, copy the file generated by twurl

It’s works for me too. You missing c on the last command (should be cp ~/.twurlrc ~/.trc). Thank you.

@BlueHatbRit , thank you!

waiting here as well…thanks!

Also waiting. Thanks for working on this! 👍

Also waiting 😃 Thanks!

Patiently waiting for this fix as well. Thanks for working on it! 👍

Thank you for working on this, waiting on it 😄