lib/data_miner/configuration.rb in data_miner-0.3.3 vs lib/data_miner/configuration.rb in data_miner-0.3.4

- old
+ new

@@ -33,14 +33,15 @@ end runnables.select { |runnable| runnable.is_a?(Import) }.each { |runnable| unique_indices.each { |unique_index| runnable.store(unique_index) unless runnable.stores?(unique_index) } } end # Mine data for this class. - def run + def run(options = {}) target = DataMiner::Target.find(klass.name) - run = target.runs.create! :started_at => Time.now finished = false + run = target.runs.create! :started_at => Time.now + klass.delete_all if options[:from_scratch] begin runnables.each { |runnable| runnable.run(run) } finished = true ensure run.update_attributes! :ended_at => Time.now, :finished => finished @@ -56,11 +57,10 @@ # Options # * <tt>:class_names</tt>: provide an array class names to mine def run(options = {}) classes.each do |klass| if options[:class_names].blank? or options[:class_names].include?(klass.name) - klass.delete_all if options[:from_scratch] - klass.data_miner_config.run + klass.data_miner_config.run options end end end def create_tables