Sha256: 5c502ce97093942e43bebb1e2ee14bc356d7974fa3016f0c148097cc7c0823d1
Contents?: true
Size: 908 Bytes
Versions: 33
Compression:
Stored size: 908 Bytes
Contents
config = YAML.load_file(File.expand_path("../config/database.yml", __FILE__)) host, port, username, password, database = config.values_at *%w(host port username password database) db = File.expand_path("../db", __FILE__) begin ActiveRecord::Base.establish_connection config.merge("database" => nil) ActiveRecord::Base.connection.create_database database, {:charset => "utf8", :collation => "utf8_unicode_ci"} puts "Installing #{database} ..." `#{ [ "mysql", ("-h #{host}" unless host.blank?), ("-P #{port}" unless port.blank?), "-u #{username || "root"}", ("-p#{password}" unless password.blank?), "#{database} < #{db}/database.sql" ].compact.join(" ") }` rescue Exception => e raise e unless e.message.include?("database exists") end ActiveRecord::Base.establish_connection config Dir[File.expand_path("../app/**/*.rb", __FILE__)].each{|file| require file}
Version data entries
33 entries across 33 versions & 1 rubygems