Class: Typo3
- Inherits:
-
Object
- Object
- Typo3
- Defined in:
- lib/valhalla.rb
Instance Attribute Summary collapse
-
#dbname ⇒ Object
readonly
Returns the value of attribute dbname.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#install_password ⇒ Object
readonly
Returns the value of attribute install_password.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#sitename ⇒ Object
readonly
Returns the value of attribute sitename.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #clear_cache(type) ⇒ Object
-
#initialize ⇒ Typo3
constructor
A new instance of Typo3.
- #show_config ⇒ Object
- #with_db ⇒ Object
Constructor Details
#initialize ⇒ Typo3
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
#dbname ⇒ Object (readonly)
Returns the value of attribute dbname.
4 5 6 |
# File 'lib/valhalla.rb', line 4 def dbname @dbname end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/valhalla.rb', line 4 def host @host end |
#install_password ⇒ Object (readonly)
Returns the value of attribute install_password.
4 5 6 |
# File 'lib/valhalla.rb', line 4 def install_password @install_password end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/valhalla.rb', line 4 def password @password end |
#sitename ⇒ Object (readonly)
Returns the value of attribute sitename.
4 5 6 |
# File 'lib/valhalla.rb', line 4 def sitename @sitename end |
#username ⇒ Object (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_config ⇒ Object
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_db ⇒ Object
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 |