1
0
Fork 0

Mongo storages, configuration

This commit is contained in:
Gregory Eremin 2013-06-05 00:19:02 +04:00
parent 3fc9fba18c
commit 7c6e2f442e
5 changed files with 49 additions and 3 deletions

View File

@ -1,10 +1,16 @@
require 'bundler/setup'
require 'rake'
require 'rake_control/version'
require 'rake_control/wrapper'
require File.expand_path('../rake/task', __FILE__)
require 'rake_control/version'
require 'rake_control/config'
require 'rake_control/wrapper'
module RakeControl
def config
@config ||= Config.new
end
def wrap(name, description, &block)
Wrapper.new(name, description, block).execute
end

View File

@ -0,0 +1,22 @@
module RakeControl
class Config
attr_accessor :storage
def initialize
@storage = :active_record
end
def setup_storage_model
case storage
when :active_record, :activerecord
require 'rake_control/storage/active_record/rake_control_run'
when :mongoid
require 'rake_control/storage/mongoid/rake_control_run'
when :mongo_mapper, :mongomapper
require 'rake_control/storage/mongo_mapper/rake_control_run'
else
raise Exception.new("Unknown storage: #{storage}")
end
end
end
end

View File

@ -0,0 +1,9 @@
module RakeControl
class Run
include MongoMapper::Document
key :name, String
key :success, Boolean
key :execution_time, Float
end
end

View File

@ -0,0 +1,9 @@
module RakeControl
class Run
include Mongoid::Document
field :name, type: String
field :success, type: Boolean
field :execution_time, type: Float
end
end