Class: Anvil::Mysql::DatabaseCreator
- Inherits:
-
Struct
- Object
- Struct
- Anvil::Mysql::DatabaseCreator
- Defined in:
- lib/anvil/mysql/database_creator.rb
Instance Attribute Summary collapse
-
#db_name ⇒ Object
Returns the value of attribute db_name.
-
#host ⇒ Object
Returns the value of attribute host.
-
#mysql_host ⇒ Object
Returns the value of attribute mysql_host.
-
#mysql_password ⇒ Object
Returns the value of attribute mysql_password.
-
#mysql_port ⇒ Object
Returns the value of attribute mysql_port.
-
#mysql_user ⇒ Object
Returns the value of attribute mysql_user.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#db_name ⇒ Object
Returns the value of attribute db_name
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def db_name @db_name end |
#host ⇒ Object
Returns the value of attribute host
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def host @host end |
#mysql_host ⇒ Object
Returns the value of attribute mysql_host
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def mysql_host @mysql_host end |
#mysql_password ⇒ Object
Returns the value of attribute mysql_password
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def mysql_password @mysql_password end |
#mysql_port ⇒ Object
Returns the value of attribute mysql_port
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def mysql_port @mysql_port end |
#mysql_user ⇒ Object
Returns the value of attribute mysql_user
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def mysql_user @mysql_user end |
#user ⇒ Object
Returns the value of attribute user
7 8 9 |
# File 'lib/anvil/mysql/database_creator.rb', line 7 def user @user end |
Instance Method Details
#call ⇒ Object
8 9 10 |
# File 'lib/anvil/mysql/database_creator.rb', line 8 def call ScriptRunner.new(script, user, host, logger).call end |
#db_script ⇒ Object
12 13 14 |
# File 'lib/anvil/mysql/database_creator.rb', line 12 def db_script "CREATE DATABASE #{db_name};" end |
#logger ⇒ Object
20 21 22 |
# File 'lib/anvil/mysql/database_creator.rb', line 20 def logger Anvil::Logger.new(self.class.name) end |
#script ⇒ Object
16 17 18 |
# File 'lib/anvil/mysql/database_creator.rb', line 16 def script "mysql -u#{mysql_user} -p#{mysql_password} -h #{mysql_host} -P #{mysql_port} -e \"#{db_script}\"" end |