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