Sha256: 4f4bc1d2464994af02579796fdb441a9b713dd284afbad0cea8a8ef051d59029
Contents?: true
Size: 754 Bytes
Versions: 7
Compression:
Stored size: 754 Bytes
Contents
require 'erb' module Commands class CreateDatabase extend Citrin::Helpers def self.run(app) @app = app db_queries = %Q{ create database #{@app.db_name}; GRANT ALL ON #{@app.db_user}.* TO '#{@app.db_name}'@'localhost'; SET PASSWORD FOR '#{@app.db_user}'@'localhost' = PASSWORD('#{@app.db_pass}'); } `sudo mysql --defaults-extra-file=/root/.my.cnf -u root -e "#{db_queries}"` template_file = database_template_file(@app.env) template = ERB.new(File.read(template_file), 0, "%<>") result = template.result(binding) puts %Q{ Put this in your config/database.yml #{result} and run RAILS_ENV=#{@app.fullenv} rake db:migrate" } return @app end end end
Version data entries
7 entries across 7 versions & 1 rubygems