Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: JoeGermuska/Cactus
base: 61ad762384
...
head fork: JoeGermuska/Cactus
compare: b6fab5dffa
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 20 additions and 15 deletions.
  1. +4 −4 cactus/cli.py
  2. +16 −10 cactus/site.py
  3. +0 −1  requirements.txt
View
8 cactus/cli.py
@@ -20,9 +20,9 @@
'''
def _init_parser():
parser = argparse.ArgumentParser(description=description)
- parser.add_argument('command',metavar="COMMAND", help="The command to execute (one of [create|build|serve|deploy] )")
- parser.add_argument('option1',metavar="OPTION1", nargs='?', help="option 1")
- parser.add_argument('option2',metavar="OPTION2", nargs='?', help="option 2")
+ parser.add_argument('command', metavar="COMMAND", help="The command to execute (one of [create|build|serve|deploy] )")
+ parser.add_argument('option1', metavar="OPTION1", nargs='?', help="option 1")
+ parser.add_argument('option2', metavar="OPTION2", nargs='?', help="option 2")
parser.add_argument('--skeleton', required=False, help="If provided, the path to a .tar.gz file or a directory which will be used in place of the default 'skeleton' for a cactus project.")
return parser
@@ -83,7 +83,7 @@ def main():
# Run the command
if command == 'create':
if not option1: exit('Missing path')
- create(option1,args)
+ create(option1, args)
elif command == 'build':
build(os.getcwd())
View
26 cactus/site.py
@@ -11,6 +11,7 @@
import socket
import tempfile
import tarfile
+import zipfile
import boto
@@ -64,12 +65,12 @@ def verify(self):
logging.info('This does not look like a (complete) cactus project (missing "%s" subfolder)', p)
sys.exit()
- def bootstrap(self,skeleton=None):
+ def bootstrap(self, skeleton=None):
"""
Bootstrap a new project at a given path.
"""
- skeleton_tarball = None
+ skeletonArchive = None
if skeleton is None:
from .skeleton import data
logging.info("Building from data")
@@ -77,22 +78,27 @@ def bootstrap(self,skeleton=None):
skeletonFile.write(base64.b64decode(data))
skeletonFile.close()
skeleton_tarball = skeletonFile.name
+ skeletonArchive = tarfile.open(name=skeleton_tarball, mode='r')
elif os.path.isfile(skeleton):
- if skeleton.endswith('.tar.gz') or skeleton.endswith('.tgz'):
- skeleton_tarball = skeleton
+ if tarfile.is_tarfile(skeleton):
+ skeletonArchive = tarfile.open(name=skeleton, mode='r')
+ elif zipfile.is_zipfile(skeleton):
+ skeletonArchive = zipfile.ZipFile(skeleton)
else:
- logging.error("At this time, skeleton argument must be a tarball or a directory (ending with .tar.gz or .tgz extension).")
+ logging.error("Unknown file archive type. At this time, skeleton argument must be a directory, a zipfile, or a tarball.")
sys.exit()
- if skeleton_tarball:
+ if skeletonArchive:
+ print skeletonArchive
os.mkdir(self.path)
- skeletonArchive = tarfile.open(name=skeleton_tarball, mode='r')
skeletonArchive.extractall(path=self.path)
skeletonArchive.close()
+ logging.info('New project generated at %s', self.path)
elif os.path.isdir(skeleton):
- shutil.copytree(skeleton,self.path)
-
- logging.info('New project generated at %s', self.path)
+ shutil.copytree(skeleton, self.path)
+ logging.info('New project generated at %s', self.path)
+ else:
+ logging.error("Cannot process skeleton '%s'. At this time, skeleton argument must be a directory, a zipfile, or a tarball." % skeleton)
def context(self):
"""
View
1  requirements.txt
@@ -1,4 +1,3 @@
Django==1.5
Markdown==2.2.1
boto==2.8.0
-wsgiref==0.1.2

No commit comments for this range

Something went wrong with that request. Please try again.