lib/artfully_ose/engine.rb in artfully_ose-1.1.0 vs lib/artfully_ose/engine.rb in artfully_ose-1.2.0.alpha.1
- old
+ new
@@ -1,14 +1,23 @@
module ArtfullyOse
class Engine < ::Rails::Engine
+
+ if Rails.env.test?
+ initializer 'artfully_ose.factories', :after => 'factory_girl.set_factory_paths' do
+ puts 'ArtfullyOse: Setting up additional FactoryGirl paths'
+ FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
+ end
+ end
+
initializer "artfully_ose.braintree_config" do |app|
puts "ArtfullyOse: Initializing Braintree config"
- BraintreeConfig = Struct.new(:merchant_id, :public_key, :private_key)
+ BraintreeConfig = Struct.new(:merchant_account_id, :merchant_id, :public_key, :private_key)
app.config.braintree = BraintreeConfig.new
- app.config.braintree.merchant_id = ENV['BRAINTREE_MERCHANT_ID']
- app.config.braintree.public_key = ENV['BRAINTREE_PUBLIC_KEY']
- app.config.braintree.private_key = ENV['BRAINTREE_PRIVATE_KEY']
+ app.config.braintree.merchant_account_id = ENV['BRAINTREE_MERCHANT_ACCOUNT_ID']
+ app.config.braintree.merchant_id = ENV['BRAINTREE_MERCHANT_ID']
+ app.config.braintree.public_key = ENV['BRAINTREE_PUBLIC_KEY']
+ app.config.braintree.private_key = ENV['BRAINTREE_PRIVATE_KEY']
end
initializer "artfully_ose.s3_config" do |app|
puts "ArtfullyOse: Initializing S3 config"
S3Config = Struct.new(:bucket, :access_key_id, :secret_access_key)
@@ -18,10 +27,11 @@
app.config.s3.secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
end
initializer "artfully_ose.payment_model_paths" do |app|
puts "ArtfullyOse: Initializing payment model paths"
+ puts config.root
app.config.payment_model_paths = []
app.config.payment_model_paths += Dir["#{config.root}/app/models/payments/*.rb"]
end
initializer "artfully_ose.discount_type_paths" do |app|
@@ -30,20 +40,34 @@
app.config.discount_type_paths += Dir["#{config.root}/app/models/discounts/*.rb"]
end
initializer "artfully_ose.google_analytics_config" do |app|
puts "ArtfullyOse: Initializing Google Analytics config"
- GoogleAnalytcsConfig = Struct.new(:account, :domain)
- app.config.google_analytics = GoogleAnalytcsConfig.new
- app.config.google_analytics.account = ENV['GA_ACCOUNT']
- app.config.google_analytics.domain = ENV['GA_DOMAIN']
+ GoogleAnalytcsConfig = Struct.new(:account, :storefront_account, :domain)
+ app.config.google_analytics = GoogleAnalytcsConfig.new
+ app.config.google_analytics.account = ENV['GA_ACCOUNT']
+ app.config.google_analytics.storefront_account = ENV['GA_STOREFRONT_ACCOUNT']
+ app.config.google_analytics.domain = ENV['GA_DOMAIN']
end
initializer "artfully_ose.autoload_paths", :before => :set_autoload_paths do |app|
+ # First level sub-directories only
+ model_paths = [
+ "#{config.root}/app/models/actions",
+ "#{config.root}/app/models/database_views",
+ "#{config.root}/app/models/discounts",
+ "#{config.root}/app/models/imports",
+ "#{config.root}/app/models/job",
+ "#{config.root}/app/models/kits",
+ "#{config.root}/app/models/orders",
+ "#{config.root}/app/models/payments",
+ ]
+
puts "ArtfullyOse: Setting up additional autoload paths"
- app.config.autoload_paths += Dir["#{config.root}/app/models/**/"]
+ app.config.autoload_paths += model_paths
+
end
-
+
config.generators do |g|
g.test_framework :rspec, :view_specs => false
end
config.autoload_paths += %W(
\ No newline at end of file