Skip to content

Commit

Permalink
Respect the global load path
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Mar 20, 2011
1 parent a2b0b51 commit 6a629a6
Show file tree
Hide file tree
Showing 31 changed files with 60 additions and 40 deletions.
12 changes: 6 additions & 6 deletions lib/twitter.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require File.expand_path('../twitter/error', __FILE__)
require File.expand_path('../twitter/configuration', __FILE__)
require File.expand_path('../twitter/api', __FILE__)
require File.expand_path('../twitter/client', __FILE__)
require File.expand_path('../twitter/search', __FILE__)
require File.expand_path('../twitter/base', __FILE__)
require 'twitter/error'
require 'twitter/configuration'
require 'twitter/api'
require 'twitter/client'
require 'twitter/search'
require 'twitter/base'

module Twitter
extend Configuration
Expand Down
6 changes: 3 additions & 3 deletions lib/twitter/api.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require File.expand_path('../connection', __FILE__)
require File.expand_path('../request', __FILE__)
require File.expand_path('../authentication', __FILE__)
require 'twitter/connection'
require 'twitter/request'
require 'twitter/authentication'

module Twitter
# @private
Expand Down
21 changes: 20 additions & 1 deletion lib/twitter/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ class Client < API
# Require client method modules after initializing the Client class in
# order to avoid a superclass mismatch error, allowing those modules to be
# Client-namespaced.
Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
require 'twitter/client/utils'
require 'twitter/client/account'
require 'twitter/client/block'
require 'twitter/client/direct_messages'
require 'twitter/client/favorites'
require 'twitter/client/friendship'
require 'twitter/client/friends_and_followers'
require 'twitter/client/geo'
require 'twitter/client/legal'
require 'twitter/client/list'
require 'twitter/client/list_members'
require 'twitter/client/list_subscribers'
require 'twitter/client/local_trends'
require 'twitter/client/notification'
require 'twitter/client/spam_reporting'
require 'twitter/client/saved_searches'
require 'twitter/client/timeline'
require 'twitter/client/trends'
require 'twitter/client/tweets'
require 'twitter/client/user'

alias :api_endpoint :endpoint

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'faraday'
require File.expand_path('../version', __FILE__)
require 'twitter/version'

module Twitter
# Defines constants and methods related to configuration
Expand Down
5 changes: 4 additions & 1 deletion lib/twitter/connection.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require 'faraday_middleware'
Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}
require 'faraday/multipart'
require 'faraday/oauth'
require 'faraday/raise_http_4xx'
require 'faraday/raise_http_5xx'

module Twitter
# @private
Expand Down
2 changes: 1 addition & 1 deletion spec/faraday/response_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__)
require 'helper'

describe Faraday::Response do
before do
Expand Down
4 changes: 1 addition & 3 deletions spec/spec_helper.rb → spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
add_group 'Faraday Middleware', 'lib/faraday'
add_group 'Specs', 'spec'
end

require File.expand_path('../../lib/twitter', __FILE__)

require 'twitter'
require 'rspec'
require 'webmock/rspec'
RSpec.configure do |config|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__)
require 'helper'

describe Twitter::API do
before do
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Base do
context ".new" do
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/account_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/block_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/direct_messages_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/favorites_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/friends_and_followers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/friendship_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/geo_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
context ".new" do
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/legal_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/list_members_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/list_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/list_subscribers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/local_trends_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/notification_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/saved_searches_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/spam_reporting_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/timeline_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/trends_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
context ".new" do
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/tweets_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
Twitter::Configuration::VALID_FORMATS.each do |format|
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/client_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Client do
it "should connect using the endpoint configuration" do
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/search_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__)
require 'helper'

describe Twitter::Search do

Expand Down
2 changes: 1 addition & 1 deletion spec/twitter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../spec_helper', __FILE__)
require 'helper'

describe Twitter do
after do
Expand Down

1 comment on commit 6a629a6

@joshk
Copy link
Contributor

@joshk joshk commented on 6a629a6 Mar 20, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! I <3 Load Path

Please sign in to comment.