public
Description: Infinite Monkeywrench - A frameworks for collecting, peeling, and sharing delicious bananas of data.
Homepage: http://infinitemonkeywrench.org
Clone URL: git://github.com/infochimps/imw.git
imw / meta / Rakefile
100644 66 lines (53 sloc) 1.6 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# h2. Rakefile -- main imw tasks
#
#
#
# == About
#
# Author:: Philip flip Kromer for Infinite Monkeywrench Project (mailto:coders@infochimps.org)
# Copyright:: Copyright (c) 2008 infochimps.org
# License:: GPL 3.0
# Website:: http://infinitemonkeywrench.org/
#
 
$VERBOSE = false
verbose(true)
 
require 'rake'
require 'rake/clean'
require 'imw'
# rake_require 'imw/task
 
desc "Fiddlefucking"
task :fiddle do
  # IMWConfig::Config['migrate'] = true
  db_connection=IMWConfig::Config['schemadb']
  db_connection['database'] ||= File.join($IMW_ROOT, db_connection['database_file'])
  ActiveRecord::Base.establish_connection(db_connection)
  require 'imw/model/schemadb_schema'
  require 'imw/model'
  require 'imw/view'
  
  # process_config = YAML.load(File.open($imw.path_to(:pool_config_file)))
  schema = YAML.load(File.open($imw.path_to(:pool_schema_file)))
  schema['infochimps_schema'].each do |pool|
    pool=pool['pool']
    oldpool = Pool.find_by_uniqname(pool['uniqname']) || Pool.new()
    oldpool = oldpool.undump(pool)
    # puts oldpool.to_yaml
    oldpool.save!
    oldpool.datasets.each{ |d| p d ; d.save!}
  end
    
end
 
#
# Main tasks. See lib/imw/tasks/*.rake for definitions
#
desc "Acquire data from remote sources"
task :rip
 
desc "Simple file manipulations"
task :prep => [:rip]
 
desc "Data Munging (transformation and extraction)"
task :munge => [:rip]
 
desc "Package data into distributable compressed archives."
task :pkg => [:prep, :munge]
 
desc "Load data into repository"
task :load => [:prep, :munge, :pkg]
 
#desc 'Default: Usage.'
#task :default