Skip to content

Commit

Permalink
Virtstrap Basic Template with paster
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven V. Gonzales committed Jul 15, 2011
1 parent 61055b9 commit 8db31f2
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 0 deletions.
7 changes: 7 additions & 0 deletions example/buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[buildout]
parts = python

[python]
recipe = zc.recipe.egg
interpreter = python
eggs =
Empty file added example/other_requirements.txt
Empty file.
1 change: 1 addition & 0 deletions example/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "hello world ************************************"
6 changes: 6 additions & 0 deletions example/vsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"package_name": "virtbootstrap",
"env_types": ["pip", "buildout", "shell_script"],
"shell_script_file": "test.sh",
"pip_requirements_file": "requirements.txt"
}
36 changes: 36 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
VirtStrap
=========
A bootstrapping mechanism for virtualenv, buildout, and shell scripts.
"""
from setuptools import setup, find_packages

setup(
name="VirtStrap",
version="0.1",
license="MIT",
author="Reuven V. Gonzales",
url="http://tobetter.us",
author_email="reuven@tobetter.us",
description="A simple boostrapping mechanism for virtualenv, buildout and shell scripts",
packages=find_packages(exclude=['tests', 'tests.*']),
zip_safe=False,
platforms='*nix',
install_requires=[
"PasteScript>=1.3",
],
entry_points="""
[paste.paster_create_template]
virtstrap_basic = virtstrap.entry.template:VirtStrapBasicTemplate
""",
classifiers = [
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
],
)



Empty file added virtstrap/__init__.py
Empty file.
Empty file added virtstrap/entry/__init__.py
Empty file.
31 changes: 31 additions & 0 deletions virtstrap/entry/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import shutil
import os
from paste.script import templates

VIRTSTRAP_PY_FILENAME = "virtstrap.py"
VIRTSTRAP_PY_SRC_ROOT = "../"

class VirtStrapTemplateBase(templates.Template):
def write_files(self, command, output_dir, vars):
super(VirtStrapTemplateBase, self).write_files(command,
output_dir, vars)

print "Creating {0} file for virtstrapping".format(
VIRTSTRAP_PY_FILENAME)

#Get directory for current file
file_directory = os.path.abspath(os.path.dirname(__file__))
#Calculate source directory
virtstrap_src = os.path.join(file_directory, VIRTSTRAP_PY_SRC_ROOT,
VIRTSTRAP_PY_FILENAME)
#Calculate destination directory
virtstrap_dest = os.path.join(output_dir, VIRTSTRAP_PY_FILENAME)

#Copy the current virtstrap.py file into the new project
shutil.copyfile(virtstrap_src, virtstrap_dest)

class VirtStrapBasicTemplate(VirtStrapTemplateBase):

summary = "Creates a basic virtstrapped project"
required_templates = ['basic_package']
_template_dir = "../templates/basic/"
2 changes: 2 additions & 0 deletions virtstrap/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==0.7.2
ipython
Empty file.
Empty file.

0 comments on commit 8db31f2

Please sign in to comment.