mainej-activewarehouse 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/activewarehouse/README +99 -0
  2. data/activewarehouse/Rakefile +165 -0
  3. data/activewarehouse/TODO +4 -0
  4. data/activewarehouse/db/migrations/001_create_table_reports.rb +28 -0
  5. data/activewarehouse/doc/references.txt +4 -0
  6. data/activewarehouse/generators/bridge/USAGE +1 -0
  7. data/activewarehouse/generators/bridge/bridge_generator.rb +46 -0
  8. data/activewarehouse/generators/bridge/templates/fixture.yml +5 -0
  9. data/activewarehouse/generators/bridge/templates/migration.rb +27 -0
  10. data/activewarehouse/generators/bridge/templates/model.rb +3 -0
  11. data/activewarehouse/generators/bridge/templates/unit_test.rb +8 -0
  12. data/activewarehouse/generators/cube/USAGE +1 -0
  13. data/activewarehouse/generators/cube/cube_generator.rb +28 -0
  14. data/activewarehouse/generators/cube/templates/model.rb +3 -0
  15. data/activewarehouse/generators/cube/templates/unit_test.rb +8 -0
  16. data/activewarehouse/generators/date_dimension/USAGE +1 -0
  17. data/activewarehouse/generators/date_dimension/date_dimension_generator.rb +16 -0
  18. data/activewarehouse/generators/date_dimension/templates/fixture.yml +5 -0
  19. data/activewarehouse/generators/date_dimension/templates/migration.rb +31 -0
  20. data/activewarehouse/generators/date_dimension/templates/model.rb +3 -0
  21. data/activewarehouse/generators/date_dimension/templates/unit_test.rb +8 -0
  22. data/activewarehouse/generators/dimension/USAGE +1 -0
  23. data/activewarehouse/generators/dimension/dimension_generator.rb +46 -0
  24. data/activewarehouse/generators/dimension/templates/fixture.yml +5 -0
  25. data/activewarehouse/generators/dimension/templates/migration.rb +11 -0
  26. data/activewarehouse/generators/dimension/templates/model.rb +3 -0
  27. data/activewarehouse/generators/dimension/templates/unit_test.rb +8 -0
  28. data/activewarehouse/generators/dimension_view/USAGE +1 -0
  29. data/activewarehouse/generators/dimension_view/dimension_view_generator.rb +62 -0
  30. data/activewarehouse/generators/dimension_view/templates/migration.rb +17 -0
  31. data/activewarehouse/generators/dimension_view/templates/model.rb +3 -0
  32. data/activewarehouse/generators/dimension_view/templates/unit_test.rb +10 -0
  33. data/activewarehouse/generators/fact/USAGE +1 -0
  34. data/activewarehouse/generators/fact/fact_generator.rb +46 -0
  35. data/activewarehouse/generators/fact/templates/fixture.yml +5 -0
  36. data/activewarehouse/generators/fact/templates/migration.rb +13 -0
  37. data/activewarehouse/generators/fact/templates/model.rb +3 -0
  38. data/activewarehouse/generators/fact/templates/unit_test.rb +10 -0
  39. data/activewarehouse/generators/time_dimension/USAGE +1 -0
  40. data/activewarehouse/generators/time_dimension/templates/fixture.yml +5 -0
  41. data/activewarehouse/generators/time_dimension/templates/migration.rb +12 -0
  42. data/activewarehouse/generators/time_dimension/templates/model.rb +3 -0
  43. data/activewarehouse/generators/time_dimension/templates/unit_test.rb +8 -0
  44. data/activewarehouse/generators/time_dimension/time_dimension_generator.rb +14 -0
  45. data/activewarehouse/init.rb +1 -0
  46. data/activewarehouse/install.rb +5 -0
  47. data/activewarehouse/lib/active_warehouse.rb +91 -0
  48. data/activewarehouse/lib/active_warehouse/aggregate.rb +75 -0
  49. data/activewarehouse/lib/active_warehouse/aggregate/dwarf_aggregate.rb +369 -0
  50. data/activewarehouse/lib/active_warehouse/aggregate/dwarf_common.rb +44 -0
  51. data/activewarehouse/lib/active_warehouse/aggregate/dwarf_printer.rb +34 -0
  52. data/activewarehouse/lib/active_warehouse/aggregate/no_aggregate.rb +212 -0
  53. data/activewarehouse/lib/active_warehouse/aggregate/pid_aggregate.rb +29 -0
  54. data/activewarehouse/lib/active_warehouse/aggregate_field.rb +59 -0
  55. data/activewarehouse/lib/active_warehouse/bridge.rb +19 -0
  56. data/activewarehouse/lib/active_warehouse/bridge/hierarchy_bridge.rb +46 -0
  57. data/activewarehouse/lib/active_warehouse/builder.rb +3 -0
  58. data/activewarehouse/lib/active_warehouse/builder/date_dimension_builder.rb +91 -0
  59. data/activewarehouse/lib/active_warehouse/builder/generator/generator.rb +13 -0
  60. data/activewarehouse/lib/active_warehouse/builder/generator/name_generator.rb +20 -0
  61. data/activewarehouse/lib/active_warehouse/builder/generator/paragraph_generator.rb +11 -0
  62. data/activewarehouse/lib/active_warehouse/builder/random_data_builder.rb +239 -0
  63. data/activewarehouse/lib/active_warehouse/builder/test_data_builder.rb +54 -0
  64. data/activewarehouse/lib/active_warehouse/calculated_field.rb +27 -0
  65. data/activewarehouse/lib/active_warehouse/compat/compat.rb +49 -0
  66. data/activewarehouse/lib/active_warehouse/core_ext.rb +1 -0
  67. data/activewarehouse/lib/active_warehouse/core_ext/time.rb +5 -0
  68. data/activewarehouse/lib/active_warehouse/core_ext/time/calculations.rb +40 -0
  69. data/activewarehouse/lib/active_warehouse/cube.rb +235 -0
  70. data/activewarehouse/lib/active_warehouse/cube_query_result.rb +69 -0
  71. data/activewarehouse/lib/active_warehouse/dimension.rb +329 -0
  72. data/activewarehouse/lib/active_warehouse/dimension/date_dimension.rb +15 -0
  73. data/activewarehouse/lib/active_warehouse/dimension/dimension_reflection.rb +21 -0
  74. data/activewarehouse/lib/active_warehouse/dimension/dimension_view.rb +27 -0
  75. data/activewarehouse/lib/active_warehouse/dimension/hierarchical_dimension.rb +99 -0
  76. data/activewarehouse/lib/active_warehouse/dimension/slowly_changing_dimension.rb +147 -0
  77. data/activewarehouse/lib/active_warehouse/fact.rb +239 -0
  78. data/activewarehouse/lib/active_warehouse/field.rb +74 -0
  79. data/activewarehouse/lib/active_warehouse/migrations.rb +64 -0
  80. data/activewarehouse/lib/active_warehouse/ordered_hash.rb +34 -0
  81. data/activewarehouse/lib/active_warehouse/prejoin_fact.rb +97 -0
  82. data/activewarehouse/lib/active_warehouse/report.rb +7 -0
  83. data/activewarehouse/lib/active_warehouse/report/abstract_report.rb +149 -0
  84. data/activewarehouse/lib/active_warehouse/report/chart_report.rb +9 -0
  85. data/activewarehouse/lib/active_warehouse/report/data_cell.rb +21 -0
  86. data/activewarehouse/lib/active_warehouse/report/data_column.rb +19 -0
  87. data/activewarehouse/lib/active_warehouse/report/data_row.rb +15 -0
  88. data/activewarehouse/lib/active_warehouse/report/dimension.rb +58 -0
  89. data/activewarehouse/lib/active_warehouse/report/table_report.rb +38 -0
  90. data/activewarehouse/lib/active_warehouse/version.rb +9 -0
  91. data/activewarehouse/lib/active_warehouse/view.rb +9 -0
  92. data/activewarehouse/lib/active_warehouse/view/crumb.rb +64 -0
  93. data/activewarehouse/lib/active_warehouse/view/report_helper.rb +98 -0
  94. data/activewarehouse/lib/active_warehouse/view/table_view.rb +134 -0
  95. data/activewarehouse/lib/active_warehouse/view/yui_adapter.rb +68 -0
  96. data/activewarehouse/tasks/active_warehouse_tasks.rake +122 -0
  97. metadata +237 -0
@@ -0,0 +1 @@
1
+ ./script/generate date_dimension
@@ -0,0 +1,16 @@
1
+ class DateDimensionGenerator < DimensionGenerator
2
+ attr_accessor :file_name
3
+ attr_accessor :include_fiscal_year
4
+
5
+ default_options :skip_migration => false
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+
10
+ @name = 'date'
11
+ @table_name = "#{@name}_dimension"
12
+ @class_name = "#{@name.camelize}Dimension"
13
+ @file_name = "#{@class_name.tableize.singularize}"
14
+ @include_fiscal_year = true # TODO: accept a runtime option to set this
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ first:
3
+ id: 1
4
+ another:
5
+ id: 2
@@ -0,0 +1,31 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+ t.column :sql_date_stamp, :date, :null => false # SQL Date object
5
+ t.column :calendar_year, :string, :null => false # 2005, 2006, 2007, etc.
6
+ t.column :calendar_quarter, :string, :null => false, :limit => 2 # Q1, Q2, Q3 or Q4
7
+ t.column :calendar_quarter_number, :integer, :null => false # 1, 2, 3 or 4
8
+ t.column :calendar_month_name, :string, :null => false, :limit => 9 # January, February, etc.
9
+ t.column :calendar_month_number, :integer, :null => false # 1, 2, 3, ... 12
10
+ t.column :calendar_week, :string, :null => false, :limit => 2 # 1, 2, 3, ... 52
11
+ t.column :calendar_week_number, :integer, :null => false # 1, 2, 3, ... 52
12
+ t.column :day_number_in_calendar_year, :integer, :null => false # 1, 2, 3, ... 365
13
+ t.column :day_number_in_calendar_month, :integer, :null => false # 1, 2, 3, ... 31
14
+ t.column :day_in_week, :string, :null => false, :limit => 9 # Monday, Tuesday, etc.
15
+ <% if include_fiscal_year -%>
16
+ t.column :fiscal_year, :string, :null => false
17
+ t.column :fiscal_quarter, :string, :null => false, :limit => 2
18
+ t.column :fiscal_quarter_number, :integer, :null => false
19
+ t.column :fiscal_month_number, :integer, :null => false
20
+ t.column :fiscal_week, :string, :null => false, :limit => 2
21
+ t.column :fiscal_week_number, :integer, :null => false
22
+ t.column :day_number_in_fiscal_year, :integer, :null => false
23
+ <% end -%>
24
+ end
25
+ # add indexes as required
26
+ end
27
+
28
+ def self.down
29
+ drop_table :<%= table_name %>
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveWarehouse::DateDimension
2
+
3
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ ./script/generate dimension NAME
@@ -0,0 +1,46 @@
1
+ class DimensionGenerator < Rails::Generator::NamedBase
2
+ attr_accessor :file_name
3
+
4
+ default_options :skip_migration => false
5
+
6
+ def initialize(runtime_args, runtime_options = {})
7
+ super
8
+
9
+ @name = @name.tableize.singularize
10
+ @table_name = "#{@name}_dimension"
11
+ @class_name = "#{@name.camelize}Dimension"
12
+ @file_name = "#{@class_name.tableize.singularize}"
13
+ end
14
+
15
+ def manifest
16
+ record do |m|
17
+ # Check for class naming collisions.
18
+ m.class_collisions class_path, "#{class_name}", "#{class_name}Test"
19
+
20
+ # Create required directories if necessary
21
+ m.directory File.join('app/models', class_path)
22
+ m.directory File.join('test/unit', class_path)
23
+ m.directory File.join('test/fixtures', class_path)
24
+
25
+ # Generate the files
26
+ m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
27
+ m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
28
+ m.template 'fixture.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
29
+
30
+ # Generate the migration unless :skip_migration option is specified
31
+ unless options[:skip_migration]
32
+ m.migration_template 'migration.rb', 'db/migrate', :assigns => {
33
+ :migration_name => "Create#{class_name.gsub(/::/, '')}"
34
+ }, :migration_file_name => "create_#{file_name.gsub(/\//, '_')}"
35
+ end
36
+ end
37
+ end
38
+
39
+ protected
40
+ def add_options!(opt)
41
+ opt.separator ''
42
+ opt.separator 'Options:'
43
+ opt.on("--skip-migration",
44
+ "Don't generate a migration file for this dimension") { |v| options[:skip_migration] = v }
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ first:
3
+ id: 1
4
+ another:
5
+ id: 2
@@ -0,0 +1,11 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :<%= table_name %>
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveWarehouse::Dimension
2
+
3
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ ./script/generate dimension_view NAME
@@ -0,0 +1,62 @@
1
+ class DimensionViewGenerator < Rails::Generator::NamedBase
2
+ attr_accessor :file_name, :view_name, :query_target_name, :query_target_table_name, :view_query, :view_attributes
3
+
4
+ default_options :skip_migration => false
5
+
6
+ def initialize(runtime_args, runtime_options = {})
7
+ super
8
+
9
+ usage if runtime_args.length != 2
10
+
11
+ @name = @name.tableize.singularize
12
+ @query_target_name = runtime_args[1]
13
+ # define the view and query target table name
14
+ @view_name = "#{@name}_dimension"
15
+ @query_target_table_name = "#{query_target_name}_dimension"
16
+ # define the view class name and query target class name
17
+ @class_name = "#{view_name.camelize}"
18
+ @query_target_class_name = "#{query_target_table_name.camelize}"
19
+ # define the output file name
20
+ @file_name = "#{class_name.tableize.singularize}"
21
+ # define the query target class and expose its columns as attributes for the view
22
+ @query_target_class = @query_target_class_name.constantize
23
+ @view_attributes = @query_target_class.column_names
24
+ @view_query = "select #{@view_attributes.join(',')} from #{query_target_table_name}"
25
+ end
26
+
27
+ def manifest
28
+ record do |m|
29
+ # Check for class naming collisions.
30
+ m.class_collisions class_path, "#{class_name}", "#{class_name}Test"
31
+
32
+ # Create required directories if necessary
33
+ m.directory File.join('app/models', class_path)
34
+ m.directory File.join('test/unit', class_path)
35
+ m.directory File.join('test/fixtures', class_path)
36
+
37
+ # Generate the files
38
+ m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
39
+ m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
40
+ #m.template 'fixture.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
41
+
42
+ # Generate the migration unless :skip_migration option is specified
43
+ unless options[:skip_migration]
44
+ m.migration_template 'migration.rb', 'db/migrate', :assigns => {
45
+ :migration_name => "Create#{class_name.gsub(/::/, '')}"
46
+ }, :migration_file_name => "create_#{file_name.gsub(/\//, '_')}"
47
+ end
48
+ end
49
+ end
50
+
51
+ def banner
52
+ "Usage: #{$0} #{spec.name} #{spec.name.camelize}Name SelectTarget [options]"
53
+ end
54
+
55
+ protected
56
+ def add_options!(opt)
57
+ opt.separator ''
58
+ opt.separator 'Options:'
59
+ opt.on("--skip-migration",
60
+ "Don't generate a migration file for this dimension view") { |v| options[:skip_migration] = v }
61
+ end
62
+ end
@@ -0,0 +1,17 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_view "<%= view_name %>", "<%= view_query %>" do |t|
4
+ <%- view_attributes.each do |view_attribute| -%>
5
+ <%- if view_attribute == 'id' -%>
6
+ t.column :id
7
+ <%- else -%>
8
+ t.column :<%= name %>_<%= view_attribute %>
9
+ <%- end -%>
10
+ <%- end -%>
11
+ end
12
+ end
13
+
14
+ def self.down
15
+ drop_view "<%= view_name %>"
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveWarehouse::DimensionView
2
+
3
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ fixtures :<%= view_name %>
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ ./script/generate fact NAME
@@ -0,0 +1,46 @@
1
+ class FactGenerator < Rails::Generator::NamedBase
2
+ attr_accessor :file_name
3
+
4
+ default_options :skip_migration => false
5
+
6
+ def initialize(runtime_args, runtime_options = {})
7
+ super
8
+
9
+ @name = @name.underscore
10
+ @table_name = "#{@name}_facts"
11
+ @class_name = "#{@name.camelize}Fact"
12
+ @file_name = "#{@class_name.tableize.singularize}"
13
+ end
14
+
15
+ def manifest
16
+ record do |m|
17
+ # Check for class naming collisions.
18
+ m.class_collisions class_path, "#{class_name}", "#{class_name}Test"
19
+
20
+ # Create required directories if necessary
21
+ m.directory File.join('app/models', class_path)
22
+ m.directory File.join('test/unit', class_path)
23
+ m.directory File.join('test/fixtures', class_path)
24
+
25
+ # Generate the files
26
+ m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
27
+ m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
28
+ m.template 'fixture.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
29
+
30
+ # Generate the migration unless :skip_migration option is specified
31
+ unless options[:skip_migration]
32
+ m.migration_template 'migration.rb', 'db/migrate', :assigns => {
33
+ :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
34
+ }, :migration_file_name => "create_#{file_name.gsub(/\//, '_').pluralize}"
35
+ end
36
+ end
37
+ end
38
+
39
+ protected
40
+ def add_options!(opt)
41
+ opt.separator ''
42
+ opt.separator 'Options:'
43
+ opt.on("--skip-migration",
44
+ "Don't generate a migration file for this fact") { |v| options[:skip_migration] = v }
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ first_fact:
3
+ id: 1
4
+ second_fact:
5
+ id: 2
@@ -0,0 +1,13 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+
5
+ end
6
+ # you should add indexes for each foreign key, but don't add
7
+ # the foreign key itself unless you really know what you are doing.
8
+ end
9
+
10
+ def self.down
11
+ drop_table :<%= table_name %>
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveWarehouse::Fact
2
+
3
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ fixtures :<%= table_name %>
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ ./script/generate time_dimension
@@ -0,0 +1,5 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ first:
3
+ id: 1
4
+ another:
5
+ id: 2
@@ -0,0 +1,12 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+ t.column :hour_of_day, :integer, :null => false
5
+ t.column :minute_of_hour, :integer, :null => false
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :<%= table_name %>
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveWarehouse::Dimension
2
+
3
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_truth
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ class TimeDimensionGenerator < DimensionGenerator
2
+ attr_accessor :file_name
3
+
4
+ default_options :skip_migration => false
5
+
6
+ def initialize(runtime_args, runtime_options = {})
7
+ super
8
+
9
+ @name = 'date'
10
+ @table_name = "#{@name}_dimension"
11
+ @class_name = "#{@name.camelize}Dimension"
12
+ @file_name = "#{@class_name.tableize.singularize}"
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ require 'active_warehouse'
@@ -0,0 +1,5 @@
1
+ # migrate
2
+ #puts "Migrating ActiveWarehouse"
3
+ #migration_directory = File.join(File.dirname(__FILE__), 'db', 'migrations')
4
+ #ActiveRecord::Migrator.migrate(migration_directory, nil)
5
+ # puts IO.read(File.join(File.dirname(__FILE__), 'README'))
@@ -0,0 +1,91 @@
1
+ # This source file requires all of the necessary gems and source files for ActiveWarehouse. If you
2
+ # load this source file all of the other required files and gems will also be brought into the
3
+ # runtime.
4
+
5
+ #--
6
+ # Copyright (c) 2006-2007 Anthony Eden
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+ #++
27
+
28
+ $:.unshift(File.dirname(__FILE__)) unless
29
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
30
+
31
+ require 'rubygems'
32
+ unless Kernel.respond_to?(:gem)
33
+ Kernel.send :alias_method, :gem, :require_gem
34
+ end
35
+
36
+ unless defined?(ActiveSupport)
37
+ begin
38
+ $:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib")
39
+ require 'active_support'
40
+ rescue LoadError
41
+ gem 'activesupport'
42
+ end
43
+ end
44
+
45
+ unless defined?(ActiveRecord)
46
+ begin
47
+ $:.unshift(File.dirname(__FILE__) + "/../../activerecord/lib")
48
+ require 'active_record'
49
+ rescue LoadError
50
+ gem 'activerecord'
51
+ end
52
+ end
53
+
54
+ unless defined?(ActionView)
55
+ begin
56
+ $:.unshift(File.dirname(__FILE__) + "/../../actionpack/lib")
57
+ require 'action_pack'
58
+ require 'action_controller'
59
+ require 'action_view'
60
+ rescue LoadError
61
+ gem 'actionpack'
62
+ end
63
+ end
64
+
65
+ require 'fastercsv'
66
+ require 'fileutils'
67
+ require 'adapter_extensions'
68
+
69
+ # Require 1.1.6 compatibility code if necessary
70
+ require 'active_record/version'
71
+ if ActiveRecord::VERSION::MAJOR < 1 || ActiveRecord::VERSION::MINOR < 15
72
+ require 'active_warehouse/compat/compat'
73
+ end
74
+
75
+ require 'active_warehouse/ordered_hash'
76
+ require 'active_warehouse/field'
77
+ require 'active_warehouse/aggregate_field'
78
+ require 'active_warehouse/calculated_field'
79
+ require 'active_warehouse/version'
80
+ require 'active_warehouse/core_ext'
81
+ require 'active_warehouse/prejoin_fact'
82
+ require 'active_warehouse/fact'
83
+ require 'active_warehouse/bridge'
84
+ require 'active_warehouse/dimension'
85
+ require 'active_warehouse/cube'
86
+ require 'active_warehouse/cube_query_result'
87
+ require 'active_warehouse/aggregate'
88
+ require 'active_warehouse/report'
89
+ require 'active_warehouse/view'
90
+ require 'active_warehouse/builder'
91
+ require 'active_warehouse/migrations'