fanforce-app-factory 0.35.1 → 0.36.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,8 @@ class FanforceApp::CoreConfig
|
|
4
4
|
attr_accessor :bugsnag, :bugsnag_enabled
|
5
5
|
attr_reader :type
|
6
6
|
|
7
|
+
REDIS_URL = ENV['REDIS_URL'] || 'redis://localhost:6379'
|
8
|
+
|
7
9
|
def initialize(root_dir)
|
8
10
|
@layout_for_index = true
|
9
11
|
@layout_for_dashboard = true
|
@@ -11,7 +13,7 @@ class FanforceApp::CoreConfig
|
|
11
13
|
@_id = ENV['FANFORCE_APP_ID']
|
12
14
|
@root_dir = root_dir
|
13
15
|
@factory_root_dir = File.expand_path '../../', __FILE__
|
14
|
-
@redis_url =
|
16
|
+
@redis_url = REDIS_URL
|
15
17
|
@show_error_details = false
|
16
18
|
|
17
19
|
@bugsnag = (ENV['BUGSNAG_API_KEY'].present?) ? {api_key: ENV['BUGSNAG_API_KEY']} : nil
|
@@ -55,18 +57,28 @@ class FanforceApp::CoreConfig
|
|
55
57
|
@dir_name = /\/([^\/]+)\/?$/.match(@root_dir)[1]
|
56
58
|
|
57
59
|
$: << File.join(@root_dir,'lib') if File.directory?("#{@root_dir}/lib")
|
60
|
+
$: << @root_dir if File.directory?("#{@root_dir}")
|
58
61
|
|
59
62
|
require "#{@root_dir}/config/initializer" if File.exists?("#{@root_dir}/config/initializer.rb")
|
60
|
-
require "#{@root_dir}/config/routes" if File.exists?("#{@root_dir}/config/routes.rb")
|
61
|
-
|
62
63
|
require "#{@root_dir}/initializer" if File.exists?("#{@root_dir}/initializer.rb")
|
64
|
+
if File.directory?("#{@root_dir}/initializers")
|
65
|
+
Dir["#{@root_dir}/initializers/*.rb"].each {|file| require file }
|
66
|
+
end
|
67
|
+
|
68
|
+
require "#{@root_dir}/config/routes" if File.exists?("#{@root_dir}/config/routes.rb")
|
69
|
+
require "#{@root_dir}/views/_routes" if File.exists?("#{@root_dir}/views/_routes.rb")
|
70
|
+
require "#{@root_dir}/_routes" if File.exists?("#{@root_dir}/_routes.rb")
|
63
71
|
require "#{@root_dir}/routes" if File.exists?("#{@root_dir}/routes.rb")
|
64
72
|
|
65
73
|
require "#{@factory_root_dir}/routes"
|
66
74
|
end
|
67
75
|
|
68
76
|
def load_redis
|
69
|
-
|
77
|
+
self.class.load_redis(@redis_url)
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.load_redis(redis_url=REDIS_URL)
|
81
|
+
$Redis = ::Redis.new(url: redis_url)
|
70
82
|
end
|
71
83
|
|
72
84
|
end
|