Permalink
Browse files

progressing on updater

  • Loading branch information...
1 parent 614f337 commit 9e84e691505de5b8378222ff732752790e327fa9 @cwoebker committed Dec 27, 2011
Showing with 75 additions and 46 deletions.
  1. +14 −2 relo/__init__.py
  2. +2 −1 relo/core/config.py
  3. +4 −2 relo/core/etc/config.cfg
  4. +55 −41 relo/core/update.py
  5. 0 stable-version.txt → version.txt
View
@@ -18,7 +18,7 @@
from relo.core.util import mkdirs
__author__ = "cwoebker"
-__version__ = config.get_long_version()
+__version__ = config.get_version()
__copyright__ = "© cwoebker"
__license__ = "See in LICENSE file"
@@ -39,6 +39,7 @@ def main():
update = reloParsers.add_parser('update', help='update help')
update.set_defaults(which='update')
+ update.add_argument('key', help="master/develop")
config = reloParsers.add_parser('config', help='config help')
#config.set_defaults(which='config')
@@ -122,15 +123,26 @@ def main():
core.init()
+ ########## CONFIG ##########
if results.which.startswith('config'):
if results.which == 'config.list':
conf.listConfig(None)
if results.which == 'config.write':
conf.writeConfig(results.key, results.value)
if results.which == 'config.read':
print conf.readConfig(results.key)
+ ########## UPDATE ##########
elif results.which == 'update':
- pass
+ from relo.core.update import ReloUpdater
+ curVersion = __version__
+ relo = ReloUpdater(curVersion)
+ if results.key in ['master', 'develop']:
+ relo.update(results.key)
+ logger.info(relo.localVersion)
+ logger.info(relo.remoteVersion)
+ else:
+ logger.error('Invalid Repo-Key')
+ ########## CRAWL ##########
elif results.which == 'crawl':
url = results.url
View
@@ -99,7 +99,8 @@ def writeConfig(self, key, value):
RELO_UPDATE_URL_PYPI = conf.readConfig('core.pypi')
RELO_UPDATE_URL_CONFIG = conf.readConfig('core.config')
-RELO_STABLE_VERSION_URL = conf.readConfig('core.stable-version')
+RELO_MASTER_VERSION_URL = conf.readConfig('core.master-version')
+RELO_DEVELOP_VERSION_URL = conf.readConfig('core.develop-version')
### Relo Index -> move to config file later
##### Inverted Index Variables #####
View
@@ -1,13 +1,15 @@
[core]
+git = git://github.com/cwoebker/relo.git
+http = https://github.com/cwoebker/relo.git
master = https://github.com/cwoebker/relo/tarball/master
develop = https://github.com/cwoebker/relo/tarball/develop
pypi = http://pypi.python.org/packages/source/p/relo/relo-%%s.tar.gz
-stable-version = https://github.com/cwoebker/relo/raw/master/stable-version.txt
+master-version = https://github.com/cwoebker/relo/raw/master/version.txt
+develop-version = https://github.com/cwoebker/relo/raw/develop/version.txt
config = https://github.com/cwoebker/relo/raw/master/relo/etc/config.cfg
index = REDISDB
-
[local]
[net]
View
@@ -1,54 +1,68 @@
#!/usr/bin/env python
# encoding: utf-8
+from relo.core.log import logger
+from relo.core.config import conf, RELO_DEVELOP_VERSION_URL, RELO_MASTER_VERSION_URL
+import urllib
+
class AbstractUpdater(object):
- def __init__(self):
- localVersion = 0
- remoteVersion = 0
- pass
- def getLocalVersion(self):
- pass
- def getRemoteVersion(self):
- pass
- def executeUpdate(self):
- pass
+ def __init__(self):
+ self.localVersion = 0
+ self.remoteVersion = 0
+ def getLocalVersion(self):
+ pass
+ def getRemoteVersion(self):
+ pass
+ def executeUpdate(self):
+ pass
class ReloUpdater(AbstractUpdater):
- """
- Updates the relo library itself.
- """
- def __init__(self):
- super.__init__()
+ """
+ Updates the relo library itself.
+ """
+ def __init__(self, curVersion):
+ self.localVersion = curVersion
+ def check(self):
+ if self.key == 'master':
+ url = RELO_MASTER_VERSION_URL
+ elif self.key == 'develop':
+ url = RELO_DEVELOP_VERSION_URL
+ logger.log('Checking remote version...')
+ remote = urllib.urlopen(url)
+ self.remoteVersion = remote.read()
+ def update(self, key):
+ self.key = key
+ self.check()
class DocTypeUpdater(AbstractUpdater):
- """
- Updates the doctype plugins that are used for local search.
- Own git repo for doctypes?!?
- """
- def __init__(self):
- super.__init__()
- localDocTypeList = []
- remoteDocTypeList = []
- def getLocalList(self):
- """
- Returns the local doctype plugins in list format.
- With the version number included
- [['pdf', 1.2],['txt', 2.1]]
- """
- pass
- def getRemoteList(self):
- pass
- def getLocalVersion(self):
- pass
- def getRemoteVersion(self):
- pass
+ """
+ Updates the doctype plugins that are used for local search.
+ Own git repo for doctypes?!?
+ """
+ def __init__(self):
+ super.__init__()
+ localDocTypeList = []
+ remoteDocTypeList = []
+ def getLocalList(self):
+ """
+ Returns the local doctype plugins in list format.
+ With the version number included
+ [['pdf', 1.2],['txt', 2.1]]
+ """
+ pass
+ def getRemoteList(self):
+ pass
+ def getLocalVersion(self):
+ pass
+ def getRemoteVersion(self):
+ pass
class ExtensionUpdater(AbstractUpdater):
- """
- Updates relo's extensions.
- """
- def __init__(self):
- super.__init__()
+ """
+ Updates relo's extensions.
+ """
+ def __init__(self):
+ super.__init__()
class BackendUpdater(AbstractUpdater):
"""
File renamed without changes.

0 comments on commit 9e84e69

Please sign in to comment.