Sha256: 6e55b854bef2efe3be9318c45167a617515cd558bf900e31b63fcfad0232bdd4
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module Cream module GeneratorHelper module Orm def validate_orm if !valid_orms.include?(orm) say "ERROR: ORM #{orm} is not currently supported. Please use one of: #{valid_orms_list}", :red return false end true end def orm @orm ||= get_orm options[:orm].to_s.underscore.to_sym end def valid_orms_list valid_orms.map(&:to_s).join(', ') end def valid_orms active_record + data_mapper + mongo_mapper + [:couch_db, :mongoid] end def active_record [:ar, :active_record] end def is_active_record? name active_record.include? name end def mongo_mapper [:mm, :mongo_mapper] end def is_mongo_mapper? name mongo_mapper.include? name end def data_mapper [:dm, :data_mapper] end def is_data_mapper? name data_mapper.include? name end def get_orm name return :active_record if is_active_record? name return :mongo_mapper if is_mongo_mapper? name return :data_mapper if is_data_mapper? name return :couch_db if orm_name == :couch_db return :mongoid if orm_name == :mongoid raise ArgumentError, "ERROR: Cream does not currently support the orm: #{name}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cream-0.8.6 | lib/generators/cream/helpers/orm_helper.rb |