Add Leaflet.label plugin
This commit is contained in:
parent
4b7d8a314e
commit
d37d165839
2 changed files with 28 additions and 27 deletions
50
fabfile.py
vendored
50
fabfile.py
vendored
|
@ -73,16 +73,14 @@ def bootstrap(action=''):
|
|||
Bootstrap the environment.
|
||||
"""
|
||||
with hide('running', 'stdout'):
|
||||
exists = run('if [ -d "{virtualenv_dir}" ]; then echo 1; fi'\
|
||||
.format(**env))
|
||||
exists = run('if [ -d "{virtualenv_dir}" ]; then echo 1; fi'.format(**env))
|
||||
if exists and not action == 'force':
|
||||
puts('Assuming {host} has already been bootstrapped since '
|
||||
'{virtualenv_dir} exists.'.format(**env))
|
||||
return
|
||||
# run('mkvirtualenv {project_name}'.format(**env))
|
||||
with hide('running', 'stdout'):
|
||||
project_git_exists = run('if [ -d "{project_dir}" ]; then echo 1; fi'\
|
||||
.format(**env))
|
||||
project_git_exists = run('if [ -d "{project_dir}" ]; then echo 1; fi'.format(**env))
|
||||
if not project_git_exists:
|
||||
run('mkdir -p {0}'.format(posixpath.dirname(env.virtualenv_dir)))
|
||||
run('git clone {repository} {project_dir}'.format(**env))
|
||||
|
@ -91,8 +89,7 @@ def bootstrap(action=''):
|
|||
# sudo('chown -R {user} .'.format(**env))
|
||||
# fix_permissions()
|
||||
requirements()
|
||||
puts('Bootstrapped {host} - database creation needs to be done manually.'\
|
||||
.format(**env))
|
||||
puts('Bootstrapped {host} - database creation needs to be done manually.'.format(**env))
|
||||
|
||||
|
||||
@task
|
||||
|
@ -142,8 +139,7 @@ def update(action='check'):
|
|||
"""
|
||||
with cd(env.project_dir):
|
||||
remote, dest_branch = env.remote_ref.split('/', 1)
|
||||
run_as_umap('git fetch {remote}'.format(remote=remote,
|
||||
dest_branch=dest_branch, **env))
|
||||
run_as_umap('git fetch {remote}'.format(remote=remote))
|
||||
with hide('running', 'stdout'):
|
||||
changed_files = run('git diff-index --cached --name-only '
|
||||
'{remote_ref}'.format(**env)).splitlines()
|
||||
|
@ -170,7 +166,7 @@ def collectstatic():
|
|||
"""
|
||||
Collect static files from apps and other locations in a single location.
|
||||
"""
|
||||
collect_remote_statics()
|
||||
collect_remote_statics("storage")
|
||||
dj('collectstatic --link --noinput')
|
||||
dj('storagei18n')
|
||||
dj('compress')
|
||||
|
@ -209,8 +205,7 @@ def requirements(name=None, upgrade=False):
|
|||
"project_dir": env.project_dir,
|
||||
"requirements_file": env.requirements_file,
|
||||
}
|
||||
run_as_umap('{base_command} -r {project_dir}/{requirements_file}'\
|
||||
.format(**kwargs))
|
||||
run_as_umap('{base_command} -r {project_dir}/{requirements_file}'.format(**kwargs))
|
||||
else:
|
||||
run_as_umap('{base_command} {name}'.format(
|
||||
base_command=base_command,
|
||||
|
@ -218,20 +213,9 @@ def requirements(name=None, upgrade=False):
|
|||
))
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# Helper functions
|
||||
#==============================================================================
|
||||
|
||||
def dj(command):
|
||||
"""
|
||||
Run a Django manage.py command on the server.
|
||||
"""
|
||||
with cd(env.project_dir):
|
||||
run_as_umap('{virtualenv_dir}/bin/python {project_dir}/manage.py {dj_command} '
|
||||
'--settings {project_conf}'.format(dj_command=command, **env))
|
||||
|
||||
|
||||
def collect_remote_statics():
|
||||
@task
|
||||
@roles('web')
|
||||
def collect_remote_statics(name=None):
|
||||
"""
|
||||
Add leaflet and leaflet.draw in a repository watched by collectstatic.
|
||||
"""
|
||||
|
@ -252,9 +236,12 @@ def collect_remote_statics():
|
|||
'contextmenu': 'git://github.com/aratcliffe/Leaflet.contextmenu.git@master',
|
||||
'markercluster': 'git://github.com/Leaflet/Leaflet.markercluster.git@master#0.4',
|
||||
'measure': 'git://github.com/makinacorpus/Leaflet.MeasureControl.git@gh-pages',
|
||||
'label': 'git://github.com/Leaflet/Leaflet.label.git@master',
|
||||
}
|
||||
with cd(remote_static_dir):
|
||||
for subdir, path in remote_repositories.iteritems():
|
||||
if name and name != subdir:
|
||||
continue
|
||||
repository, branch = path.split('@')
|
||||
if "#" in branch:
|
||||
branch, ref = branch.split('#')
|
||||
|
@ -273,3 +260,16 @@ def collect_remote_statics():
|
|||
if subdir == "leaflet":
|
||||
run_as_umap('npm install')
|
||||
run_as_umap('jake build')
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# Helper functions
|
||||
#==============================================================================
|
||||
|
||||
def dj(command):
|
||||
"""
|
||||
Run a Django manage.py command on the server.
|
||||
"""
|
||||
with cd(env.project_dir):
|
||||
run_as_umap('{virtualenv_dir}/bin/python {project_dir}/manage.py {dj_command} '
|
||||
'--settings {project_conf}'.format(dj_command=command, **env))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<script src="{{ STATIC_URL }}markercluster/dist/leaflet.markercluster-src.js"></script>
|
||||
<script src="{{ STATIC_URL }}measure/leaflet.measurecontrol.js"></script>
|
||||
<script src="{{ STATIC_URL }}contextmenu/dist/leaflet.contextmenu-src.js"></script>
|
||||
<script src="{{ STATIC_URL }}label/dist/leaflet.label-src.js"></script>
|
||||
{% endcompress %}
|
||||
{% if locale %}
|
||||
<script src="{{ STATIC_URL }}storage/src/locale/{{ locale }}.js"></script>
|
||||
|
|
Loading…
Reference in a new issue