forked from neerajsingh0101/admin_data
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.rb
More file actions
48 lines (36 loc) · 1.54 KB
/
init.rb
File metadata and controls
48 lines (36 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
AdminData::Version = AdminData::VERSION = '0.0.5'
# not requiring rubygems because of this http://gist.github.com/54177
#require 'rubygems'
# do not want to raise exception if will_paginate is missing because running
# rake gems:install will never complete
# this is the reason why this method returns a boolean value
def load_will_paginate
begin
require 'will_paginate'
true
rescue LoadError => e
$stderr.puts %(
***********************************************
* gem will_paginate is missing *
* plugin admin_data depends on will_paginate *
* Please install will_paginate by executing *
* gem sources -a http://gems.github.com *
* sudo gem install mislav-will_paginate *
***********************************************
)
false
end
end
if load_will_paginate
require 'admin_data_date_validation'
if Rails.version < "2.2.0"
raise %( plugin admin_data only works with Rails 2.2 and higher)
elsif Rails.version > '2.2.0' && Rails.version < '2.3.0'
raise %( This version of plugin admin_data only works with Rails 2.3 and higher. You are using Rails 2.2 . Please read README on how to use this plugin with Rails 2.2' )
end
end
ActionView::Base.send :include, AdminData::Helpers
require File.join(RAILS_ROOT,'vendor', 'plugins', 'admin_data', 'lib', 'admin_data','settings.rb')
AdminDataConfig.initialize_defaults
require File.join(RAILS_ROOT,'vendor', 'plugins', 'admin_data', 'lib', 'admin_data','util.rb')
$debug_admin_data = false