lib/data_miner/configuration.rb in data_miner-0.4.1 vs lib/data_miner/configuration.rb in data_miner-0.4.2
- old
+ new
@@ -9,14 +9,10 @@
@resource = resource
@runnable_counter = 0
@attributes = HashWithIndifferentAccess.new
end
- def logger
- DataMiner.logger
- end
-
def process(method_name_or_block_description, &block)
self.runnable_counter += 1
runnables << DataMiner::Process.new(self, runnable_counter, method_name_or_block_description, &block)
end
@@ -74,11 +70,11 @@
def make_sure_unit_definitions_make_sense
import_runnables.each do |runnable|
runnable.attributes.each do |_, attribute|
if attribute.options.any? { |k, _| k.to_s =~ /unit/ } and COMPLETE_UNIT_DEFINITIONS.none? { |complete_definition| complete_definition.all? { |required_option| attribute.options[required_option].present? } }
- logger.error %{
+ DataMiner.logger.error %{
================================
[data_miner gem] You don't have a valid unit definition for #{resource.name}##{attribute.name}.
@@ -95,21 +91,21 @@
def suggest_missing_column_migrations
missing_columns = Array.new
import_runnables.each do |runnable|
runnable.attributes.each do |_, attribute|
- logger.error "[data_miner gem] You can't have an attribute column that ends in _units (reserved): #{resource.table_name}.#{attribute.name}" if attribute.name.ends_with? '_units'
+ DataMiner.logger.error "[data_miner gem] You can't have an attribute column that ends in _units (reserved): #{resource.table_name}.#{attribute.name}" if attribute.name.ends_with? '_units'
unless resource.column_names.include? attribute.name
missing_columns << attribute.name
end
if attribute.wants_units? and !resource.column_names.include?(units_column = "#{attribute.name}_units")
missing_columns << units_column
end
end
end
missing_columns.uniq!
if missing_columns.any?
- logger.error %{
+ DataMiner.logger.error %{
================================
[data_miner gem] On #{resource}, it looks like you're missing some columns...