erp_app 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,52 +17,55 @@ module ErpApp
17
17
  private
18
18
 
19
19
  def locate_resource_files(resource_type)
20
- engine_dirs = Rails::Application::Railties.engines.map{|p| p.config.root.to_s}
20
+ engine_dirs = Rails::Application::Railties.engines.map{|p| p.config.root.to_s}
21
21
  root_and_engines_dirs = ([Rails.root] | engine_dirs)
22
22
 
23
23
  application_files = []
24
- root_and_engines_dirs.each do |engine_dir|
25
- #get all files based on resource type we are loading for the given application type and application
26
- if File.exists? File.join(engine_dir,"public/#{resource_type}/erp_app/#{@app_type}/applications",@app_name)
27
- application_path = File.join(engine_dir,"public/#{resource_type}/erp_app/#{@app_type}/applications",@app_name,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
28
- application_files = application_files | Dir.glob(application_path)
29
- end
30
- end
31
- application_files = sort_files(application_files.collect{|file| File.basename(file)})
24
+ root_and_engines_dirs.each do |engine_dir|
25
+ #get all files based on resource type we are loading for the given application type and application
26
+ if File.exists? File.join(engine_dir,"public/#{resource_type}/erp_app/#{@app_type}/applications",@app_name)
27
+ application_path = File.join(engine_dir,"public/#{resource_type}/erp_app/#{@app_type}/applications",@app_name)
28
+ search_path = File.join(application_path,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
29
+ application_files = application_files | Dir.glob(search_path).collect{|path| path.gsub(application_path,'')}
30
+ end
31
+ end
32
+ application_files = sort_files(application_files)
32
33
 
33
- #make sure the base js file is loaded before all others
34
- if resource_type == 'javascripts' && (application_files.index{|x| x =~ /module.js/} || application_files.index{|x| x =~ /base.js/})
35
- index = (@app_type == 'desktop') ? application_files.index{|x| x =~ /module.js/} : application_files.index{|x| x =~ /base.js/}
36
- first_load_js = application_files[index]
37
- application_files.delete_at(index)
38
- application_files.push(first_load_js)
39
- application_files.reverse!
40
- end
41
- application_files.map!{|file| "erp_app/#{@app_type}/applications/#{@app_name}/#{file}"}
34
+ #make sure the base js file is loaded before all others
35
+ if resource_type == 'javascripts' && (application_files.index{|x| x =~ /module.js/} || application_files.index{|x| x =~ /base.js/})
36
+ index = (@app_type == 'desktop') ? application_files.index{|x| x =~ /module.js/} : application_files.index{|x| x =~ /base.js/}
37
+ first_load_js = application_files[index]
38
+ application_files.delete_at(index)
39
+ application_files.push(first_load_js)
40
+ application_files.reverse!
41
+ end
42
+ application_files.map!{|file| File.join("erp_app/#{@app_type}/applications/#{@app_name}",file)}
42
43
 
43
44
  #get any extensions from other engines
44
45
  engine_extension_files = []
45
- engine_dirs.each do |engine_dir|
46
- #get all files based on resource type we are loading for the given application type and application
47
- if File.exists? File.join(engine_dir,"public/#{resource_type}/extensions/compass_ae/erp_app/#{@app_type}/applications",@app_name)
48
- application_path = File.join(engine_dir,"public/#{resource_type}/extensions/compass_ae/erp_app/#{@app_type}/applications",@app_name,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
49
- engine_extension_files = engine_extension_files | Dir.glob(application_path)
50
- end
51
- end
52
- engine_extension_files = sort_files(engine_extension_files.collect{|file| File.basename(file)})
53
- engine_extension_files.map!{|file| "extensions/compass_ae/erp_app/#{@app_type}/applications/#{@app_name}/#{file}"}
46
+ engine_dirs.each do |engine_dir|
47
+ #get all files based on resource type we are loading for the given application type and application
48
+ if File.exists? File.join(engine_dir,"public/#{resource_type}/extensions/compass_ae/erp_app/#{@app_type}/applications",@app_name)
49
+ application_path = File.join(engine_dir,"public/#{resource_type}/extensions/compass_ae/erp_app/#{@app_type}/applications",@app_name)
50
+ search_path = File.join(application_path,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
51
+ engine_extension_files = engine_extension_files | Dir.glob(search_path).collect{|path| path.gsub(application_path,'')}
52
+ end
53
+ end
54
+ engine_extension_files = sort_files(engine_extension_files.collect{|file| File.basename(file)})
55
+ engine_extension_files.map!{|file| File.join("extensions/compass_ae/erp_app/#{@app_type}/applications/#{@app_name}",file)}
54
56
 
55
57
  #get any extension from root rails app
56
58
  root_extension_files = []
57
59
  if File.exists? File.join(Rails.root,"public/#{resource_type}/extensions/compass_ae/erp_app", @app_type, 'applications', @app_name)
58
- application_path = File.join(Rails.root,"public/#{resource_type}/extensions/compass_ae/erp_app", @app_type, 'applications', @app_name,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
59
- root_extension_files = root_extension_files | Dir.glob(application_path)
60
+ application_path = File.join(Rails.root,"public/#{resource_type}/extensions/compass_ae/erp_app", @app_type, 'applications', @app_name)
61
+ search_path = File.join(application_path,"**/*.#{(resource_type == 'javascripts') ? 'js' : 'css'}")
62
+ root_extension_files = root_extension_files | Dir.glob(search_path).collect{|path| path.gsub(application_path,'')}
60
63
  end
61
64
  root_extension_files = sort_files(root_extension_files.collect{|file| File.basename(file)})
62
- root_extension_files.map!{|file| "extensions/compass_ae/erp_app/#{@app_type}/applications/#{@app_name}/#{file}"}
65
+ root_extension_files.map!{|file| File.join("extensions/compass_ae/erp_app/#{@app_type}/applications/#{@app_name}",file)}
63
66
 
64
- (application_files + engine_extension_files + root_extension_files)
65
- end
67
+ (application_files + engine_extension_files + root_extension_files)
68
+ end
66
69
 
67
70
  end#DesktopOrganizerLoader
68
71
  end#ApplicationResourceLoader
@@ -2,7 +2,7 @@ module ErpApp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end