Module: Cubicle
- Defined in:
- lib/cubicle/mongo_environment.rb,
lib/cubicle.rb,
lib/cubicle/data.rb,
lib/cubicle/query.rb,
lib/cubicle/ratio.rb,
lib/cubicle/member.rb,
lib/cubicle/measure.rb,
lib/cubicle/version.rb,
lib/cubicle/duration.rb,
lib/cubicle/date_time.rb,
lib/cubicle/dimension.rb,
lib/cubicle/query/dsl.rb,
lib/cubicle/data/level.rb,
lib/cubicle/data/table.rb,
lib/cubicle/difference.rb,
lib/cubicle/aggregation.rb,
lib/cubicle/data/member.rb,
lib/cubicle/member_list.rb,
lib/cubicle/data/hierarchy.rb,
lib/cubicle/aggregation/dsl.rb,
lib/cubicle/aggregation/ad_hoc.rb,
lib/cubicle/calculated_measure.rb,
lib/cubicle/aggregation/profiler.rb,
lib/cubicle/bucketized_dimension.rb,
lib/cubicle/query/dsl/time_intelligence.rb,
lib/cubicle/aggregation/aggregation_view.rb,
lib/cubicle/aggregation/cubicle_metadata.rb,
lib/cubicle/aggregation/map_reduce_helper.rb,
lib/cubicle/mongo_mapper/aggregate_plugin.rb,
lib/cubicle/aggregation/aggregation_manager.rb,
lib/cubicle/aggregation/aggregation_metadata.rb
Overview
This class represents MongoDB. It is lifted line for line from MongoMapper github.com/jnunemaker/mongomapper/blob/master/lib/mongo_mapper.rb Actually, if the MongoMapper gem is loaded, Cubicle will simply use it for providing the MongoEnvironment. However, if MongoMapper isn’t loaded, this stuff is still required, so why reinvent the wheel?
Defined Under Namespace
Modules: Aggregation, Data, DateTime, MongoMapper
Classes: BucketizedDimension, CalculatedMeasure, Difference, Dimension, Duration, Measure, Member, MemberList, MongoEnvironment, Query, Ratio
Constant Summary
collapse
- VERSION =
'0.1.29'
Class Method Summary
collapse
Class Method Details
.clear_temp_tables ⇒ Object
73
74
75
|
# File 'lib/cubicle.rb', line 73
def self.clear_temp_tables
self.mongo.database.collection_names.each{|cn|self.mongo.database[cn].drop if cn =~ /tmp.mr.mapreduce/i}
end
|
.logger ⇒ Object
69
70
71
|
# File 'lib/cubicle.rb', line 69
def self.logger
@logger ||= (Cubicle.mongo.logger || Logger.new("cubicle.log"))
end
|
.mongo ⇒ Object
61
62
63
|
# File 'lib/cubicle.rb', line 61
def self.mongo
@mongo ||= defined?(::MongoMapper::Document) ? ::MongoMapper : MongoEnvironment
end
|
.mongo=(mongo_env) ⇒ Object
65
66
67
|
# File 'lib/cubicle.rb', line 65
def self.mongo=(mongo_env)
@mongo = mongo_env
end
|
.register_cubicle_directory(directory_path, recursive = true) ⇒ Object
45
46
47
48
|
# File 'lib/cubicle.rb', line 45
def self.register_cubicle_directory(directory_path, recursive=true)
searcher = "#{recursive ? "*" : "**/*"}.rb"
Dir[File.join(directory_path,searcher)].each {|cubicle| require cubicle}
end
|
.setup(config, environment, options) ⇒ Object
Offer an easy way to set cubicle up with configuration independent of mongo mapper even if mongo mapper has been included. This is useful in a scenario where you want your map reduce activity to happen on a different server, such as a slave, so that your transactional systems aren’t constantly irritated by all the loud crunching sounds that cubicle makes. Maybe someday map reduce will learn to chew with its mouth shut. Until then, it may be prudent to let cubicle run on a slave, and mongo mapper on your master.
56
57
58
59
|
# File 'lib/cubicle.rb', line 56
def self.setup(config,environment,options)
@mongo = MongoEnvironment
@mongo.setup(config,environment,options)
end
|