mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 23:18:24 +00:00
fixes to bench init
This commit is contained in:
parent
1a86f8e238
commit
db4327568f
@ -25,7 +25,7 @@ def new_app(app, bench='.'):
|
|||||||
install_app(app, bench=bench)
|
install_app(app, bench=bench)
|
||||||
|
|
||||||
def install_app(app, 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)
|
add_to_appstxt(app, bench=bench)
|
||||||
|
|
||||||
def pull_all_apps(bench='.'):
|
def pull_all_apps(bench='.'):
|
||||||
|
@ -11,6 +11,7 @@ def get_frappe(bench='.'):
|
|||||||
return frappe
|
return frappe
|
||||||
|
|
||||||
def init(path):
|
def init(path):
|
||||||
|
from .app import get_app
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
print 'Directory {} already exists!'.format(path)
|
print 'Directory {} already exists!'.format(path)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -19,6 +20,9 @@ def init(path):
|
|||||||
for dirname in ('apps', 'sites', 'config', 'logs'):
|
for dirname in ('apps', 'sites', 'config', 'logs'):
|
||||||
os.mkdir(os.path.join(path, dirname))
|
os.mkdir(os.path.join(path, dirname))
|
||||||
setup_env(bench=path)
|
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='.'):
|
def exec_cmd(cmd, cwd='.'):
|
||||||
try:
|
try:
|
||||||
@ -54,12 +58,12 @@ def get_bench_dir(bench='.'):
|
|||||||
return os.path.abspath(bench)
|
return os.path.abspath(bench)
|
||||||
|
|
||||||
def setup_auto_update():
|
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(),
|
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(), 'env', 'bin', 'bench')))
|
bench=os.path.join(get_bench_dir(bench=bench), 'env', 'bin', 'bench')))
|
||||||
|
|
||||||
def setup_backups():
|
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(),
|
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()))
|
frappe=get_frappe(bench=bench)))
|
||||||
|
|
||||||
def update_bench():
|
def update_bench():
|
||||||
cwd = os.path.dirname(os.path.abspath(__file__))
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
5
setup.py
5
setup.py
@ -1,12 +1,13 @@
|
|||||||
from setuptools import setup
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='bench',
|
name='bench',
|
||||||
version='0.1',
|
version='0.1',
|
||||||
py_modules=['bench'],
|
py_modules=find_packages()
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'Click',
|
'Click',
|
||||||
|
'jinja2',
|
||||||
],
|
],
|
||||||
entry_points='''
|
entry_points='''
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user