-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of association code. Focus on idempotency. Log runs.
- Loading branch information
1 parent
23ee99b
commit 71647ef
Showing
21 changed files
with
1,159 additions
and
662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ coverage | |
rdoc | ||
pkg | ||
test/test.sqlite3 | ||
data_miner.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
0.2.6 | ||
* Upgrade to remote_table 0.1.6 to handle UTF-8 CSVs and long urls. | ||
0.3.0 | ||
* Removed association code... now data_miner focuses on just importing. | ||
* New, simpler DSL | ||
* Upgrade to remote_table 0.2.1 for row_hashes and better blank row handling | ||
* Remove all association-related code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,66 @@ | ||
require 'rubygems' | ||
require 'activesupport' | ||
require 'activerecord' | ||
require 'active_support' | ||
require 'active_record' | ||
require 'blockenspiel' | ||
require 'conversions' | ||
require 'remote_table' | ||
require 'errata' | ||
require 'andand' | ||
require 'log4r' | ||
|
||
require 'data_miner/active_record_ext' | ||
require 'data_miner/attribute' | ||
require 'data_miner/attribute_collection' | ||
require 'data_miner/configuration' | ||
require 'data_miner/dictionary' | ||
require 'data_miner/step' | ||
require 'data_miner/step/associate' | ||
require 'data_miner/step/await' | ||
require 'data_miner/step/callback' | ||
require 'data_miner/step/derive' | ||
require 'data_miner/step/import' | ||
require 'data_miner/william_james_cartesian_product' # TODO: move to gem | ||
require 'data_miner/import' | ||
require 'data_miner/process' | ||
require 'data_miner/target' | ||
require 'data_miner/run' | ||
|
||
# TODO: move to gem | ||
require 'data_miner/william_james_cartesian_product' | ||
|
||
module DataMiner | ||
class << self | ||
def mine(options = {}) | ||
DataMiner::Configuration.mine options | ||
end | ||
|
||
def map_to_attrs(method, options = {}) | ||
puts DataMiner::Configuration.map_to_attrs(method, options) | ||
end | ||
class MissingHashColumn < RuntimeError; end | ||
|
||
include Log4r | ||
|
||
def enqueue(&block) | ||
DataMiner::Configuration.enqueue &block | ||
end | ||
|
||
def classes | ||
DataMiner::Configuration.classes | ||
mattr_accessor :logger | ||
|
||
def self.start_logging | ||
if defined?(Rails) | ||
self.logger = Rails.logger | ||
else | ||
self.logger = Logger.new 'data_miner' | ||
logger.outputters = FileOutputter.new 'f1', :filename => 'data_miner.log' | ||
end | ||
end | ||
|
||
def self.run(options = {}) | ||
DataMiner::Configuration.run options | ||
end | ||
|
||
def self.enqueue(&block) | ||
DataMiner::Configuration.enqueue &block | ||
end | ||
|
||
def self.classes | ||
DataMiner::Configuration.classes | ||
end | ||
|
||
def self.create_tables | ||
DataMiner::Configuration.create_tables | ||
end | ||
end | ||
|
||
ActiveRecord::Base.class_eval do | ||
include DataMiner::ActiveRecordExt | ||
def self.data_miner(&block) | ||
# this is class_eval'ed here so that each ActiveRecord descendant has its own copy, or none at all | ||
class_eval { cattr_accessor :data_miner_config } | ||
self.data_miner_config = DataMiner::Configuration.new self | ||
|
||
data_miner_config.before_invoke | ||
Blockenspiel.invoke block, data_miner_config | ||
data_miner_config.after_invoke | ||
end | ||
end | ||
|
||
DataMiner.start_logging |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.