2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-13 16:56:33 +00:00

fixes to bench init

This commit is contained in:
Pratik Vyas 2014-07-11 10:25:20 +05:30
parent 1a86f8e238
commit db4327568f
3 changed files with 13 additions and 8 deletions

View File

@ -25,7 +25,7 @@ def new_app(app, bench='.'):
install_app(app, bench=bench)
def install_app(app, bench='.'):
exec_cmd("{pip} install -e {app}".format(pip=os.path.join(bench, 'env', 'bin', 'pip'), app=os.path.join('apps', app)))
exec_cmd("{pip} install -e {app}".format(pip=os.path.join(bench, 'env', 'bin', 'pip'), app=os.path.join(bench, 'apps', app)))
add_to_appstxt(app, bench=bench)
def pull_all_apps(bench='.'):

View File

@ -11,6 +11,7 @@ def get_frappe(bench='.'):
return frappe
def init(path):
from .app import get_app
if os.path.exists(path):
print 'Directory {} already exists!'.format(path)
sys.exit(1)
@ -19,6 +20,9 @@ def init(path):
for dirname in ('apps', 'sites', 'config', 'logs'):
os.mkdir(os.path.join(path, dirname))
setup_env(bench=path)
get_app('frappe', 'https://github.com/frappe/frappe.git', bench=path)
setup_backups(bench=path)
setup_auto_update(bench=path)
def exec_cmd(cmd, cwd='.'):
try:
@ -54,12 +58,12 @@ def get_bench_dir(bench='.'):
return os.path.abspath(bench)
def setup_auto_update():
exec_cmd('echo \"`crontab -l`\" | uniq | sed -e \"a0 10 * * * cd {bench_dir} && {bench} update\" | grep -v "^$" | uniq | crontab'.format(bench_dir=get_bench_dir(),
bench=os.path.join(get_bench_dir(), 'env', 'bin', 'bench')))
exec_cmd('echo \"`crontab -l`\" | uniq | sed -e \"a0 10 * * * cd {bench_dir} && {bench} update\" | grep -v "^$" | uniq | crontab'.format(bench_dir=get_bench_dir(bench=bench),
bench=os.path.join(get_bench_dir(bench=bench), 'env', 'bin', 'bench')))
def setup_backups():
exec_cmd('echo \"`crontab -l`\" | uniq | sed -e \"a0 */6 * * * cd {sites_dir} && {frappe} --backup all\" | grep -v "^$" | uniq | crontab'.format(sites_dir=get_sites_dir(),
frappe=get_frappe()))
def setup_backups(bench='.'):
exec_cmd('echo \"`crontab -l`\" | uniq | sed -e \"a0 */6 * * * cd {sites_dir} && {frappe} --backup all\" | grep -v "^$" | uniq | crontab'.format(sites_dir=get_sites_dir(bench=bench),
frappe=get_frappe(bench=bench)))
def update_bench():
cwd = os.path.dirname(os.path.abspath(__file__))

View File

@ -1,12 +1,13 @@
from setuptools import setup
from setuptools import setup, find_packages
setup(
name='bench',
version='0.1',
py_modules=['bench'],
py_modules=find_packages()
include_package_data=True,
install_requires=[
'Click',
'jinja2',
],
entry_points='''
[console_scripts]