Class: WordpressDeploy::Database::OptionFile

Inherits:
Object
  • Object
show all
Defined in:
lib/wordpress_deploy/database/option_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, password, host, port, database, type = :mysql) ⇒ OptionFile

Create a MySQL option file



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wordpress_deploy/database/option_file.rb', line 9

def initialize(
  user,
  password,
  host,
  port,
  database,
  type = :mysql
)
  @user = user
  @password = password
  @host = host
  @port = port
  @database = database

  @template = if type == :mysql
                ERB.new(File.read(File.join(WordpressDeploy::TEMPLATE_PATH, 'mysql-opts.erb')))
              else
                ERB.new(File.read(File.join(WordpressDeploy::TEMPLATE_PATH, 'mysqldump-opts.erb')))
              end
  @option_file = Tempfile.new(%w(mysql-opts .conf))
  @option_file.write(@template.result(binding))
  @option_file.flush
end

Instance Method Details

#pathObject



35
36
37
# File 'lib/wordpress_deploy/database/option_file.rb', line 35

def path
  @option_file.path
end