erp_rules 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/app/models/customer_txn_context.rb +11 -0
- data/app/models/environment_txn_context.rb +11 -0
- data/app/models/search_txn_context.rb +11 -0
- data/lib/erp_rules/engine.rb +14 -0
- data/lib/erp_rules/extensions/active_record/acts_as_business_rule.rb +30 -0
- data/lib/erp_rules/extensions/active_record/acts_as_search_filter.rb +28 -0
- data/lib/erp_rules/extensions/active_record/has_rule_context.rb +31 -0
- data/lib/erp_rules/extensions.rb +3 -0
- data/lib/erp_rules/rules_engine/context.rb +59 -31
- data/lib/erp_rules/rules_engine/context_builder.rb +70 -0
- data/lib/erp_rules/rules_engine/pricing_engine.rb +18 -0
- data/lib/erp_rules/rules_engine/ruleby/engine.rb +24 -0
- data/lib/erp_rules/rules_engine/rules_facade.rb +42 -42
- data/lib/erp_rules/rules_engine.rb +4 -1
- data/lib/erp_rules/search/search_base.rb +64 -0
- data/lib/erp_rules/version.rb +7 -1
- data/lib/erp_rules.rb +6 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/lib/erp_rules/extensions/active_record/acts_as_business_rule_spec.rb +20 -0
- data/spec/lib/erp_rules/extensions/active_record/acts_as_search_filter_spec.rb +12 -0
- data/spec/lib/erp_rules/extensions/active_record/has_rule_context_spec.rb +29 -0
- data/spec/lib/erp_rules/rules_engine/context_builder_spec.rb +5 -0
- data/spec/lib/erp_rules/rules_engine/context_spec.rb +64 -0
- data/spec/lib/erp_rules/rules_engine/ruleby/engine_spec.rb +26 -0
- data/spec/lib/erp_rules/rules_engine/rules_facade_spec.rb +29 -0
- data/spec/spec_helper.rb +60 -0
- metadata +104 -16
data/lib/erp_rules/engine.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
module ErpRules
|
2
|
+
require "erp_base_erp_svcs"
|
2
3
|
class Engine < Rails::Engine
|
3
4
|
isolate_namespace ErpRules
|
5
|
+
|
6
|
+
ActiveSupport.on_load :active_record do
|
7
|
+
include ErpRules::Extensions::ActiveRecord::HasRuleContext
|
8
|
+
include ErpRules::Extensions::ActiveRecord::ActsAsBusinessRule
|
9
|
+
include ErpRules::Extensions::ActiveRecord::ActsAsSearchFilter
|
10
|
+
end
|
11
|
+
|
12
|
+
#TODO
|
13
|
+
#this will be removed once rails 3.2 adds the ability to set the order of engine loading
|
14
|
+
engine = self
|
15
|
+
config.to_prepare do
|
16
|
+
ErpBaseErpSvcs.register_compass_ae_engine(engine)
|
17
|
+
end
|
4
18
|
end
|
5
19
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsBusinessRule
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def acts_as_business_rule
|
11
|
+
extend ActsAsBusinessRule::SingletonMethods
|
12
|
+
include ActsAsBusinessRule::InstanceMethods
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module InstanceMethods
|
17
|
+
def is_match? ctx
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
module SingletonMethods
|
23
|
+
def get_matches! ctx
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsSearchFilter
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_search_filter
|
12
|
+
extend ActsAsSearchFilter::SingletonMethods
|
13
|
+
include ActsAsSearchFilter::InstanceMethods
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
end
|
19
|
+
|
20
|
+
module SingletonMethods
|
21
|
+
def get_search_filters ctx
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
#this module will be mixed into models in order
|
5
|
+
#to construct their execution context
|
6
|
+
module HasRuleContext
|
7
|
+
def self.included(base)
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def has_rule_context
|
13
|
+
extend HasRuleContext::SingletonMethods
|
14
|
+
include HasRuleContext::InstanceMethods
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module InstanceMethods
|
19
|
+
|
20
|
+
def get_context()
|
21
|
+
#self.find_by_internal_identifier(iid)
|
22
|
+
attributes
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module SingletonMethods
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,37 +1,65 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
1
3
|
module ErpRules
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module RulesEngine
|
5
|
+
##
|
6
|
+
#OpenStruct is part of ruby stdlib
|
7
|
+
#This class adds methods to allow hash-like
|
8
|
+
#behavior
|
9
|
+
class Context < OpenStruct
|
10
|
+
|
11
|
+
def initialize(hash=nil)
|
12
|
+
if hash
|
13
|
+
hash.each do |k,v|
|
14
|
+
if v.class == Hash
|
15
|
+
result = ErpRules::RulesEngine::Context.new(v)
|
16
|
+
hash[k] = result
|
17
|
+
elsif v.class == Array
|
18
|
+
v.map! do |item|
|
19
|
+
#ostruct requires objects passed to it on the constructr
|
20
|
+
#to support #each
|
21
|
+
if item.is_a? Enumerable
|
22
|
+
ErpRules::RulesEngine::Context.new(item)
|
23
|
+
else
|
24
|
+
item
|
25
|
+
end
|
26
|
+
end
|
27
|
+
#end Array case
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
super(hash)
|
32
|
+
end
|
5
33
|
|
6
|
-
|
7
|
-
|
8
|
-
|
34
|
+
def [](key)
|
35
|
+
send(key)
|
36
|
+
end
|
9
37
|
|
10
|
-
|
11
|
-
|
12
|
-
|
38
|
+
##
|
39
|
+
#This will set a method on the struct
|
40
|
+
#using array syntax.
|
41
|
+
#Trying to set the argument in eval led to an error,
|
42
|
+
#hence the 'send' call following it.
|
43
|
+
def []=(key, *args)
|
44
|
+
arg = args[0]
|
45
|
+
eval("#{key} = nil", binding)
|
13
46
|
|
14
|
-
|
15
|
-
|
16
|
-
|
47
|
+
if arg.class == Hash
|
48
|
+
send("#{key}=", ErpRules::RulesEngine::Context.new(arg))
|
49
|
+
else
|
50
|
+
send("#{key}=", arg)
|
51
|
+
end
|
52
|
+
end
|
17
53
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
54
|
+
#need this method in order to mimic []= behavior
|
55
|
+
#using the method/attr syntax of OpenStruct
|
56
|
+
def method_missing(mid, *args)
|
57
|
+
if args[0].class == Hash
|
58
|
+
args[0] = ErpRules::RulesEngine::Context.new(args[0])
|
59
|
+
end
|
60
|
+
super(mid, *args)
|
61
|
+
end
|
25
62
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
elsif self.values_hash.has_key?(name)
|
30
|
-
return self.values_hash[name]
|
31
|
-
else
|
32
|
-
super
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module RulesEngine
|
3
|
+
class ContextBuilder
|
4
|
+
|
5
|
+
@facts = nil
|
6
|
+
@execution_context = nil
|
7
|
+
|
8
|
+
def initialize(facts)
|
9
|
+
@facts = facts
|
10
|
+
end
|
11
|
+
|
12
|
+
def build_execution_context(options={})
|
13
|
+
if options[:only].blank?
|
14
|
+
execution_context = {
|
15
|
+
:environment_context => self.environment_context(),
|
16
|
+
:search_context => self.search_context(),
|
17
|
+
:customer_context => self.customer_context()
|
18
|
+
}
|
19
|
+
else
|
20
|
+
execution_context = {}
|
21
|
+
options[:only].each do |context|
|
22
|
+
execution_context[context] = self.send(context)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
ErpRules::RulesEngine::Context.new execution_context
|
27
|
+
end
|
28
|
+
|
29
|
+
def persist_context(txn_type, txn_sub_type)
|
30
|
+
unless @execution_context.nil?
|
31
|
+
search_txn = SearchTxn.new
|
32
|
+
search_txn.biz_txn_event = BizTxnEvent.new
|
33
|
+
search_txn.biz_txn_event.biz_txn_type = BizTxnType.find_by_type_and_subtype(txn_type,txn_sub_type)
|
34
|
+
search_txn.biz_txn_event.description = "#{txn_type} , #{txn_sub_type}"
|
35
|
+
|
36
|
+
build_and_save_context(SearchTxnContext, @execution_context[:search].to_json, search_txn.biz_txn_event) unless @execution_context[:search].nil?
|
37
|
+
build_and_save_context(CustomerTxnContext, @execution_context[:customer].to_json, search_txn.biz_txn_event) unless @execution_context[:customer].nil?
|
38
|
+
build_and_save_context(EnvironmentTxnContext, @execution_context[:environment].to_json, search_txn.biz_txn_event) unless @execution_context[:environment].nil?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def search_context()
|
43
|
+
logger.warn "ContextBuilder.search_context() is an abstract method"
|
44
|
+
end
|
45
|
+
|
46
|
+
def customer_context()
|
47
|
+
end
|
48
|
+
|
49
|
+
def environment_context()
|
50
|
+
env_txn_context = {
|
51
|
+
:time => @facts[:time],
|
52
|
+
:user_agent => @facts[:user_agent],
|
53
|
+
:url => @facts[:url],
|
54
|
+
:remote_ip => @facts[:remote_ip]
|
55
|
+
}
|
56
|
+
env_txn_context
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_and_save_context(context_klass, json, biz_txn_event)
|
60
|
+
txn_context = context_klass.new
|
61
|
+
txn_context.base_txn_context = BaseTxnContext.new
|
62
|
+
txn_context.base_txn_context.biz_txn_event = biz_txn_event
|
63
|
+
txn_context.context = json
|
64
|
+
txn_context.save
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module RulesEngine
|
3
|
+
class PricingEngine
|
4
|
+
|
5
|
+
def initialize()
|
6
|
+
end
|
7
|
+
|
8
|
+
def price_products(execution_context)
|
9
|
+
execution_context[:product_context][:products].each do |product|
|
10
|
+
pricing_plan = PricingPlan.find_by_internal_identifier('default')
|
11
|
+
product[:price] = pricing_plan.get_price()
|
12
|
+
end
|
13
|
+
|
14
|
+
execution_context
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'ruleby'
|
2
|
+
module ErpRules
|
3
|
+
module RulesEngine
|
4
|
+
module Ruleby
|
5
|
+
#Adapter to invoke the Ruleby engine with a rulebook.
|
6
|
+
#Intended to be used with the RulesFacade class
|
7
|
+
class Engine
|
8
|
+
extend ::Ruleby
|
9
|
+
|
10
|
+
def self.invoke(rule_book, context)
|
11
|
+
engine :engine do |e|
|
12
|
+
rule_book.new(e).rules
|
13
|
+
|
14
|
+
e.assert context
|
15
|
+
e.match
|
16
|
+
e.retract context
|
17
|
+
end
|
18
|
+
context
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,48 +1,48 @@
|
|
1
1
|
module ErpRules
|
2
|
-
|
3
|
-
|
2
|
+
module RulesEngine
|
3
|
+
class RulesFacade
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
# get the configured rule engine and invoke
|
6
|
+
def invoke(ruleset, context, rules_engine_klass)
|
7
|
+
t_start= Time.new
|
8
|
+
#get the directives
|
9
|
+
directivesMap=context[:directives]
|
10
|
+
# here we add in any global directives
|
11
|
+
directivesMap=Hash.new if(directivesMap==nil)
|
12
|
+
# suppress execution context return
|
13
|
+
#(we do this for performance reasons since the execution ctx isnt altered
|
14
|
+
directivesMap[:suppress_execution_context_return]=true
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
# add the directives map to the context
|
17
|
+
context[:directives]=directivesMap;
|
18
|
+
## now we invoke the rule facade
|
19
|
+
Rails.logger.debug("Invoking RulesFacade")
|
20
|
+
Rails.logger.debug("Ruleset:#{ruleset}")
|
21
|
+
Rails.logger.debug("context:#{context}")
|
22
|
+
#get the name of the rule engine
|
23
|
+
Rails.logger.debug("RULE CLASS : #{rules_engine_klass}")
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#invoke the rule engine
|
32
|
-
result=rule_engine.invoke(ruleset,context)
|
33
|
-
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
34
|
-
Rails.logger.debug("RULE ENGINE :#{rule_engine}")
|
35
|
-
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
36
|
-
Rails.logger.debug("INVOKE RESULTS:"+result.to_yaml)
|
37
|
-
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
38
|
-
|
39
|
-
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
40
|
-
t_end=Time.new
|
41
|
-
Rails.logger.debug("Rule invocation time:#{(t_end.to_f-t_start.to_f)} sec")
|
42
|
-
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
25
|
+
#we will use eval instead of Kernel.const_get since the rule engines
|
26
|
+
# should be namespaced
|
27
|
+
klass = (rules_engine_klass.is_a?(String)) ? eval(rules_engine_klass) : rules_engine_klass
|
28
|
+
# create an instance of its singleton
|
29
|
+
rule_engine = klass
|
43
30
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
31
|
+
#invoke the rule engine
|
32
|
+
result=rule_engine.invoke(ruleset,context)
|
33
|
+
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
34
|
+
Rails.logger.debug("RULE ENGINE :#{rule_engine}")
|
35
|
+
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
36
|
+
Rails.logger.debug("INVOKE RESULTS:"+result.to_yaml)
|
37
|
+
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
38
|
+
|
39
|
+
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
40
|
+
t_end=Time.new
|
41
|
+
Rails.logger.debug("Rule invocation time:#{(t_end.to_f-t_start.to_f)} sec")
|
42
|
+
Rails.logger.debug("\n------------------------------------------------------------------------------------------")
|
43
|
+
|
44
|
+
result
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
48
|
end
|
@@ -1,2 +1,5 @@
|
|
1
1
|
require 'erp_rules/rules_engine/context'
|
2
|
-
require 'erp_rules/rules_engine/rules_facade'
|
2
|
+
require 'erp_rules/rules_engine/rules_facade'
|
3
|
+
require 'erp_rules/rules_engine/context_builder'
|
4
|
+
require 'erp_rules/rules_engine/pricing_engine'
|
5
|
+
require 'erp_rules/rules_engine/rules_facade'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module ErpRules
|
2
|
+
module Search
|
3
|
+
class SearchBase
|
4
|
+
|
5
|
+
def search facts
|
6
|
+
return process_search_facts(facts)
|
7
|
+
end
|
8
|
+
|
9
|
+
#This is the vertical search method that will need to be implemented
|
10
|
+
#in the sub-class
|
11
|
+
def do_search ctx
|
12
|
+
raise "do_search needs to be implemented in the subclass"
|
13
|
+
end
|
14
|
+
|
15
|
+
#Perform any processing the facts passed by a search controller
|
16
|
+
def pre_process_facts facts
|
17
|
+
raise "pre_process_facts needs to be implemented in the subclass"
|
18
|
+
end
|
19
|
+
|
20
|
+
#This must return an object (class, hash, whatever) that is used by the
|
21
|
+
#rules engine as a sort of rule book.
|
22
|
+
def generate_rules ctx
|
23
|
+
raise "generate_rules must be implemented in the subclass"
|
24
|
+
end
|
25
|
+
|
26
|
+
def process_search_facts(facts, search_rules_klass, context_builder_klass=ErpRules::RulesEngine::ContextBuilder)
|
27
|
+
|
28
|
+
# breaking out Orange Lake search logic into a subclass
|
29
|
+
# this creates a requirement that this class be extended with a subclass containing pre_process_facts method
|
30
|
+
facts = pre_process_facts(facts)
|
31
|
+
|
32
|
+
# build the execution context for the rules engine
|
33
|
+
search_execution_context = create_search_execution_context(facts,
|
34
|
+
{:persistant => Constants::SEARCH_TXN_PERSISTANT,
|
35
|
+
:context_builder_klass => context_builder_klass})
|
36
|
+
|
37
|
+
ruleset = generate_rules ctx
|
38
|
+
#execute the reservation_search rules and get back some search filtering criteria
|
39
|
+
filters = ErpRules::RulesEngine::RulesFacade.new.invoke(ruleset, search_execution_context, search_rules_klass)
|
40
|
+
|
41
|
+
# breaking out Orange Lake search logic into a subclass
|
42
|
+
# this creates a requirement that this class be extended with a subclass containing vertical_search method
|
43
|
+
res_search_results, message = do_search(facts, filters)
|
44
|
+
|
45
|
+
return res_search_results, message
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_search_execution_context(facts, options={})
|
49
|
+
options[:persistant] = false if options[:persistant].nil?
|
50
|
+
|
51
|
+
# Get execution context
|
52
|
+
context_builder = options[:context_builder_klass].new(facts)
|
53
|
+
execution_context = context_builder.build_execution_context()
|
54
|
+
|
55
|
+
# If persistant, save to database
|
56
|
+
if options[:persistant]
|
57
|
+
context_builder.persist_context(self.class.to_s, facts[:search_params][:search_type])
|
58
|
+
end
|
59
|
+
|
60
|
+
return execution_context
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/erp_rules/version.rb
CHANGED
data/lib/erp_rules.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
require "erp_rules/version"
|
2
|
+
require 'erp_rules/rules_engine/context_builder'
|
3
|
+
require 'erp_rules/rules_engine/rules_facade'
|
4
|
+
require 'erp_rules/rules_engine/ruleby/engine'
|
1
5
|
require 'erp_rules/rules_engine'
|
6
|
+
require "erp_rules/extensions"
|
2
7
|
require "erp_rules/engine"
|
8
|
+
require "erp_base_erp_svcs"
|
3
9
|
|
4
10
|
module ErpRules
|
5
11
|
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require
|
6
|
+
require "erp_rules"
|
7
|
+
require "erp_tech_svcs"
|
8
|
+
require "erp_base_erp_svcs"
|
9
|
+
|
10
|
+
module Dummy
|
11
|
+
class Application < Rails::Application
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
13
|
+
# Application configuration should go into files in config/initializers
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
15
|
+
|
16
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
17
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
18
|
+
|
19
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
20
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
21
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
22
|
+
|
23
|
+
# Activate observers that should always be running.
|
24
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
25
|
+
|
26
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
27
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
28
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
29
|
+
|
30
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
31
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
32
|
+
# config.i18n.default_locale = :de
|
33
|
+
|
34
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
35
|
+
config.encoding = "utf-8"
|
36
|
+
|
37
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
38
|
+
config.filter_parameters += [:password]
|
39
|
+
|
40
|
+
# Enable the asset pipeline
|
41
|
+
config.assets.enabled = true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|