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

Version Path
directiverecord-0.1.32 test/application/boot.rb
directiverecord-0.1.31 test/application/boot.rb
directiverecord-0.1.30 test/application/boot.rb
directiverecord-0.1.29 test/application/boot.rb
directiverecord-0.1.28 test/application/boot.rb
directiverecord-0.1.27 test/application/boot.rb
directiverecord-0.1.26 test/application/boot.rb
directiverecord-0.1.25 test/application/boot.rb
directiverecord-0.1.24 test/application/boot.rb
directiverecord-0.1.23 test/application/boot.rb
directiverecord-0.1.22 test/application/boot.rb
directiverecord-0.1.21 test/application/boot.rb
directiverecord-0.1.20 test/application/boot.rb
directiverecord-0.1.19 test/application/boot.rb
directiverecord-0.1.18 test/application/boot.rb
directiverecord-0.1.17 test/application/boot.rb
directiverecord-0.1.16 test/application/boot.rb
directiverecord-0.1.15 test/application/boot.rb
directiverecord-0.1.14 test/application/boot.rb
directiverecord-0.1.13 test/application/boot.rb