Class: Typo3

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTypo3

Returns a new instance of Typo3.



6
7
8
9
10
11
12
13
# File 'lib/valhalla.rb', line 6

def initialize
  get_TYPO3_details
  
  # look at somehow making this more automatically specific to environment
  @port = 3306
  
  @socket = `locate -l 1 mysql.sock`.to_s.strip
end

Instance Attribute Details

#dbnameObject (readonly)

Returns the value of attribute dbname.



4
5
6
# File 'lib/valhalla.rb', line 4

def dbname
  @dbname
end

#hostObject (readonly)

Returns the value of attribute host.



4
5
6
# File 'lib/valhalla.rb', line 4

def host
  @host
end

#install_passwordObject (readonly)

Returns the value of attribute install_password.



4
5
6
# File 'lib/valhalla.rb', line 4

def install_password
  @install_password
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/valhalla.rb', line 4

def password
  @password
end

#sitenameObject (readonly)

Returns the value of attribute sitename.



4
5
6
# File 'lib/valhalla.rb', line 4

def sitename
  @sitename
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/valhalla.rb', line 4

def username
  @username
end

Instance Method Details

#clear_cache(type) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/valhalla.rb', line 38

def clear_cache(type)
  case type.to_sym
  when :all
    clear_pages
    clear_temp
    puts "Cleared All"
  when :page
    clear_pages
    puts "Cleared Pages"
  when :temp
    clear_temp
    puts "Cleared Temp"
  end
  
end

#show_configObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/valhalla.rb', line 15

def show_config
  config = %{
TYPO3 Sitename: #{@sitename}
  DB Username: #{@username}
  DB Password: #{@password}
  DB Host: #{@host}
  DB Name: #{@dbname}
  Install Tool: #{@install_password}
}

  print config
end

#with_dbObject



28
29
30
31
32
33
34
35
36
# File 'lib/valhalla.rb', line 28

def with_db
  dbh = Mysql.real_connect(self.host,self.username,self.password,self.dbname,@port,@socket)

  begin
    yield dbh
  ensure
    dbh.close
  end
end