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
|
# File 'lib/requirejs/rails/config.rb', line 10
def initialize(app=Rails.application)
super
self.manifest = nil
self.tmp_dir = Rails.root + 'tmp'
self.bin_dir = Pathname.new(__FILE__+'/../../../../bin').cleanpath
self.source_dir = self.tmp_dir + 'assets'
self.target_dir = Rails.root + 'public/assets'
self.rjs_path = self.bin_dir+'r.js'
self.driver_template_path = Pathname.new(__FILE__+'/../rjs_driver.js.erb').cleanpath
self.driver_path = self.tmp_dir + 'rjs_driver.js'
self.user_config_file = Pathname.new(app.paths["config"].first)+'requirejs.yml'
if self.user_config_file.exist?
self.user_config = YAML.load(self.user_config_file.read)
else
self.user_config = {}
end
self.run_config = {
"baseUrl" => "/assets",
"modules" => [ { 'name' => 'application' } ]
}
self.run_config.merge!(self.user_config)
self.run_config_json = self.run_config.to_json
self.build_config = self.run_config.merge "baseUrl" => source_dir.to_s
self.build_config.merge!(self.user_config)
end
|