Class: Catori::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/catori/Installer.rb

Class Method Summary collapse

Class Method Details

.install(db, user, pw) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/catori/Installer.rb', line 5

def self.install(db,user,pw)
	require 'ftools'
	File.mkpath Catori::CONFIG_DIR
	data={"user"=>user,"database"=>db,"password"=>pw}
	File.open(Catori::CONFIG_FILE,"w") {|f|
	YAML.dump(data,f) }
	sql=File.expand_path(File.dirname(__FILE__)+"../../../sql/catori_mysql.sql")
	s=`mysql  -f -u #{user} --password=#{pw} #{db} < #{sql}`
	puts s
	puts "Catori installed"
end