-
Notifications
You must be signed in to change notification settings - Fork 0
SPECS
smith11235 edited this page Oct 22, 2013
·
2 revisions
Deep Import by default uses the same logger as Rails. But to a separate file.
ActiveSupport::TaggedLogging.new(Logger.new( "log/deep_import_#{Rails.env}.log" ))
This is entirely overridable by setting your own logger. For instance the Rails default logger.
DeepImport.logger = Rails.logger # anywhere before first DeepImport.import invocation
The handler for config/deep_import.yml
This is what tells deep import what models and associations to track
Adds deep import rake tasks the the standard Rails rake tasks.
lib/deep_import/tasks.rake defines setup, teardown, and general info tasks
lib/deep_import/setup.rb
- runs Teardown as a prerequisite task
- adds DeepImportModelName for each ModelName in config file
- adds a single migration for:
- creating each deep_import_model_names table
- adding deep_import_id to each models_names table
lib/deep_import/teardown.rb
- reverts the single migration Setup creates
- deletes DeepImport model files
-
run 1x only when
DeepImport.import( options ) { block }first called - loads deep import logic at runtime to target model classes from config file
- allows tweaking of how tracking and association logic is setup
- validates each option passed
- provides a default for each option
- can only take one configuration per process
- cant call DeepImport.import( options ) with mutliple sets of options
- responsible for the actual deep import logic added to target classes
- when added, logic is by default disabled
- when run through DeepImport.import, logic is enabled
- sets an after_initialization callback
- uses alias_method_chain to override belongs_to association methods
- Initializes the deep import environment modifications
- Resets the models cache for tracking new instances
- Enables deep import model logic
- Executes the user provided block for generating model instances
- Disables deep import model logic
- Commit instances in the cache to the database
Tracks models in a big cache.
- loads each set of models from the models cache
- sets each belongs_to association using the deep import models
- deletes deep_import_models