Sha256: 35b4320ac365a8be84a1f73d5044e38b9f0879519745f70b11334e17be493791
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 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}'); } `mysql --user=#{Citrin::config['db_user']} --password=#{Citrin::config['db_pass']} -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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
citrin-0.0.10 | lib/citrin/commands/create_database.rb |
citrin-0.0.9 | lib/citrin/commands/create_database.rb |