Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: commits
[6778] wizards2: WIP: Adds the first template, and works out the WP wizard prototype.
 

Index | Next | Previous | View Flat


cherokee at cherokee-project

Jul 30, 2011, 1:47 PM


Views: 114
Permalink
[6778] wizards2: WIP: Adds the first template, and works out the WP wizard prototype.

Revision: 6778
http://svn.cherokee-project.com/changeset/6778
Author: alo
Date: 2011-07-30 22:47:10 +0200 (Sat, 30 Jul 2011)
Log Message:
-----------
WIP: Adds the first template, and works out the WP wizard prototype.

Modified Paths:
--------------
wizards2/Wizard2.py
wizards2/wizards/02-Content Management Systems/wordpress.py

Added Paths:
-----------
wizards2/templates/
wizards2/templates/PHP.py

Modified: wizards2/Wizard2.py
===================================================================
--- wizards2/Wizard2.py 2011-07-30 15:50:24 UTC (rev 6777)
+++ wizards2/Wizard2.py 2011-07-30 20:47:10 UTC (rev 6778)
@@ -193,3 +193,10 @@

php_mod_path = os.path.realpath (__file__ + '/../wizards/' + path)
return CTK.load_module_pyc (php_mod_path, dsc)
+
+def Load_Template (path):
+ tmp = path.split('/')
+ dsc = tmp[-1].replace('.py','')
+
+ php_mod_path = os.path.realpath (__file__ + '/../templates/' + path)
+ return CTK.load_module_pyc (php_mod_path, dsc)

Added: wizards2/templates/PHP.py
===================================================================
--- wizards2/templates/PHP.py (rev 0)
+++ wizards2/templates/PHP.py 2011-07-30 20:47:10 UTC (rev 6778)
@@ -0,0 +1,100 @@
+# -*- coding: utf-8; mode: python -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro [at] alobbs>
+#
+# Copyright (C) 2001-2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import os
+import re
+import CTK
+import vserver
+import Wizard2
+import Wizard2_GUI
+
+from util import *
+
+
+php_fpm = Wizard2.Load_Module ('01-Development Platforms/php-fpm.py')
+
+
+class Install (Wizard2.Wizard):
+ def __init__ (self, app_name, config_vserver, config_directory, tarball_url, params):
+ self._app_name = app_name
+ self._config_vserver = config_vserver
+ self._config_directory = config_directory
+ self._tarball_url = tarball_url
+
+ # Base
+ Wizard2.Wizard.__init__ (self, app_name, params)
+
+ # Sibling wizard
+ self.php = self._Register_Child_Wizard (php_fpm.Install (params))
+
+ def Check_Parameters (self):
+ # PHP
+ errors = self.php.Check_Parameters()
+
+ # App location
+ errors += self._Check_Params_Install_Type (
+ allows_dir = bool(self._config_directory),
+ allows_vserver = bool(self._config_vserver))
+
+ errors += self._Check_Software_Location()
+
+ return errors
+
+ def Check_Prerequisites (self):
+ # PHP
+ errors = self.php.Check_Prerequisites()
+ if errors: return errors
+
+ # Wordpress
+ errors = self._Handle_Download (tarball = self._tarball_url)
+ if errors: return errors
+
+ errors = self._Handle_Unpacking ()
+ if errors: return errors
+
+ def Configure_Cherokee (self):
+ # PHP
+ errors = self.php.Configure_Cherokee()
+ if errors: return errors
+
+ # Collect substitutions
+ props = cfg_get_surrounding_repls ('pre_rule', self.php.rule)
+ props.update (self.__dict__)
+
+ # Wordpress
+ if self.type == 'directory':
+ # Apply the configuration
+ config = self._config_directory %(props)
+ CTK.cfg.apply_chunk (config)
+
+ elif self.type == 'vserver':
+ # Apply the configuration
+ config = self._config_vserver %(props)
+ CTK.cfg.apply_chunk (config)
+
+ # Static files
+ vserver.Add_Usual_Static_Files (props['pre_rule_plus1'])
+
+ # Normalize rules
+ CTK.cfg.normalize ('vserver!%s!rule'%(self.vserver_num))

Modified: wizards2/wizards/02-Content Management Systems/wordpress.py
===================================================================
--- wizards2/wizards/02-Content Management Systems/wordpress.py 2011-07-30 15:50:24 UTC (rev 6777)
+++ wizards2/wizards/02-Content Management Systems/wordpress.py 2011-07-30 20:47:10 UTC (rev 6778)
@@ -22,10 +22,7 @@
# 02110-1301, USA.
#

-import os
-import re
import CTK
-import vserver
import Wizard2
import Wizard2_GUI

@@ -95,67 +92,22 @@
%(pre_rule_minus4)s!handler!rewrite!1!substring = %(directory)s/index.php?/$1
"""

+#
+# Installer
+#
+
TARBALL = "http://wordpress.org/latest.tar.gz"
-php_fpm = Wizard2.Load_Module ('01-Development Platforms/php-fpm.py')
+php_tpl = Wizard2.Load_Template ('PHP.py')

-
-class Install (Wizard2.Wizard):
+class Install (php_tpl.Install):
def __init__ (self, params):
- # Base
- Wizard2.Wizard.__init__ (self, "Wordpress", params)
+ php_tpl.Install.__init__ (self,
+ app_name = "Wordpress",
+ config_vserver = CONFIG_VSERVER,
+ config_directory = CONFIG_DIR,
+ tarball_url = TARBALL,
+ params = params)

- # Sibling wizard
- self.php = self._Register_Child_Wizard (php_fpm.Install (params))
-
- def Check_Parameters (self):
- # PHP
- errors = self.php.Check_Parameters()
-
- # App location
- errors += self._Check_Params_Install_Type (allows_dir=True, allows_vserver=True)
- errors += self._Check_Software_Location()
-
- return errors
-
- def Check_Prerequisites (self):
- # PHP
- errors = self.php.Check_Prerequisites()
- if errors: return errors
-
- # Wordpress
- errors = self._Handle_Download (tarball=TARBALL)
- if errors: return errors
-
- errors = self._Handle_Unpacking ()
- if errors: return errors
-
- def Configure_Cherokee (self):
- # PHP
- errors = self.php.Configure_Cherokee()
- if errors: return errors
-
- # Collect substitutions
- props = cfg_get_surrounding_repls ('pre_rule', self.php.rule)
- props.update (self.__dict__)
-
- # Wordpress
- if self.type == 'directory':
- # Apply the configuration
- config = CONFIG_DIR %(props)
- CTK.cfg.apply_chunk (config)
-
- elif self.type == 'vserver':
- # Apply the configuration
- config = CONFIG_VSERVER %(props)
- CTK.cfg.apply_chunk (config)
-
- # Static files
- vserver.Add_Usual_Static_Files (props['pre_rule_plus1'])
-
- # Normalize rules
- CTK.cfg.normalize ('vserver!%s!rule'%(self.vserver_num))
-
-
#
# GUI
#

Subject User Time
[6778] wizards2: WIP: Adds the first template, and works out the WP wizard prototype. cherokee at cherokee-project Jul 30, 2011, 1:47 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.