Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new skel

  • Loading branch information...
commit fc6230ba9df35e11bb258660c0ba4778ebfa220d 1 parent c60d225
@fiorix authored
Showing with 91 additions and 20 deletions.
  1. +15 −0 appskel/autogen.sh
  2. 0  {foreman → appskel/default}/.gitignore
  3. 0  { → appskel}/default/README.md
  4. 0  {foreman → appskel/default}/frontend/locale/es_ES/LC_MESSAGES/modname.mo
  5. 0  {foreman → appskel/default}/frontend/locale/es_ES/LC_MESSAGES/modname.po
  6. 0  {foreman → appskel/default}/frontend/locale/pt_BR/LC_MESSAGES/modname.mo
  7. 0  {foreman → appskel/default}/frontend/locale/pt_BR/LC_MESSAGES/modname.po
  8. 0  {foreman → appskel/default}/frontend/static/favicon.ico
  9. 0  {foreman → appskel/default}/frontend/template/base.html
  10. 0  {foreman → appskel/default}/frontend/template/index.html
  11. 0  {foreman → appskel/default}/frontend/template/post.html
  12. 0  { → appskel}/default/modname.conf
  13. 0  {foreman → appskel/default}/modname/__init__.py
  14. 0  { → appskel}/default/modname/config.py
  15. +57 −0 appskel/default/modname/storage.py
  16. 0  { → appskel}/default/modname/utils.py
  17. 0  { → appskel}/default/modname/views.py
  18. 0  { → appskel}/default/modname/web.py
  19. 0  {foreman → appskel/default}/scripts/cookie_secret.py
  20. 0  { → appskel}/default/scripts/debian-init.d
  21. 0  { → appskel}/default/scripts/debian-multicore-init.d
  22. 0  {foreman → appskel/default}/scripts/localefix.py
  23. 0  { → appskel}/default/start.sh
  24. 0  { → appskel}/foreman/.env
  25. 0  {default → appskel/foreman}/.gitignore
  26. 0  { → appskel}/foreman/Procfile
  27. 0  { → appskel}/foreman/README.md
  28. 0  {default → appskel/foreman}/frontend/locale/es_ES/LC_MESSAGES/modname.mo
  29. 0  {default → appskel/foreman}/frontend/locale/es_ES/LC_MESSAGES/modname.po
  30. 0  {default → appskel/foreman}/frontend/locale/pt_BR/LC_MESSAGES/modname.mo
  31. 0  {default → appskel/foreman}/frontend/locale/pt_BR/LC_MESSAGES/modname.po
  32. 0  {default → appskel/foreman}/frontend/static/favicon.ico
  33. 0  {default → appskel/foreman}/frontend/template/base.html
  34. 0  {default → appskel/foreman}/frontend/template/index.html
  35. 0  {default → appskel/foreman}/frontend/template/post.html
  36. 0  { → appskel}/foreman/modname.conf
  37. 0  {default → appskel/foreman}/modname/__init__.py
  38. 0  { → appskel}/foreman/modname/config.py
  39. 0  { → appskel}/foreman/modname/main.py
  40. 0  { → appskel}/foreman/modname/utils.py
  41. 0  { → appskel}/foreman/modname/views.py
  42. 0  { → appskel}/foreman/modname/web.py
  43. 0  { → appskel}/foreman/requirements.txt
  44. 0  {default → appskel/foreman}/scripts/cookie_secret.py
  45. 0  {default → appskel/foreman}/scripts/localefix.py
  46. +19 −20 cyclone/app.py
  47. BIN  cyclone/appskel_default.zip
  48. BIN  cyclone/appskel_foreman.zip
View
15 appskel/autogen.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+cd `dirname $0`
+for d in `find . -type d -depth 1 -exec basename {} \;`
+do
+ name="appskel_$d.zip"
+ skel="../../cyclone/${name}"
+ echo Generating ${name}...
+ rm -f $skel
+ cd $d
+ zip -r $skel .
+ cd ..
+ echo done
+done
View
0  foreman/.gitignore → appskel/default/.gitignore
File renamed without changes
View
0  default/README.md → appskel/default/README.md
File renamed without changes
View
0  ...ntend/locale/es_ES/LC_MESSAGES/modname.mo → ...ntend/locale/es_ES/LC_MESSAGES/modname.mo
File renamed without changes
View
0  ...ntend/locale/es_ES/LC_MESSAGES/modname.po → ...ntend/locale/es_ES/LC_MESSAGES/modname.po
File renamed without changes
View
0  ...ntend/locale/pt_BR/LC_MESSAGES/modname.mo → ...ntend/locale/pt_BR/LC_MESSAGES/modname.mo
File renamed without changes
View
0  ...ntend/locale/pt_BR/LC_MESSAGES/modname.po → ...ntend/locale/pt_BR/LC_MESSAGES/modname.po
File renamed without changes
View
0  foreman/frontend/static/favicon.ico → appskel/default/frontend/static/favicon.ico
File renamed without changes
View
0  foreman/frontend/template/base.html → appskel/default/frontend/template/base.html
File renamed without changes
View
0  foreman/frontend/template/index.html → appskel/default/frontend/template/index.html
File renamed without changes
View
0  foreman/frontend/template/post.html → appskel/default/frontend/template/post.html
File renamed without changes
View
0  default/modname.conf → appskel/default/modname.conf
File renamed without changes
View
0  foreman/modname/__init__.py → appskel/default/modname/__init__.py
File renamed without changes
View
0  default/modname/config.py → appskel/default/modname/config.py
File renamed without changes
View
57 appskel/default/modname/storage.py
@@ -0,0 +1,57 @@
+# coding: utf-8
+#
+$license
+
+
+import cyclone.redis
+try:
+ sqlite_ok = True
+ import cyclone.sqlite
+except ImportError, sqlite_err:
+ sqlite_ok = False
+
+from twisted.enterprise import adbapi
+from twisted.python import log
+
+
+class DatabaseMixin(object):
+ mysql = None
+ redis = None
+ sqlite = None
+
+ @classmethod
+ def setup(cls, conf):
+ if "sqlite_settings" in conf:
+ if sqlite_ok:
+ DatabaseMixin.sqlite = \
+ cyclone.sqlite.InlineSQLite(conf["sqlite_settings"].database)
+ else:
+ log.err("SQLite is currently disabled: %s" % sqlite_err)
+
+ if "redis_settings" in conf:
+ if conf["redis_settings"].get("unixsocket"):
+ DatabaseMixin.redis = \
+ cyclone.redis.lazyUnixConnectionPool(
+ conf["redis_settings"].unixsocket,
+ conf["redis_settings"].dbid,
+ conf["redis_settings"].poolsize)
+ else:
+ DatabaseMixin.redis = \
+ cyclone.redis.lazyConnectionPool(
+ conf["redis_settings"].host,
+ conf["redis_settings"].port,
+ conf["redis_settings"].dbid,
+ conf["redis_settings"].poolsize)
+
+ if "mysql_settings" in conf:
+ DatabaseMixin.mysql = \
+ adbapi.ConnectionPool("MySQLdb",
+ host=conf["mysql_settings"].host,
+ port=conf["mysql_settings"].port,
+ db=conf["mysql_settings"].database,
+ user=conf["mysql_settings"].username,
+ passwd=conf["mysql_settings"].password,
+ cp_min=1,
+ cp_max=conf["mysql_settings"].poolsize,
+ cp_reconnect=True,
+ cp_noisy=conf["mysql_settings"].debug)
View
0  default/modname/utils.py → appskel/default/modname/utils.py
File renamed without changes
View
0  default/modname/views.py → appskel/default/modname/views.py
File renamed without changes
View
0  default/modname/web.py → appskel/default/modname/web.py
File renamed without changes
View
0  foreman/scripts/cookie_secret.py → appskel/default/scripts/cookie_secret.py
File renamed without changes
View
0  default/scripts/debian-init.d → appskel/default/scripts/debian-init.d
File renamed without changes
View
0  default/scripts/debian-multicore-init.d → ...l/default/scripts/debian-multicore-init.d
File renamed without changes
View
0  foreman/scripts/localefix.py → appskel/default/scripts/localefix.py
File renamed without changes
View
0  default/start.sh → appskel/default/start.sh
File renamed without changes
View
0  foreman/.env → appskel/foreman/.env
File renamed without changes
View
0  default/.gitignore → appskel/foreman/.gitignore
File renamed without changes
View
0  foreman/Procfile → appskel/foreman/Procfile
File renamed without changes
View
0  foreman/README.md → appskel/foreman/README.md
File renamed without changes
View
0  ...ntend/locale/es_ES/LC_MESSAGES/modname.mo → ...ntend/locale/es_ES/LC_MESSAGES/modname.mo
File renamed without changes
View
0  ...ntend/locale/es_ES/LC_MESSAGES/modname.po → ...ntend/locale/es_ES/LC_MESSAGES/modname.po
File renamed without changes
View
0  ...ntend/locale/pt_BR/LC_MESSAGES/modname.mo → ...ntend/locale/pt_BR/LC_MESSAGES/modname.mo
File renamed without changes
View
0  ...ntend/locale/pt_BR/LC_MESSAGES/modname.po → ...ntend/locale/pt_BR/LC_MESSAGES/modname.po
File renamed without changes
View
0  default/frontend/static/favicon.ico → appskel/foreman/frontend/static/favicon.ico
File renamed without changes
View
0  default/frontend/template/base.html → appskel/foreman/frontend/template/base.html
File renamed without changes
View
0  default/frontend/template/index.html → appskel/foreman/frontend/template/index.html
File renamed without changes
View
0  default/frontend/template/post.html → appskel/foreman/frontend/template/post.html
File renamed without changes
View
0  foreman/modname.conf → appskel/foreman/modname.conf
File renamed without changes
View
0  default/modname/__init__.py → appskel/foreman/modname/__init__.py
File renamed without changes
View
0  foreman/modname/config.py → appskel/foreman/modname/config.py
File renamed without changes
View
0  foreman/modname/main.py → appskel/foreman/modname/main.py
File renamed without changes
View
0  foreman/modname/utils.py → appskel/foreman/modname/utils.py
File renamed without changes
View
0  foreman/modname/views.py → appskel/foreman/modname/views.py
File renamed without changes
View
0  foreman/modname/web.py → appskel/foreman/modname/web.py
File renamed without changes
View
0  foreman/requirements.txt → appskel/foreman/requirements.txt
File renamed without changes
View
0  default/scripts/cookie_secret.py → appskel/foreman/scripts/cookie_secret.py
File renamed without changes
View
0  default/scripts/localefix.py → appskel/foreman/scripts/localefix.py
File renamed without changes
View
39 cyclone/app.py
@@ -25,8 +25,8 @@
import uuid
import zipfile
-DEFAULT_LICENSE = """# Copyright 2010 Alexandre Fiori
-# based on the original Tornado by Facebook
+DEFAULT_LICENSE = """# Copyright YEAR Foo Bar
+# Powered by cyclone
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -54,15 +54,16 @@ def new_project(**kwargs):
else:
ext = n.rsplit(".", 1)[-1]
fd = open(os.path.join(dst, mod), "w", 0644)
- if ext in ("conf", "html", "py", "md", "sh") or n in ('Procfile'):
+ if ext in ("conf", "html", "py", "md", "sh", "d") or \
+ n in ("Procfile"):
fd.write(string.Template(zf.read(n)).substitute(kwargs))
else:
fd.write(zf.read(n))
fd.close()
# make sure we can actually run start.sh
- if os.path.exists(os.path.join(dst, 'start.sh')):
- os.chmod(os.path.join(dst, 'start.sh'), 0755)
+ if os.path.exists(os.path.join(dst, "start.sh")):
+ os.chmod(os.path.join(dst, "start.sh"), 0755)
if kwargs["use_git"] is True:
os.chdir(kwargs["project_path"])
@@ -82,8 +83,8 @@ def usage(version, target):
-s --set-pkg-version Set version on package name [default: False]
-t --target=PATH Set path where project is created [default: %s]
-l --license=FILE Append the following license file [default: Apache 2]
- -f --foreman Create a foreman based project (suited to run on heroku
- and other PaaS)
+ -f --foreman Create a foreman based project \
+(suited to run on heroku and other PaaS)
""" % (version, target))
sys.exit(0)
@@ -93,15 +94,15 @@ def main():
modname = None
use_git = False
set_pkg_version = False
- license_file = None
default_version, version = "0.1", None
default_target, target = os.getcwd(), None
- foreman = False
+ license_file = None
+ skel = "default"
- shortopts = "hgsp:m:v:t:l:f"
+ shortopts = "hgsp:m:v:t:l:s"
longopts = ["help", "git", "set-pkg-version",
"project=", "modname=", "version=", "target=", "license=",
- "foreman"]
+ "appskel="]
try:
opts, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
except getopt.GetoptError:
@@ -131,10 +132,13 @@ def main():
elif o in ("-l", "--license"):
license_file = a
-
- elif o in ("-f", "--foreman"):
- foreman = True
+ elif o in ("-s", "--appskel"):
+ if a in ("default", "foreman"):
+ skel = a
+ else:
+ print("Invalid appskel name: %s" % a)
+ sys.exit(1)
if license_file is None:
license = DEFAULT_LICENSE
@@ -177,11 +181,6 @@ def main():
"'%s': permission denied" % target)
sys.exit(1)
- if foreman is False:
- skel_file = "app_skel.zip"
- else:
- skel_file = "foreman_skel.zip"
-
name = "Foo Bar"
email = "root@localhost"
if use_git is True:
@@ -200,7 +199,7 @@ def main():
skel = zipfile.ZipFile(open(
os.path.join(os.path.dirname(os.path.abspath(__file__)),
- skel_file), "rb"))
+ "appskel_%s.zip" % skel), "rb"))
if set_pkg_version is True:
project_name = "%s-%s" % (project, version)
View
BIN  cyclone/appskel_default.zip
Binary file not shown
View
BIN  cyclone/appskel_foreman.zip
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.