class Exodus::MigrationInfo
Attributes
config_file[R]
connection[R]
db[R]
info[RW]
migrations_directory[RW]
rake_namespace[R]
Public Class Methods
new(file = nil)
click to toggle source
# File lib/exodus/config/migration_info.rb, line 8 def initialize(file = nil) config_file = file if file end
Public Instance Methods
config_file=(file)
click to toggle source
# File lib/exodus/config/migration_info.rb, line 20 def config_file=(file) if File.exists?(file) @config_file = file self.info = YAML.load_file(file) self.rake_namespace = (info['migration'] && info['migration']['rake_namespace']).to_s else raise ArgumentError, "#{file} not found" end end
connection=(conn)
click to toggle source
# File lib/exodus/config/migration_info.rb, line 16 def connection=(conn) MongoMapper.connection = conn end
db=(database)
click to toggle source
# File lib/exodus/config/migration_info.rb, line 12 def db=(database) MongoMapper.database = database end
migrate()
click to toggle source
# File lib/exodus/config/migration_info.rb, line 34 def migrate verify_yml_syntax { @info['migration']['migrate'] } end
migrate_custom()
click to toggle source
# File lib/exodus/config/migration_info.rb, line 42 def migrate_custom verify_yml_syntax { @info['migration']['custom']['migrate'] } end
rake_namespace=(namespace)
click to toggle source
# File lib/exodus/config/migration_info.rb, line 30 def rake_namespace=(namespace) @rake_namespace = namespace.to_s.empty? || namespace.end_with?(':') ? namespace.to_s : namespace + ':' end
rollback()
click to toggle source
# File lib/exodus/config/migration_info.rb, line 38 def rollback verify_yml_syntax { @info['migration']['rollback'] } end
rollback_custom()
click to toggle source
# File lib/exodus/config/migration_info.rb, line 46 def rollback_custom verify_yml_syntax { @info['migration']['custom']['rollback'] } end
to_s()
click to toggle source
# File lib/exodus/config/migration_info.rb, line 50 def to_s @info end
Private Instance Methods
verify_yml_syntax() { || ... }
click to toggle source
# File lib/exodus/config/migration_info.rb, line 56 def verify_yml_syntax Raise StandardError, "No configuration file specified" unless self.config_file begin yield if block_given? rescue Raise StandardError, "Syntax error detected in config file #{self.config_file}. To find the correct syntax take a look at the documentation." end end