rest-more 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.gitmodules +3 -0
- data/.travis.yml +13 -0
- data/CHANGES.md +7 -0
- data/Gemfile +26 -0
- data/LICENSE +201 -0
- data/README.md +72 -0
- data/Rakefile +63 -0
- data/TODO.md +14 -0
- data/example/rails2/Gemfile +21 -0
- data/example/rails2/README +4 -0
- data/example/rails2/Rakefile +11 -0
- data/example/rails2/app/controllers/application_controller.rb +134 -0
- data/example/rails2/app/views/application/helper.html.erb +2 -0
- data/example/rails2/config/boot.rb +130 -0
- data/example/rails2/config/environment.rb +15 -0
- data/example/rails2/config/environments/development.rb +17 -0
- data/example/rails2/config/environments/production.rb +28 -0
- data/example/rails2/config/environments/test.rb +30 -0
- data/example/rails2/config/initializers/cookie_verification_secret.rb +7 -0
- data/example/rails2/config/initializers/new_rails_defaults.rb +21 -0
- data/example/rails2/config/initializers/session_store.rb +15 -0
- data/example/rails2/config/preinitializer.rb +23 -0
- data/example/rails2/config/rest-core.yaml +16 -0
- data/example/rails2/config/routes.rb +43 -0
- data/example/rails2/log +0 -0
- data/example/rails2/test/functional/application_controller_test.rb +219 -0
- data/example/rails2/test/test_helper.rb +18 -0
- data/example/rails2/test/unit/rails_util_test.rb +44 -0
- data/example/rails3/Gemfile +20 -0
- data/example/rails3/README +4 -0
- data/example/rails3/Rakefile +7 -0
- data/example/rails3/app/controllers/application_controller.rb +134 -0
- data/example/rails3/app/views/application/helper.html.erb +2 -0
- data/example/rails3/config.ru +4 -0
- data/example/rails3/config/application.rb +23 -0
- data/example/rails3/config/boot.rb +6 -0
- data/example/rails3/config/environment.rb +5 -0
- data/example/rails3/config/environments/development.rb +23 -0
- data/example/rails3/config/environments/production.rb +49 -0
- data/example/rails3/config/environments/test.rb +30 -0
- data/example/rails3/config/initializers/secret_token.rb +7 -0
- data/example/rails3/config/initializers/session_store.rb +8 -0
- data/example/rails3/config/rest-core.yaml +16 -0
- data/example/rails3/config/routes.rb +5 -0
- data/example/rails3/test/functional/application_controller_test.rb +219 -0
- data/example/rails3/test/test_helper.rb +18 -0
- data/example/rails3/test/unit/rails_util_test.rb +44 -0
- data/example/sinatra/config.ru +16 -0
- data/lib/rest-core/client/facebook.rb +265 -0
- data/lib/rest-core/client/facebook/rails_util.rb +334 -0
- data/lib/rest-core/client/flurry.rb +107 -0
- data/lib/rest-core/client/flurry/rails_util.rb +74 -0
- data/lib/rest-core/client/github.rb +18 -0
- data/lib/rest-core/client/linkedin.rb +59 -0
- data/lib/rest-core/client/mixi.rb +47 -0
- data/lib/rest-core/client/simple.rb +2 -0
- data/lib/rest-core/client/twitter.rb +101 -0
- data/lib/rest-core/client/universal.rb +18 -0
- data/lib/rest-more.rb +11 -0
- data/lib/rest-more/version.rb +4 -0
- data/rest-more.gemspec +127 -0
- data/task/.gitignore +1 -0
- data/task/gemgem.rb +265 -0
- data/test/client/facebook/config/rest-core.yaml +8 -0
- data/test/client/facebook/test_api.rb +97 -0
- data/test/client/facebook/test_cache.rb +58 -0
- data/test/client/facebook/test_default.rb +23 -0
- data/test/client/facebook/test_error.rb +65 -0
- data/test/client/facebook/test_handler.rb +84 -0
- data/test/client/facebook/test_load_config.rb +39 -0
- data/test/client/facebook/test_misc.rb +72 -0
- data/test/client/facebook/test_oauth.rb +38 -0
- data/test/client/facebook/test_old.rb +114 -0
- data/test/client/facebook/test_page.rb +106 -0
- data/test/client/facebook/test_parse.rb +166 -0
- data/test/client/facebook/test_serialize.rb +43 -0
- data/test/client/facebook/test_timeout.rb +22 -0
- data/test/client/flurry/test_metrics.rb +83 -0
- data/test/client/twitter/test_api.rb +37 -0
- metadata +155 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake/dsl_definition'
|
7
|
+
require 'rake'
|
8
|
+
require 'rake/testtask'
|
9
|
+
require 'rake/rdoctask'
|
10
|
+
|
11
|
+
require 'tasks/rails'
|
@@ -0,0 +1,134 @@
|
|
1
|
+
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
protect_from_forgery
|
4
|
+
|
5
|
+
include RestCore::Facebook::RailsUtil
|
6
|
+
include RestCore::Flurry::RailsUtil
|
7
|
+
|
8
|
+
before_filter :filter_common , :only => [:index]
|
9
|
+
before_filter :filter_canvas , :only => [:canvas]
|
10
|
+
before_filter :filter_options , :only => [:options]
|
11
|
+
before_filter :filter_no_auto , :only => [:no_auto]
|
12
|
+
before_filter :filter_diff_app_id , :only => [:diff_app_id]
|
13
|
+
before_filter :filter_diff_canvas , :only => [:diff_canvas]
|
14
|
+
before_filter :filter_iframe_canvas, :only => [:iframe_canvas]
|
15
|
+
before_filter :filter_cache , :only => [:cache]
|
16
|
+
before_filter :filter_hanlder , :only => [:handler_]
|
17
|
+
before_filter :filter_session , :only => [:session_]
|
18
|
+
before_filter :filter_cookies , :only => [:cookies_]
|
19
|
+
|
20
|
+
def index
|
21
|
+
render :text => rc_facebook.get('me').to_json
|
22
|
+
end
|
23
|
+
alias_method :canvas , :index
|
24
|
+
alias_method :options , :index
|
25
|
+
alias_method :diff_canvas , :index
|
26
|
+
alias_method :iframe_canvas, :index
|
27
|
+
alias_method :handler_ , :index
|
28
|
+
alias_method :session_ , :index
|
29
|
+
alias_method :cookies_ , :index
|
30
|
+
|
31
|
+
def no_auto
|
32
|
+
rc_facebook.get('me')
|
33
|
+
rescue RestCore::Facebook::Error
|
34
|
+
render :text => 'XD'
|
35
|
+
end
|
36
|
+
|
37
|
+
def diff_app_id
|
38
|
+
render :text => rc_facebook.app_id
|
39
|
+
end
|
40
|
+
|
41
|
+
def cache
|
42
|
+
url = rc_facebook.url('cache')
|
43
|
+
rc_facebook.get('cache')
|
44
|
+
rc_facebook.get('cache')
|
45
|
+
render :text => Rails.cache.read(Digest::MD5.hexdigest(url))
|
46
|
+
end
|
47
|
+
|
48
|
+
def error
|
49
|
+
raise RestCore::Facebook::Error.new("don't rescue me")
|
50
|
+
end
|
51
|
+
|
52
|
+
def reinitialize
|
53
|
+
rc_facebook_setup(:cache => {'a' => 'b'})
|
54
|
+
render :text => YAML.dump(rc_facebook.cache)
|
55
|
+
end
|
56
|
+
|
57
|
+
def helper; end
|
58
|
+
|
59
|
+
def defaults
|
60
|
+
rc_facebook_setup
|
61
|
+
render :text => (rc_facebook.cache == Rails.cache &&
|
62
|
+
rc_facebook.log_method.receiver == Rails.logger)
|
63
|
+
end
|
64
|
+
|
65
|
+
def parse_cookies
|
66
|
+
rc_facebook_setup
|
67
|
+
render :text => 'dummy'
|
68
|
+
end
|
69
|
+
|
70
|
+
# regression test
|
71
|
+
def no_ns_pollution
|
72
|
+
render :text => Timeout::Error.name
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def filter_common
|
77
|
+
rc_facebook_setup(:auto_authorize => true, :canvas => '')
|
78
|
+
end
|
79
|
+
|
80
|
+
def filter_canvas
|
81
|
+
rc_facebook_setup(:canvas => RestCore::Facebook.
|
82
|
+
default_canvas,
|
83
|
+
:auto_authorize_scope => 'publish_stream')
|
84
|
+
end
|
85
|
+
|
86
|
+
def filter_diff_canvas
|
87
|
+
rc_facebook_setup(:canvas => 'ToT',
|
88
|
+
:auto_authorize_scope => 'email')
|
89
|
+
end
|
90
|
+
|
91
|
+
def filter_iframe_canvas
|
92
|
+
rc_facebook_setup(:canvas => 'zzz',
|
93
|
+
:auto_authorize => true)
|
94
|
+
end
|
95
|
+
|
96
|
+
def filter_no_auto
|
97
|
+
rc_facebook_setup(:auto_authorize => false)
|
98
|
+
end
|
99
|
+
|
100
|
+
def filter_diff_app_id
|
101
|
+
rc_facebook_setup(:app_id => 'zzz',
|
102
|
+
:auto_authorize => true)
|
103
|
+
end
|
104
|
+
|
105
|
+
def filter_options
|
106
|
+
rc_facebook_setup(:auto_authorize_options => {:scope => 'bogus'},
|
107
|
+
:canvas => nil)
|
108
|
+
end
|
109
|
+
|
110
|
+
def filter_cache
|
111
|
+
rc_facebook_setup(:cache => Rails.cache)
|
112
|
+
end
|
113
|
+
|
114
|
+
def filter_hanlder
|
115
|
+
rc_facebook_setup(:write_handler => method(:write_handler),
|
116
|
+
:check_handler => method(:check_handler))
|
117
|
+
end
|
118
|
+
|
119
|
+
def write_handler fbs
|
120
|
+
Rails.cache[:fbs] = fbs
|
121
|
+
end
|
122
|
+
|
123
|
+
def check_handler
|
124
|
+
Rails.cache[:fbs]
|
125
|
+
end
|
126
|
+
|
127
|
+
def filter_session
|
128
|
+
rc_facebook_setup(:write_session => true)
|
129
|
+
end
|
130
|
+
|
131
|
+
def filter_cookies
|
132
|
+
rc_facebook_setup(:write_cookies => true)
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
if load_error.message =~ /Could not find RubyGem rails/
|
66
|
+
STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
67
|
+
exit 1
|
68
|
+
else
|
69
|
+
raise
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class << self
|
74
|
+
def rubygems_version
|
75
|
+
Gem::RubyGemsVersion rescue nil
|
76
|
+
end
|
77
|
+
|
78
|
+
def gem_version
|
79
|
+
if defined? RAILS_GEM_VERSION
|
80
|
+
RAILS_GEM_VERSION
|
81
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
82
|
+
ENV['RAILS_GEM_VERSION']
|
83
|
+
else
|
84
|
+
parse_gem_version(read_environment_rb)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def load_rubygems
|
89
|
+
min_version = '1.3.2'
|
90
|
+
require 'rubygems'
|
91
|
+
unless rubygems_version >= min_version
|
92
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
93
|
+
exit 1
|
94
|
+
end
|
95
|
+
|
96
|
+
rescue LoadError
|
97
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
98
|
+
exit 1
|
99
|
+
end
|
100
|
+
|
101
|
+
def parse_gem_version(text)
|
102
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
def read_environment_rb
|
107
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# begin copied from http://gembundler.com/rails23.html
|
114
|
+
class Rails::Boot
|
115
|
+
def run
|
116
|
+
load_initializer
|
117
|
+
|
118
|
+
Rails::Initializer.class_eval do
|
119
|
+
def load_gems
|
120
|
+
@bundler_loaded ||= Bundler.require(:default, Rails.env.to_sym)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Rails::Initializer.run(:set_load_path)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
# end copied from http://gembundler.com/rails23.html
|
128
|
+
|
129
|
+
# All that for this:
|
130
|
+
Rails.boot!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
+
RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
+
|
9
|
+
Rails::Initializer.run do |config|
|
10
|
+
# we use bundler now, so don't do this at this example
|
11
|
+
# config.gem 'rest-graph'
|
12
|
+
|
13
|
+
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
14
|
+
config.time_zone = 'UTC'
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.action_controller.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
config.action_view.cache_template_loading = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
23
|
+
|
24
|
+
# Disable delivery errors, bad email addresses will be ignored
|
25
|
+
# config.action_mailer.raise_delivery_errors = false
|
26
|
+
|
27
|
+
# Enable threaded mode
|
28
|
+
# config.threadsafe!
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
29
|
+
|
30
|
+
config.logger = Logger.new($stdout, :debug)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.cookie_verifier_secret = '095e8e5c0b6b901901efb23fab50005b68d9d6a9d41f4ec780946cff34b26603762bc0ea1baf204613b252e5ae499d38b232d5b75edac513a723e450e76548a3';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
ActionController::Routing.generate_best_match = false
|
15
|
+
|
16
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
17
|
+
ActiveSupport.use_standard_json_time_format = true
|
18
|
+
|
19
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
20
|
+
# if you're including raw json in an HTML page.
|
21
|
+
ActiveSupport.escape_html_entities_in_json = false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_rails2_session',
|
9
|
+
:secret => 'c99a19ce0dc4ed1809e32b6b43bd9229c3a504c456230119dd445fdcb63c0ce06b436f1bf1eace27ebbe0da6041ff2b65cbb4ae4beadc3077e3e6ae07ea75118'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
# copied from http://gembundler.com/rails23.html
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "rubygems"
|
6
|
+
require "bundler"
|
7
|
+
rescue LoadError
|
8
|
+
raise "Could not load the bundler gem. Install it with `gem install bundler`."
|
9
|
+
end
|
10
|
+
|
11
|
+
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
|
12
|
+
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
|
13
|
+
"Run `gem install bundler` to upgrade."
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
# Set up load paths for all bundled gems
|
18
|
+
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
|
19
|
+
Bundler.setup
|
20
|
+
rescue Bundler::GemNotFound
|
21
|
+
raise RuntimeError, "Bundler couldn't find some gems." +
|
22
|
+
"Did you run `bundle install`?"
|
23
|
+
end
|