songkick / oauth2-provider

Simple OAuth 2.0 provider toolkit
MIT License
529 stars 148 forks source link

Make example app a little more stand-alone #5

Closed chrislo closed 13 years ago

chrislo commented 13 years ago

Hi James,

I've made a few small changes to the example app to make it work in a standalone fashion (i.e you can copy the example app directory somewhere else and it will work).

I've added a Gemfile which specifies the oauth-provider code as an external dependency (rather than a relative ath). Bundler is used to require the code in environment.rb

Couple of other small changes too.

Cheers,

Chris

jcoglan commented 13 years ago

Can you explain some more of the rationale for doing this? It seems like it would make it harder to test out changes to the codebase since you'd need to commit them before the example app could use them.

chrislo commented 13 years ago

Ah, I understand better what the example app is for now. If it's to test changes to the underlying lib then it's probably better as is. If it's more as an example to end users of how to use the library, the changes I'd made were to make it easier to get up and running. Perhaps my changes belong better in the docs?

jcoglan commented 13 years ago

This is probably a question of taste. Personally I like example apps to load the code they're demoing from the repository, both for ease of development and ease of tinkering by users. I figure it's reasonably obvious that if you've installed the gem you just require that instead.

Might make more sense to add lib to the load path so we get just a plain require 'oauth2/provider' to load the library. What do you think?

chrislo commented 13 years ago

Yes, that makes sense to me! I'll close the pull request.

Thanks!

jcoglan commented 13 years ago

My mistake, it already does this:

dir = File.expand_path(File.dirname(__FILE__))
$:.unshift(dir + '/../lib')
require 'oauth2/provider'

I'm not usually that disciplined; I tend to just do something like require File.dirname(__FILE__) + '/../lib/blah/etc'.