oauth gem in ruby 1.9

61 views
Skip to first unread message

Aaron Quint

unread,
Nov 27, 2009, 6:19:18 PM11/27/09
to OAuth Ruby
Hey Everyone

I've been hacking on a fork of the oauth gem to get it to work in
1.9.

http://github.com/quirkey/oauth/tree/1.9

Right now all tests are passing on both 1.8.6, .7 and 1.9.1 (p243). I
saw that there had already been some work done to get it 1.9
compatible, but I took a slightly different approach. At the signature
level it switches between ruby 1.9's built in hmac lib and the hmac
gem. It seems to work pretty well. Corey Donohoe (atmos) also has a
fork that adds bundler support (makes it easy to isolate and test with
all the dependencies). http://github.com/atmos/oauth/tree/1.9

I would love any feedback and would love to get this pulled back into
the gem and released for the world to use.

Thanks!
--AQ

----
http://www.quirkey.com

Seth Fitzsimmons

unread,
Nov 30, 2009, 11:56:21 AM11/30/09
to oauth...@googlegroups.com
Hi Aaron.

I'm hoping to do another release in the near future (though it could
be around Christmas due to time constraints). I'll definitely plan to
pull this in.

What (if anything) did you end up doing to resolve gem dependencies?
When I looked at doing this, one of the things that was slowing me
down was that `ruby-hmac` is only available for 1.8 (as it's no longer
necessary for 1.9). If I included it as a dependency, it wouldn't
install on 1.9; if I didn't, it wouldn't work on 1.8. My temporary
workaround was to create an `oauth19` gem, but that breaks
dependencies elsewhere.

thanks.
seth
> --
>
> You received this message because you are subscribed to the Google Groups "OAuth Ruby" group.
> To post to this group, send email to oauth...@googlegroups.com.
> To unsubscribe from this group, send email to oauth-ruby+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/oauth-ruby?hl=en.
>
>
>

Aaron Quint

unread,
Nov 30, 2009, 12:20:52 PM11/30/09
to oauth...@googlegroups.com
I'm pretty sure theres a way to do check the ruby version in the
gemspec. This would involve getting rid of Hoe/Sow (which is probably
not a bad idea anyway considering I've had problems with it and 1.9
anyway. I'll look into this and let you know.
Looking forward to the release! let me know if theres any other way I can help.

--AQ

Aaron Quint
http://www.quirkey.com

Pelle Braendgaard

unread,
Nov 30, 2009, 11:24:14 PM11/30/09
to oauth...@googlegroups.com
Good work Aaron. I'll need to reinstall a ruby 1.9 before I can test
it, but it's great to get rid of our our only dependency.

+1 on getting rid of hoe. Jeweler is so much easier.

Seth, let me know if you need me to do anything administratively to
allow you to release to gemcutter when time comes.

P
http://agree2.com - Reach Agreement!
http://extraeagle.com - Solutions for the electronic Extra Legal world
http://stakeventures.com - Bootstrapping blog

Seth Fitzsimmons

unread,
Dec 1, 2009, 12:49:33 AM12/1/09
to oauth...@googlegroups.com
I looked into checking the ruby version in the gemspec, but it didn't
seem to do what I thought it did. It turns out that it checks the
version of ruby that's *creating* the gemspec (at least the way I was
attempting to do it), so keep an eye out for that. I'm still hopeful
that I missed something and that it'll be easy.

Let us know.

seth

Seth Fitzsimmons

unread,
Dec 1, 2009, 12:50:58 AM12/1/09
to oauth...@googlegroups.com
> +1 on getting rid of hoe. Jeweler is so much easier.

Works for me ;-) As you may have noticed, all I do is bundle the
patches up and release them these days, so whatever makes that process
easier for me...

> Seth, let me know if you need me to do anything administratively to
> allow you to release to gemcutter when time comes.

I think I managed to push the last release to gemcutter, but I'll let
you know if I run into any problems.

seth

Aaron Quint

unread,
Dec 1, 2009, 12:15:29 PM12/1/09
to oauth...@googlegroups.com
Hey All

Was looking into different ways to do RUBY_VERSION based gem
dependencies, when I realized that the hmac code in Ruby 1.9 is 100%
Ruby. I backported it into the gem and after adding some missing
methods to String (to support 1.8.6) I was able to get all the tests
to pass against 1.8.6, 1.8.7, and 1.9.1 without ever requiring the
ruby-hmac gem.

Heres my new branch: http://github.com/quirkey/oauth/tree/1.9-nodeps

Can you guys check it out and confirm its working for you? If so, I'll
take the lead on getting the gem ported to jeweler (should be quick).

Thanks!
--AQ

Aaron Quint
http://www.quirkey.com



Aaron Quint

unread,
Dec 1, 2009, 12:20:17 PM12/1/09
to oauth...@googlegroups.com
On Mon, Nov 30, 2009 at 11:24 PM, Pelle Braendgaard <pel...@gmail.com> wrote:
> Good work Aaron. I'll need to reinstall a ruby 1.9 before I can test
> it, but it's great to get rid of our our only dependency.
>
> +1 on getting rid of hoe. Jeweler is so much easier.
>
> Seth, let me know if you need me to do anything administratively to
> allow you to release to gemcutter when time comes.
>
> P
>

Thanks!

A litte OT, but you should definitely check out rvm if you havent yet
(http://rvm.beginrescueend.com/), its pretty much the only way I would
be able to test against all these different versions. Possibly the
coolest thing is being able to run:

rvm 1.8.6,1.8.7,1.9.1 rake test

and having it run the test suite against the different versions sequentially.

--AQ

Seth Fitzsimmons

unread,
Dec 12, 2009, 8:10:55 PM12/12/09
to oauth...@googlegroups.com
> Was looking into different ways to do RUBY_VERSION based gem
> dependencies, when I realized that the hmac code in Ruby 1.9 is 100%
> Ruby. I backported it into the gem and after adding some missing
> methods to String (to support 1.8.6) I was able to get all the tests
> to pass against 1.8.6, 1.8.7, and 1.9.1 without ever requiring the
> ruby-hmac gem.

That rocks! I definitely want to get that into 0.3.7.

> Heres my new branch: http://github.com/quirkey/oauth/tree/1.9-nodeps
>
> Can you guys check it out and confirm its working for you? If so, I'll
> take the lead on getting the gem ported to jeweler (should be quick).

Let's try to wrap this into a pre-release gem so more people can give
it a try and provide feedback. (My ruby setup is all funky right now
(mainly because I haven't written much in it recently), so I'm not
even sure if all the tests pass right now. Bad maintainer!)

How do you feel about rebasing your changes against my master branch
(with all of the other miscellaneous fixes applied)? (And porting it
to jeweler, pretty please!)

seth

Aaron Quint

unread,
Dec 12, 2009, 9:18:39 PM12/12/09
to oauth...@googlegroups.com
Awesome. I'll try the rebase now and see how it pans out. I'll report back soon,
--AQ

Aaron Quint

unread,
Dec 13, 2009, 12:22:33 AM12/13/09
to oauth...@googlegroups.com
Hey Seth/All

So I managed to rebase without much issue, however, even on master it
appears a bunch of tests were failing. At first it was it looks like
some of the features that got merged in recently wonked out some of
the tests with a faulty merge. Once I fixed the test issues, however,
there still seem to be some failing tests (regardless of ruby
version).

I did manage to make the commit to move to jeweler and merged back to my master.
Check it all out here:
http://github.com/quirkey/oauth

If someone can point me in the right direction of why some of these
plaintext tests might be failing than I think we're good to go to push
a new release.

--AQ

Aaron Quint
http://www.quirkey.com



Seth Fitzsimmons

unread,
Dec 13, 2009, 2:04:56 AM12/13/09
to oauth...@googlegroups.com
> So I managed to rebase without much issue, however, even on master it
> appears a bunch of tests were failing. At first it was it looks like
> some of the features that got merged in recently wonked out some of
> the tests with a faulty merge. Once I fixed the test issues, however,
> there still seem to be some failing tests (regardless of ruby
> version).

Yeah, sorry. I did all my testing with ruby 0.0.0 (i.e. not at all).
I'm going to get a ruby environment working tomorrow and see if I
can't get everything passing again. Thanks a ton for digging into my
mess.

> I did manage to make the commit to move to jeweler and merged back to my master.
> Check it all out here:
> http://github.com/quirkey/oauth

Sweet! A question for you and Corey - how does Bundler play with
Jeweler? Corey committed a change that wraps Bundler into the
existing Hoe spec; can that be ported over to Jeweler? (Am I full of
crap? I've skimmed some of the recent Bundler posts, but I haven't
gotten close enough to actually know what it does.)

> If someone can point me in the right direction of why some of these
> plaintext tests might be failing than I think we're good to go to push
> a new release.

I'll have a look tomorrow.

seth

Seth Fitzsimmons

unread,
Dec 13, 2009, 2:37:26 PM12/13/09
to oauth...@googlegroups.com
> So I managed to rebase without much issue, however, even on master it
> appears a bunch of tests were failing. At first it was it looks like
> some of the features that got merged in recently wonked out some of
> the tests with a faulty merge. Once I fixed the test issues, however,
> there still seem to be some failing tests (regardless of ruby
> version).

Unborked. Not everything that had been applied before got applied on
try #2. Mind rebasing / merging again? (Sorry...)

seth

Rick DeNatale

unread,
Dec 31, 2009, 3:52:26 PM12/31/09
to OAuth Ruby
What's the latest status on this?

Is the 0.3.6 version of the gem supposed to be compatible with Ruby
1.9?

I just tried to use the gem via the oauth rails plugin, with 1.9 and
I'm getting this:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.reset_key
RAILS_ROOT: /Users/rick/fifthrail/relevance_legalpm

Application Trace | Framework Trace | Full Trace
/Users/rick/.rvm/gems/ruby/1.9.1/gems/ruby-hmac-0.3.2/lib/hmac.rb:
101:in `ensure in digest'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/ruby-hmac-0.3.2/lib/hmac.rb:
101:in `digest'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/signature/
hmac/base.rb:9:in `digest'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/signature/
base.rb:54:in `signature'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
signature.rb:20:in `sign'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/client/
helper.rb:44:in `signature'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/client/
helper.rb:67:in `header'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/client/
net_http.rb:80:in `set_oauth_header'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/client/
net_http.rb:35:in `oauth!'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
consumer.rb:208:in `sign!'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
consumer.rb:177:in `create_signed_request'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
consumer.rb:149:in `request'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
consumer.rb:183:in `token_request'
/Users/rick/.rvm/gems/ruby/1.9.1/gems/oauth-0.3.6/lib/oauth/
consumer.rb:128:in `get_request_token'
/Users/rick/fifthrail/relevance_legalpm/vendor/plugins/oauth-plugin/
lib/oauth/models/consumers/token.rb:30:in `get_request_token'
/Users/rick/fifthrail/relevance_legalpm/vendor/plugins/oauth-plugin/
lib/oauth/controllers/consumer_controller.rb:23:in `show'

Which seems to be related to this thread.

Do I need to pull down a particular git branch and build my own gem
or...

Thanks in advance.

Aaron Quint

unread,
Dec 31, 2009, 5:39:48 PM12/31/09
to oauth...@googlegroups.com
Hey Rick

The next version has yet to be released - but you can grab a (1.9)
working copy here:
http://github.com/quirkey/oauth/tree/19merge
Its also working on jeweler, so If you need it as a gem, cd into the
checked-out or downloaded copy and run:
rake install

Hope that helps,
--AQ

Aaron Quint
http://www.quirkey.com

Alfred

unread,
Feb 4, 2010, 9:25:12 AM2/4/10
to OAuth Ruby
Hi
I have been trying to use oauth on ruby 1.9 and came with the error in
this thread and i tried using the link you provided to install the gem
but with no success. i still have the same error.

I downloaded the version you mentioned working on 1.9 , cd into the
folder, rake install.
i then tried to gem install oauth.gem --local
that didn't make it work
i then copied the gem folder to ruby/gems/1.9.1/gems/oauth-0.3.6/

now the gem should be working, i open the irb , require 'oauth'
returns true.
but my application still gives the same error.

any advice if this can be working on ruby 1.9.1 ????

Thanks,

On Jan 1, 12:39 am, Aaron Quint <aa...@quirkey.com> wrote:
> Hey Rick
>
> The next version has yet to be released - but you can grab a (1.9)
> working copy here:http://github.com/quirkey/oauth/tree/19merge
> Its also working on jeweler, so If you need it as a gem, cd into the
> checked-out or downloaded copy and run:
> rake install
>
> Hope that helps,
> --AQ
>

> Aaron Quinthttp://www.quirkey.com

Aaron Quint

unread,
Feb 4, 2010, 10:06:35 AM2/4/10
to oauth...@googlegroups.com
Hey Alfred

Did you download that specific branch? quirkey/master is not working
on 1.9, only quirkey/19merge.
rake install should also do the full gem install locally since it uses jeweler.
--AQ

Aaron Quint
http://www.quirkey.com

Alfred

unread,
Feb 4, 2010, 10:53:10 AM2/4/10
to OAuth Ruby
yes i downloaded that branch and followed exactly what you said, but
nothing works.
is there i way i could know if it is really working?
i am running ruby 1.9.1 and rails 2.3.4

On Feb 4, 5:06 pm, Aaron Quint <aa...@quirkey.com> wrote:
> Hey Alfred
>
> Did you download that specific branch? quirkey/master is not working
> on 1.9, only quirkey/19merge.
> rake install should also do the full gem install locally since it uses jeweler.
> --AQ
>

> Aaron Quinthttp://www.quirkey.com

Alfred

unread,
Feb 4, 2010, 11:12:01 AM2/4/10
to OAuth Ruby
Hey Aaron,

it is finally working,
Good work

Thanks

On Feb 4, 5:06 pm, Aaron Quint <aa...@quirkey.com> wrote:
> Hey Alfred
>
> Did you download that specific branch? quirkey/master is not working
> on 1.9, only quirkey/19merge.
> rake install should also do the full gem install locally since it uses jeweler.
> --AQ
>

> Aaron Quinthttp://www.quirkey.com

Aaron Quint

unread,
Feb 4, 2010, 11:45:53 AM2/4/10
to oauth...@googlegroups.com
Sorry, what specifically isn't working? Are you getting specific
errors? Can you paste the backtraces somewhere?
--AQ

Aaron Quint
http://www.quirkey.com

Aaron Quint

unread,
Feb 4, 2010, 11:46:33 AM2/4/10
to oauth...@googlegroups.com
Great - Hopefully we can get this released soon,
--AQ

Aaron Quint
http://www.quirkey.com

Seth Fitzsimmons

unread,
Feb 5, 2010, 12:39:42 AM2/5/10
to oauth...@googlegroups.com
*Thwack* ...yes... I *will* carve out some time this Saturday to see
if I can't get it closer.

seth

Reply all
Reply to author
Forward
0 new messages