Module: WarpDrive
- Extended by:
- WarpDrive
- Included in:
- WarpDrive
- Defined in:
- lib/warp_drive/path.rb,
lib/warp_drive/configure.rb,
lib/warp_drive/boot/procs.rb,
lib/warp_drive/boot/workers.rb,
lib/warp_drive/boot/method_list.rb
Defined Under Namespace
Modules: Procs
Classes: Path
Constant Summary
collapse
- RAILS_INIT_METHODS =
%w{
install_gem_spec_stubs
set_load_path
require_frameworks
set_autoload_paths
add_plugin_load_paths
load_environment
preload_frameworks
initialize_encoding
initialize_database
initialize_cache
initialize_framework_caches
initialize_logger
initialize_framework_logging
initialize_dependency_mechanism
initialize_whiny_nils
initialize_time_zone
initialize_i18n
initialize_framework_settings
initialize_framework_views
initialize_metal
add_support_load_paths
check_for_unbuilt_gems
load_plugins
add_gem_load_paths
load_gems
check_gem_dependencies
gems_dependencies_loaded
load_application_initializers
after_initialize
initialize_database_middleware
prepare_dispatcher
initialize_routing
load_observers
load_view_paths
load_application_classes
disable_dependency_loading
}
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
118
119
120
|
# File 'lib/warp_drive/boot/workers.rb', line 118
def method_missing(sym, *args)
end
|
Class Method Details
5
6
7
|
# File 'lib/warp_drive/configure.rb', line 5
def configure
yield configatron.warp_drive
end
|
Instance Method Details
#initialize_database ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/warp_drive/boot/workers.rb', line 60
def initialize_database
Rails.configuration.instance_eval do
def database_configuration
require 'erb'
db_opts = {}
[WarpDrive::Path.config.database.yml.to_s,
File.join(RAILS_ROOT, 'config', 'database.yml')].each do |yml_path|
if File.exists?(yml_path)
opts = YAML::load(ERB.new(File.read(yml_path)).result)
db_opts.recursive_merge!(opts) if opts
end
end
db_opts
end end end
|
#initialize_database_middleware ⇒ Object
86
87
88
|
# File 'lib/warp_drive/boot/workers.rb', line 86
def initialize_database_middleware
require File.join(File.dirname(__FILE__), 'migration_override')
end
|
#initialize_dependency_mechanism ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/warp_drive/boot/workers.rb', line 44
def initialize_dependency_mechanism
ActiveSupport::Dependencies.class_eval do
class << self
alias_method :require_or_load_without_warp_drive, :require_or_load
def require_or_load_with_warp_drive(file_name, const_path = nil)
sr_file_name = file_name.gsub(RAILS_ROOT, WarpDrive::ROOT)
require_or_load_without_warp_drive(sr_file_name, const_path) if File.exists?(sr_file_name)
require_or_load_without_warp_drive(file_name, const_path)
end
alias_method :require_or_load, :require_or_load_with_warp_drive
end
end
end
|
#initialize_routing ⇒ Object
34
35
36
|
# File 'lib/warp_drive/boot/workers.rb', line 34
def initialize_routing
ActionController::Routing::Routes.add_configuration_file(WarpDrive::Path.config.routes.rb.to_s)
end
|
#load_application_initializers ⇒ Object
79
80
81
82
83
84
|
# File 'lib/warp_drive/boot/workers.rb', line 79
def load_application_initializers
Dir[File.join(WarpDrive::Path.config.initializers.to_s, '**', '*.rb')].sort.each do |initializer|
initializer = File.expand_path(initializer)
load(initializer)
end
end
|
#load_assets ⇒ Object
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/warp_drive/boot/workers.rb', line 104
def load_assets
Dir.glob(File.join(WarpDrive::ROOT, 'public', '**', 'warp_drive', '**', '*.*')).sort.each do |f|
f.match(/public\/(.*warp_drive)/)
base_path = $1
rails_path = File.join(RAILS_ROOT, 'public', base_path)
FileUtils.rm_rf(rails_path, :verbose => false) if File.exists?(rails_path)
f.match(/(^.+public\/.*warp_drive)/)
begin
FileUtils.ln_sf($1, rails_path)
rescue Exception => e
end
end
end
|
#load_gems ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/warp_drive/boot/workers.rb', line 17
def load_gems
begin
require('gemtronics')
sr_gem_path = WarpDrive::Path.config.gemtronics.rb
Gemtronics.load(sr_gem_path) if File.exists?(sr_gem_path)
local_path = File.join(RAILS_ROOT, 'config', 'gemtronics.rb')
Gemtronics.load(local_path) if File.exists?(local_path)
Gemtronics.require_gems(RAILS_ENV, :verbose => false)
rescue Exception => e
puts "Problems loading Gemtronics: #{e.message}"
puts "This probably means you aren't using Gemtronics."
end
end
|
#load_plugins ⇒ Object
4
5
6
|
# File 'lib/warp_drive/boot/workers.rb', line 4
def load_plugins
Rails.configuration.plugin_paths << WarpDrive::Path.vendor.plugins.to_s
end
|
#load_rake_tasks ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/warp_drive/boot/workers.rb', line 92
def load_rake_tasks
require 'rake'
Dir.glob(File.join(WarpDrive::Path.lib.tasks.to_s, '**', '*.*')).sort.each do |task|
load File.expand_path(task) unless task.match(/\/private\//)
end
Dir.glob(File.join(WarpDrive::Path.vendor.plugins.to_s, '*')).sort.each do |plugin|
Dir.glob(File.join(plugin, 'tasks', '**', '*.*')).sort.each do |task|
load File.expand_path(task) unless task.match(/\/private\//)
end
end
end
|
#load_view_paths ⇒ Object
38
39
40
41
42
|
# File 'lib/warp_drive/boot/workers.rb', line 38
def load_view_paths
ActionController::Base.view_paths = [ActionController::Base.view_paths,
WarpDrive::Path.app.views.to_s].flatten
ActionMailer::Base.view_paths = ActionController::Base.view_paths
end
|