erp_base_erp_svcs 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -0
- data/app/models/category.rb +2 -1
- data/app/models/compass_ae_instance.rb +4 -4
- data/app/models/contact.rb +1 -1
- data/app/models/geo_country.rb +4 -3
- data/app/models/geo_zone.rb +3 -3
- data/db/migrate/20080805000020_base_erp_services.rb +0 -1
- data/lib/erp_base_erp_svcs/config.rb +4 -2
- data/lib/erp_base_erp_svcs/engine.rb +3 -1
- data/lib/erp_base_erp_svcs/extensions/active_record/to_hash.rb +39 -0
- data/lib/erp_base_erp_svcs/extensions.rb +2 -3
- data/lib/erp_base_erp_svcs/version.rb +7 -1
- data/lib/erp_base_erp_svcs.rb +89 -7
- data/lib/tasks/compass_backup.rake +9 -4
- data/spec/factories/basic.rb +3 -0
- metadata +243 -193
- data/README.rdoc +0 -2
- data/config/initializers/erp_base_erp_svcs.rb +0 -4
- data/lib/erp_base_erp_svcs/command.rb +0 -37
- data/lib/erp_base_erp_svcs/extensions/railties/engine.rb +0 -85
- data/lib/erp_base_erp_svcs/rails_template.rb +0 -93
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +0 -4820
@@ -1,85 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
Engine.instance_eval do
|
3
|
-
|
4
|
-
#forces rails to reload model extensions and framework extensions
|
5
|
-
def load_extensions
|
6
|
-
Rails::Application::Railties.engines.each do |engine|
|
7
|
-
module_name = engine.railtie_name.camelize
|
8
|
-
if ErpBaseErpSvcs::ENGINES.include?(module_name)
|
9
|
-
load_model_extensions(engine)
|
10
|
-
load_compass_framework_extensions(engine)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
load_root_compass_framework_extensions
|
15
|
-
end
|
16
|
-
|
17
|
-
def load_model_extensions(engine)
|
18
|
-
root_models_path = "#{Rails.root}/app/models/"
|
19
|
-
engine_path = engine.root.to_s
|
20
|
-
engine_models_path = "#{engine_path}/app/models/"
|
21
|
-
engine_extensions_path = "#{engine_models_path}extensions/"
|
22
|
-
|
23
|
-
begin
|
24
|
-
#get all files from this engines app/model directory
|
25
|
-
model_extension_files = Dir.entries(engine_extensions_path).map{|directory| directory}
|
26
|
-
#remove any .svn or .data files
|
27
|
-
model_extension_files.delete_if{|name| name =~ /^\./}
|
28
|
-
|
29
|
-
#Must use eval to run each extension so rails picks up the extension
|
30
|
-
model_extension_files.each do |filename|
|
31
|
-
#check if table exists
|
32
|
-
content = File.open(engine_extensions_path + filename) { |f| f.read }
|
33
|
-
class_name = filename[0..-4]
|
34
|
-
#if tables.include?(class_name.tableize)
|
35
|
-
eval(IO.read(engine_extensions_path + filename), binding, engine_extensions_path + filename)
|
36
|
-
#end
|
37
|
-
end
|
38
|
-
end if File.directory? engine_extensions_path
|
39
|
-
|
40
|
-
begin
|
41
|
-
#get all files from this engines app/model directory
|
42
|
-
model_files = Dir.entries(engine_models_path).map{|directory| directory}
|
43
|
-
#remove any .svn or .data files
|
44
|
-
model_files.delete_if{|name| name =~ /^\./}
|
45
|
-
#exclude the extension directory
|
46
|
-
model_files.delete_if{|name| name == "extensions"}
|
47
|
-
|
48
|
-
model_files.each do |filename|
|
49
|
-
|
50
|
-
class_name = filename[0..-4]
|
51
|
-
klass = class_name.camelize
|
52
|
-
|
53
|
-
#if there is a model in {rails_root}/app/models it needs to be reloaded.
|
54
|
-
#used to turn a class declaration into a class eval
|
55
|
-
if FileTest.exists?(root_models_path + filename)
|
56
|
-
content = File.open(engine_models_path + filename) { |f| f.read }
|
57
|
-
#make sure this class extends ActiveRecord::Base
|
58
|
-
#we only want to do this for ActiveRecord models
|
59
|
-
if content.include? '< ActiveRecord::Base'
|
60
|
-
#if tables.include?(class_name.tableize)
|
61
|
-
content.gsub!("class #{klass} < ActiveRecord::Base", "#{klass}.class_eval do")
|
62
|
-
eval(content, binding)
|
63
|
-
#end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end if File.directory? engine_models_path
|
68
|
-
end
|
69
|
-
|
70
|
-
def load_compass_framework_extensions(engine)
|
71
|
-
if File.directory? File.join(engine.root,"lib",engine.railtie_name,"extensions/compass")
|
72
|
-
Dir[engine.root + "lib/#{engine.railtie_name}/extensions/compass/**/*.rb"].each do |file|
|
73
|
-
load file
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def load_root_compass_framework_extensions
|
79
|
-
Dir[Rails.root + "lib/#{Rails.configuration.erp_base_erp_svcs.compass_ae_extensions_directory}/*.rb"].each do |file|
|
80
|
-
load file
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
def patch_file(path, current, insert, options = {})
|
2
|
-
options = {
|
3
|
-
:patch_mode => :insert_after
|
4
|
-
}.merge(options)
|
5
|
-
|
6
|
-
old_text = current
|
7
|
-
new_text = patch_string(current, insert, options[:patch_mode])
|
8
|
-
|
9
|
-
content = File.open(path) { |f| f.read }
|
10
|
-
content.gsub!(old_text, new_text) unless content =~ /#{Regexp.escape(insert)}/mi
|
11
|
-
File.open(path, 'w') { |f| f.puts(content) }
|
12
|
-
end
|
13
|
-
|
14
|
-
def append_file(path, content)
|
15
|
-
File.open(path, 'a') { |f| f.puts(content) }
|
16
|
-
end
|
17
|
-
|
18
|
-
def patch_string(current, insert, mode = :insert_after)
|
19
|
-
case mode
|
20
|
-
when :change
|
21
|
-
"#{insert}"
|
22
|
-
when :insert_after
|
23
|
-
"#{current}\n#{insert}"
|
24
|
-
when :insert_before
|
25
|
-
"#{insert}\n#{current}"
|
26
|
-
else
|
27
|
-
patch_string(current, insert, :insert_after)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
#
|
31
|
-
#File.unlink 'public/index.html' rescue Errno::ENOENT
|
32
|
-
#
|
33
|
-
#patch_file 'config/initializers/session_store.rb',
|
34
|
-
#"# ActionController::Base.session_store = :active_record_store",
|
35
|
-
#" ActionController::Base.session_store = :active_record_store",
|
36
|
-
#:patch_mode => :change
|
37
|
-
#
|
38
|
-
#patch_file 'config/routes.rb',
|
39
|
-
#"# match ':controller(/:action(/:id(.:format)))'cd",
|
40
|
-
#" mount ErpApp::Engine => '/erp_app'
|
41
|
-
# mount RailsDbAdmin::Engine => '/rails_db_admin'
|
42
|
-
# mount Knitkit::Engine => '/knitkit'
|
43
|
-
# mount ErpTechSvcs::Engine => '/erp_tech_svcs'
|
44
|
-
# mount Console::Engine => '/console'#",
|
45
|
-
#:patch_mode => :insert_after
|
46
|
-
#
|
47
|
-
#patch_file 'config/environments/production.rb',
|
48
|
-
#" config.serve_static_assets = false",
|
49
|
-
#" config.serve_static_assets = true",
|
50
|
-
#:patch_mode => :change
|
51
|
-
#
|
52
|
-
#append_file 'config/environment.rb',
|
53
|
-
#"
|
54
|
-
#ActionMailer::Base.delivery_method = :smtp
|
55
|
-
#ActionMailer::Base.smtp_settings = {
|
56
|
-
# :address => '127.0.0.1',
|
57
|
-
# :port => 25
|
58
|
-
#}#"
|
59
|
-
|
60
|
-
#append_file 'GemFile',
|
61
|
-
#"
|
62
|
-
#gem 'erp_base_erp_svcs', :path => '../compass_agile_enterprise/erp_base_erp_svcs'
|
63
|
-
#gem 'erp_dev_svcs', :path => '../compass_agile_enterprise/erp_dev_svcs'
|
64
|
-
#gem 'erp_tech_svcs', :path => '../compass_agile_enterprise/erp_tech_svcs'
|
65
|
-
#gem 'erp_app', :path => '../compass_agile_enterprise/erp_app'
|
66
|
-
#gem 'erp_forms', :path => '../compass_agile_enterprise/erp_forms'
|
67
|
-
#gem 'knitkit', :path => '../compass_agile_enterprise/knitkit'
|
68
|
-
#gem 'rails_db_admin', :path => '../compass_agile_enterprise/rails_db_admin'
|
69
|
-
#gem 'console', :path => '../compass_agile_enterprise/console'
|
70
|
-
#"
|
71
|
-
|
72
|
-
#puts <<-end
|
73
|
-
#
|
74
|
-
#Thanks for installing Compass AE!
|
75
|
-
#
|
76
|
-
#We've performed the following tasks:
|
77
|
-
#
|
78
|
-
#* created a fresh Rails app
|
79
|
-
#* patched config/environment.rb
|
80
|
-
#* patched config/initializers/session_store.rb
|
81
|
-
#* added core Compass AE gems to GemFile
|
82
|
-
#
|
83
|
-
#You can now do:
|
84
|
-
#
|
85
|
-
#rails s
|
86
|
-
#open http://localhost:3000/erp_app/desktop/
|
87
|
-
#
|
88
|
-
#You should see compass Single Sign On screen.
|
89
|
-
#username: admin
|
90
|
-
#passwrod: password
|
91
|
-
#enjoy!
|
92
|
-
|
93
|
-
#end
|
data/spec/dummy/db/spec.sqlite3
DELETED
Binary file
|