erp_commerce 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/GPL-3-LICENSE +674 -0
  2. data/README.rdoc +2 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/javascripts/erp_commerce/application.js +9 -0
  5. data/app/assets/stylesheets/erp_commerce/application.css +7 -0
  6. data/app/controllers/erp_commerce/application_controller.rb +4 -0
  7. data/app/helpers/erp_commerce/application_helper.rb +4 -0
  8. data/app/models/credit_card.rb +54 -0
  9. data/app/models/credit_card_account.rb +4 -0
  10. data/app/models/credit_card_account_party_role.rb +8 -0
  11. data/app/models/credit_card_account_purpose.rb +6 -0
  12. data/app/models/credit_card_token.rb +12 -0
  13. data/app/models/extensions/charge_line.rb +3 -0
  14. data/app/models/extensions/currency.rb +3 -0
  15. data/app/models/extensions/financial_txn.rb +3 -0
  16. data/app/models/extensions/order_txn.rb +3 -0
  17. data/app/models/extensions/party.rb +21 -0
  18. data/app/models/extensions/product_instance.rb +5 -0
  19. data/app/models/extensions/product_type.rb +3 -0
  20. data/app/models/fee.rb +7 -0
  21. data/app/models/fee_type.rb +4 -0
  22. data/app/models/payment.rb +38 -0
  23. data/app/models/payment_gateway.rb +4 -0
  24. data/app/models/payment_gateway_action.rb +2 -0
  25. data/app/models/price.rb +25 -0
  26. data/app/models/price_component.rb +8 -0
  27. data/app/models/price_component_type.rb +3 -0
  28. data/app/models/pricing_plan.rb +37 -0
  29. data/app/models/pricing_plan_assignment.rb +6 -0
  30. data/app/models/pricing_plan_component.rb +36 -0
  31. data/app/models/valid_price_plan_component.rb +8 -0
  32. data/app/views/layouts/erp_commerce/application.html.erb +14 -0
  33. data/app/widgets/orders/base.rb +40 -0
  34. data/app/widgets/orders/javascript/orders.js +11 -0
  35. data/app/widgets/orders/views/index.html.erb +63 -0
  36. data/app/widgets/product_catalog/base.rb +56 -0
  37. data/app/widgets/product_catalog/javascript/product_catalog.js +62 -0
  38. data/app/widgets/product_catalog/views/add_to_cart.html.erb +10 -0
  39. data/app/widgets/product_catalog/views/index.html.erb +69 -0
  40. data/app/widgets/product_catalog/views/show.html.erb +23 -0
  41. data/app/widgets/shopping_cart/base.rb +178 -0
  42. data/app/widgets/shopping_cart/javascript/shopping_cart.js +107 -0
  43. data/app/widgets/shopping_cart/views/cart_items.html.erb +83 -0
  44. data/app/widgets/shopping_cart/views/confirmation.html.erb +10 -0
  45. data/app/widgets/shopping_cart/views/demographics.html.erb +142 -0
  46. data/app/widgets/shopping_cart/views/login.html.erb +1 -0
  47. data/app/widgets/shopping_cart/views/payment.html.erb +81 -0
  48. data/app/widgets/shopping_cart/views/price_summary.html.erb +4 -0
  49. data/config/routes.rb +2 -0
  50. data/db/data_migrations/20101011152441_payment_gateway_actions.rb +27 -0
  51. data/db/migrate/20100823174238_erp_commerce_base.rb +174 -0
  52. data/db/migrate/20100913154134_setup_payments.rb +57 -0
  53. data/db/migrate/20101103132342_pricing_migrations.rb +169 -0
  54. data/db/migrate/20110921150854_create_fees.rb +50 -0
  55. data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +66 -0
  56. data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +34 -0
  57. data/lib/erp_commerce/active_merchant_wrappers.rb +2 -0
  58. data/lib/erp_commerce/engine.rb +15 -0
  59. data/lib/erp_commerce/extensions/active_record/acts_as_fee.rb +64 -0
  60. data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +57 -0
  61. data/lib/erp_commerce/extensions.rb +2 -0
  62. data/lib/erp_commerce/order_helper.rb +254 -0
  63. data/lib/erp_commerce/version.rb +3 -0
  64. data/lib/erp_commerce.rb +8 -0
  65. data/lib/tasks/erp_commerce_tasks.rake +4 -0
  66. data/spec/dummy/Rakefile +7 -0
  67. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  68. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  69. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  70. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  71. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  72. data/spec/dummy/config/application.rb +49 -0
  73. data/spec/dummy/config/boot.rb +10 -0
  74. data/spec/dummy/config/database.yml +8 -0
  75. data/spec/dummy/config/environment.rb +5 -0
  76. data/spec/dummy/config/environments/spec.rb +27 -0
  77. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  78. data/spec/dummy/config/initializers/inflections.rb +10 -0
  79. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  80. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  81. data/spec/dummy/config/initializers/session_store.rb +8 -0
  82. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  83. data/spec/dummy/config/locales/en.yml +5 -0
  84. data/spec/dummy/config/routes.rb +3 -0
  85. data/spec/dummy/config.ru +4 -0
  86. data/spec/dummy/public/404.html +26 -0
  87. data/spec/dummy/public/422.html +26 -0
  88. data/spec/dummy/public/500.html +26 -0
  89. data/spec/dummy/public/favicon.ico +0 -0
  90. data/spec/dummy/script/rails +6 -0
  91. data/spec/models/credit_card_account_party_role_spec.rb +11 -0
  92. data/spec/models/credit_card_account_purpose_spec.rb +11 -0
  93. data/spec/models/credit_card_account_spec.rb +11 -0
  94. data/spec/models/credit_card_spec.rb +11 -0
  95. data/spec/models/fee_spec.rb +11 -0
  96. data/spec/models/fee_type_spec.rb +11 -0
  97. data/spec/models/payment_gateway_action_spec.rb +11 -0
  98. data/spec/models/payment_gateway_spec.rb +11 -0
  99. data/spec/models/payment_spec.rb +11 -0
  100. data/spec/models/price_component_spec.rb +11 -0
  101. data/spec/models/price_component_type_spec.rb +11 -0
  102. data/spec/models/price_spec.rb +11 -0
  103. data/spec/models/pricing_plan_assignment_spec.rb +11 -0
  104. data/spec/models/pricing_plan_component_spec.rb +11 -0
  105. data/spec/models/pricing_plan_spec.rb +11 -0
  106. data/spec/models/valid_price_plan_component_spec.rb +11 -0
  107. data/spec/spec_helper.rb +60 -0
  108. metadata +285 -0
@@ -0,0 +1,64 @@
1
+ module ErpCommerce
2
+ module Extensions
3
+ module ActiveRecord
4
+ module ActsAsFee
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ def acts_as_fee
11
+ extend ActsAsFee::SingletonMethods
12
+ include ActsAsFee::InstanceMethods
13
+
14
+ after_initialize :new_fee
15
+ after_update :save_fee
16
+ after_save :save_fee
17
+ after_destroy :destroy_fee
18
+
19
+ has_one :fee, :as => :fee_record
20
+
21
+ #from Fee
22
+ [ :money, :money=,
23
+ :fee_type, :fee_type=,
24
+ :description, :description=,
25
+ :start_date, :start_date=,
26
+ :end_date, :end_date=,
27
+ :external_identifier, :external_identifier=,
28
+ :external_id_source, :external_id_source=,
29
+ :created_at,
30
+ :updated_at
31
+ ].each { |m| delegate m, :to => :fee }
32
+
33
+ end
34
+
35
+ end
36
+
37
+ module SingletonMethods
38
+ end
39
+
40
+ module InstanceMethods
41
+ def fee
42
+ self.fee
43
+ end
44
+
45
+ def new_fee
46
+ if self.new_record? && self.fee == nil
47
+ self.fee = Fee.new
48
+ end
49
+ end
50
+
51
+ def save_fee
52
+ self.fee.save_with_validation!
53
+ end
54
+
55
+ def destroy_fee
56
+ if self.fee && !self.fee.frozen?
57
+ self.fee.destroy
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,57 @@
1
+ module ErpCommerce
2
+ module Extensions
3
+ module ActiveRecord
4
+ module ActsAsPriceable
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+
11
+ def acts_as_priceable
12
+ extend ActsAsPriceable::SingletonMethods
13
+ include ActsAsPriceable::InstanceMethods
14
+
15
+ has_many :pricing_plan_assignments, :as => :priceable_item
16
+ has_many :pricing_plans, :through => :pricing_plan_assignments, :dependent => :destroy
17
+ has_many :prices, :as => :priced_item, :dependent => :destroy
18
+
19
+ end
20
+ end
21
+
22
+ module SingletonMethods
23
+ end
24
+
25
+ module InstanceMethods
26
+ def get_default_price
27
+ self.pricing_plans.first.get_price
28
+ end
29
+
30
+ def get_current_simple_amount_with_currency
31
+ amount = nil
32
+ plan = get_current_simple_plan
33
+ unless plan.nil?
34
+ amount = help.number_to_currency(plan.money_amount, :unit => plan.currency.symbol)
35
+ end
36
+ amount
37
+ end
38
+
39
+ def get_current_simple_plan
40
+ self.pricing_plans.find(:first,
41
+ :conditions => ['is_simple_amount = ? and from_date <= ? and thru_date >= ?', true, Date.today, Date.today])
42
+ end
43
+
44
+ class Helper
45
+ include Singleton
46
+ include ActionView::Helpers::NumberHelper
47
+ end
48
+
49
+ def help
50
+ Helper.instance
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,2 @@
1
+ require 'erp_commerce/extensions/active_record/acts_as_fee'
2
+ require 'erp_commerce/extensions/active_record/acts_as_priceable'
@@ -0,0 +1,254 @@
1
+ module ErpCommerce
2
+ class OrderHelper
3
+ attr_accessor :widget
4
+ delegate :params, :session, :request, :logger, :current_user, :to => :widget
5
+
6
+ def initialize(widget)
7
+ self.widget = widget
8
+ end
9
+
10
+ def get_order(create=nil)
11
+ order = nil
12
+ unless session['order_txn_id'].nil?
13
+ order = OrderTxn.where('id = ?',session['order_txn_id']).first
14
+ order = create_order if order.nil?
15
+ else
16
+ order = create_order if create
17
+ end
18
+ order
19
+ end
20
+
21
+ #add a product type to cart
22
+ def add_to_cart(product_type)
23
+ order = get_order(true)
24
+
25
+ #see if we need to update quantity or create new line item
26
+ order_line_item = get_line_item_for_product_type(product_type)
27
+ if order_line_item.nil? || order_line_item.empty?
28
+ #create order line item
29
+ order_line_item = order.add_line_item(product_type)
30
+
31
+ #get pricing plan and create charge lines
32
+ pricing_plan = product_type.get_current_simple_plan
33
+ money = Money.create(
34
+ :description => pricing_plan.description,
35
+ :amount => pricing_plan.money_amount,
36
+ :currency => pricing_plan.currency)
37
+
38
+ charge_line = ChargeLine.create(
39
+ :charged_item => order_line_item,
40
+ :money => money,
41
+ :description => pricing_plan.description)
42
+ charge_line.save
43
+ order_line_item.charge_lines << charge_line
44
+ order.status = 'Items Added'
45
+ order.save
46
+ else
47
+ #update quantity
48
+ end
49
+ order
50
+ end
51
+
52
+ #set billing information
53
+ def set_demographic_info(params)
54
+ order = get_order
55
+
56
+ #if biz txn party roles have not been setup set them up
57
+ if order.root_txn.biz_txn_party_roles.nil? || order.root_txn.biz_txn_party_roles.empty?
58
+ setup_biz_txn_party_roles(order)
59
+ end
60
+
61
+ party = self.current_user.party
62
+
63
+ #set billing information on party
64
+ #get geo codes
65
+ geo_country = GeoCountry.find_by_iso_code_2(params[:bill_to_country])
66
+ geo_zone = GeoZone.find_by_zone_code(params[:bill_to_state])
67
+ party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.billing,
68
+ {
69
+ :address_line_1 => params[:bill_to_address_line_1],
70
+ :address_line_2 => params[:bill_to_address_line_2],
71
+ :city => params[:bill_to_city],
72
+ :state => geo_zone.zone_name,
73
+ :zip => params[:bill_to_postal_code],
74
+ :country => geo_country.name
75
+ })
76
+ billing_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.billing)
77
+ billing_postal_address.geo_country = geo_country
78
+ billing_postal_address.geo_zone = geo_zone
79
+ billing_postal_address.save
80
+
81
+ #set shipping information on party
82
+ #same as billing us billing info
83
+ if params[:ship_to_billing] == 'on'
84
+ #get geo codes
85
+ geo_country = GeoCountry.find_by_iso_code_2(params[:bill_to_country])
86
+ geo_zone = GeoZone.find_by_zone_code(params[:bill_to_state])
87
+ party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.shipping,
88
+ {
89
+ :address_line_1 => params[:bill_to_address_line_1],
90
+ :address_line_2 => params[:bill_to_address_line_2],
91
+ :city => params[:bill_to_city],
92
+ :state => geo_zone.zone_name,
93
+ :zip => params[:bill_to_postal_code],
94
+ :country => geo_country.name
95
+ })
96
+ shipping_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.shipping)
97
+ shipping_postal_address.geo_country = geo_country
98
+ shipping_postal_address.geo_zone = geo_zone
99
+ shipping_postal_address.save
100
+ else
101
+ #get geo codes
102
+ geo_country = GeoCountry.find_by_iso_code_2(params[:ship_to_country])
103
+ geo_zone = GeoZone.find_by_zone_code(params[:ship_to_state])
104
+ party.update_or_add_contact_with_purpose(PostalAddress, ContactPurpose.shipping,
105
+ {
106
+ :address_line_1 => params[:ship_to_address_line_1],
107
+ :address_line_2 => params[:ship_to_address_line_2],
108
+ :city => params[:ship_to_city],
109
+ :state => geo_zone.zone_name,
110
+ :zip => params[:ship_to_postal_code],
111
+ :country => geo_country.name
112
+ })
113
+ shipping_postal_address = party.find_contact_mechanism_with_purpose(PostalAddress, ContactPurpose.shipping)
114
+ shipping_postal_address.geo_country = geo_country
115
+ shipping_postal_address.geo_zone = geo_zone
116
+ shipping_postal_address.save
117
+ end
118
+
119
+ #set phone and email
120
+ party.update_or_add_contact_with_purpose(PhoneNumber, ContactPurpose.billing, {:phone_number => params[:bill_to_phone]})
121
+ party.update_or_add_contact_with_purpose(EmailAddress, ContactPurpose.billing, {:email_address => params[:bill_to_email]})
122
+
123
+ #set billing and shipping info on order
124
+ order.set_shipping_info(party)
125
+ order.set_billing_info(party)
126
+
127
+ #update status
128
+ order.status = 'Demographics Gathered'
129
+ order.save
130
+
131
+ order
132
+ end
133
+
134
+ #complete the order
135
+ def complete_order(params, charge_credit_card=true)
136
+ success = true
137
+ message = nil
138
+ order = get_order
139
+
140
+ if charge_credit_card
141
+ #make credit financial txns and payment txns
142
+ #create financial txn for order
143
+ financial_txn = create_financial_txns(order)
144
+ #fire the purchase method with the passed gatewaywrapper
145
+ result = financial_txn.purchase(
146
+ build_credit_card_hash(params),
147
+ ErpCommerce::ActiveMerchantWrappers::BrainTreeGatewayWrapper,
148
+ {:login => 'demo', :password => 'password'}
149
+ )
150
+ #make sure cedit card payment was successful
151
+ if result[:payment].nil? or !result[:payment].success
152
+ success = false
153
+ message = result[:message]
154
+ order.status = 'Credit Card Failed'
155
+ end
156
+ end
157
+
158
+ if success
159
+ order.status = 'Pending Shipment'
160
+ #update inventory counts
161
+ #should be moved to model somewhere
162
+ order.order_line_items.each do |oli|
163
+ inventory_entry = oli.product_type.inventory_entries.first
164
+ inventory_entry.number_available -= 1
165
+ inventory_entry.number_sold += 1
166
+ inventory_entry.save
167
+ end
168
+ #clear order from session
169
+ clear_order
170
+ end
171
+
172
+ order.save
173
+ return success, message, order
174
+ end
175
+
176
+ #remove line item
177
+ def remove_from_cart(order_line_item_id)
178
+ order = get_order
179
+
180
+ order.line_items.find(order_line_item_id).destroy
181
+
182
+ order
183
+ end
184
+
185
+ private
186
+
187
+ def get_line_item_for_product_type(product_type)
188
+ order = get_order(true)
189
+ order.line_items.select{|oli| oli.product_type == product_type.id}
190
+ end
191
+
192
+ def clear_order
193
+ session['order_txn_id'] = nil
194
+ end
195
+
196
+ def create_order
197
+ order = OrderTxn.create
198
+ order.status = 'Initialized'
199
+ order.order_number = (Time.now.to_i / (rand(100)+2)).round
200
+ order.save
201
+ session['order_txn_id'] = order.id
202
+ setup_biz_txn_party_roles(order) unless self.current_user.nil?
203
+ order
204
+ end
205
+
206
+ #sets up payor party role
207
+ def setup_biz_txn_party_roles(order)
208
+ payor_role = BizTxnPartyRoleType.find_by_internal_identifier('payor')
209
+ biz_txn_event = order.root_txn
210
+ tpr = BizTxnPartyRole.new
211
+ tpr.biz_txn_event = biz_txn_event
212
+ tpr.party = self.current_user.party
213
+ tpr.biz_txn_party_role_type = payor_role
214
+ tpr.save
215
+ end
216
+
217
+ #create financial_txn for charge lines
218
+ def create_financial_txns(order)
219
+ #total up all order line items charge lines
220
+ total_payment = 0
221
+ currency = nil
222
+ order.get_total_charges.each do |money|
223
+ total_payment += money.amount
224
+ currency = money.currency
225
+ end
226
+
227
+ financial_txn = FinancialTxn.create(:money => Money.create(:description => 'Order Payment', :amount => total_payment, :currency => currency))
228
+ financial_txn.description = 'Order Payment'
229
+ financial_txn.txn_type = BizTxnType.iid('payment_txn')
230
+ financial_txn.save
231
+
232
+ order.get_all_charge_lines.each do |charge_line|
233
+ charge_line.add_payment_txn(financial_txn)
234
+ charge_line.save
235
+ end
236
+
237
+ financial_txn
238
+ end
239
+
240
+ def build_credit_card_hash(params)
241
+ credit_card = {}
242
+
243
+ credit_card[:number] = params[:card_number]
244
+ credit_card[:exp_month] = params[:exp_month]
245
+ credit_card[:exp_year] = params[:exp_year]
246
+ credit_card[:cvvs] = params[:cvvs]
247
+ credit_card[:first_name] = params[:first_name]
248
+ credit_card[:last_name] = params[:last_name]
249
+
250
+ credit_card
251
+ end
252
+
253
+ end#ErpCommerce
254
+ end#OrderHelper
@@ -0,0 +1,3 @@
1
+ module ErpCommerce
2
+ VERSION = "3.0.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ require 'erp_commerce/active_merchant_wrappers'
2
+ require 'erp_commerce/extensions'
3
+ require "erp_commerce/engine"
4
+ require 'erp_commerce/order_helper'
5
+ require 'aasm'
6
+
7
+ module ErpCommerce
8
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :erp_commerce do
3
+ # # Task goes here
4
+ # end
@@ -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,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require "erp_base_erp_svcs"
7
+ require "erp_tech_svcs"
8
+ require "erp_app"
9
+ require "erp_agreements"
10
+ require "erp_txns_and_accts"
11
+ require "erp_products"
12
+ require "erp_orders"
13
+ require "erp_commerce"
14
+
15
+ module Dummy
16
+ class Application < Rails::Application
17
+ # Settings in config/environments/* take precedence over those specified here.
18
+ # Application configuration should go into files in config/initializers
19
+ # -- all .rb files in that directory are automatically loaded.
20
+
21
+ # Custom directories with classes and modules you want to be autoloadable.
22
+ # config.autoload_paths += %W(#{config.root}/extras)
23
+
24
+ # Only load the plugins named here, in the order given (default is alphabetical).
25
+ # :all can be used as a placeholder for all plugins not explicitly named.
26
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
27
+
28
+ # Activate observers that should always be running.
29
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
30
+
31
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
32
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
33
+ # config.time_zone = 'Central Time (US & Canada)'
34
+
35
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
36
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
37
+ # config.i18n.default_locale = :de
38
+
39
+ # Configure the default encoding used in templates for Ruby 1.9.
40
+ config.encoding = "utf-8"
41
+
42
+ # Configure sensitive parameters which will be filtered from the log file.
43
+ config.filter_parameters += [:password]
44
+
45
+ # Enable the asset pipeline
46
+ config.assets.enabled = true
47
+ end
48
+ end
49
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,8 @@
1
+ # Warning: The database defined as "test" will be erased and
2
+ # re-generated from your development database when you run "rake".
3
+ # Do not set this db to the same as development or production.
4
+ spec:
5
+ adapter: sqlite3
6
+ database: db/spec.sqlite3
7
+ pool: 5
8
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,27 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'ae0d58840f73a49e40850c9d815a6a135e169865cdb8721cec7f335a738af09f3483de0f99d7c131f8fdecf2d8b508f8fd5e2e33c8d0565dcc9030eadb227695'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActionController::Base.wrap_parameters :format => [:json]
8
+
9
+ # Disable root element in JSON by default.
10
+ if defined?(ActiveRecord)
11
+ ActiveRecord::Base.include_root_in_json = false
12
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount ErpCommerce::Engine => "/erp_commerce"
3
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>