mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-03-17 14:00:22 +00:00
313 lines
No EOL
10 KiB
XML
313 lines
No EOL
10 KiB
XML
<?xml version='1.0' encoding='UTF-8'?>
|
|
<dev><file for="vagrant"><path>Vagrantfile</path>
|
|
<contents>Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "bento/ubuntu-16.04"
|
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
|
config.vm.synced_folder "../django-markdownx", "/srv/django-markdownx", create: true
|
|
config.vm.provision :shell, :path => "bootstrap.sh", privileged: false
|
|
config.vm.network :forwarded_port, guest: 8000, host: 8000
|
|
config.vm.hostname = "django-markdownx"
|
|
config.ssh.forward_agent = true
|
|
|
|
config.vm.provider "virtualbox" do |vb|
|
|
vb.name = "django-markdownx"
|
|
vb.gui = true
|
|
vb.customize ["modifyvm", :id,
|
|
"--memory", "512",
|
|
"--ioapic", "on",
|
|
"--cpus", "2"]
|
|
end
|
|
end</contents>
|
|
</file>
|
|
<file for="vagrant"><path>bootstrap.sh</path>
|
|
<contents>#!/usr/bin/env bash
|
|
|
|
# NOTE: Python alias
|
|
alias python=python3
|
|
|
|
# NOTE: Install dependencies
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y gettext build-essential pkg-config nodejs-legacy npm python3-dev libjpeg-dev zlib1g-dev python-virtualenv virtualenvwrapper
|
|
|
|
# NOTE: Install virtual environment
|
|
source /etc/bash_completion.d/virtualenvwrapper
|
|
mkvirtualenv --python=/usr/bin/python3 --no-site-packages --unzip-setuptools django-markdownx
|
|
pip install --upgrade pip
|
|
pip install -r /srv/django-markdownx/requirements.txt
|
|
|
|
# NOTE: Folders
|
|
sudo chown vagrant:vagrant /srv
|
|
|
|
# NOTE: Bash
|
|
sudo sed -i '$a cd /srv/django-markdownx/' ~/.bashrc
|
|
sudo sed -i '$a workon django-markdownx' ~/.bashrc
|
|
|
|
# NOTE: Install Node modules, compile static files and run migrations
|
|
cd /srv/django-markdownx/
|
|
npm install
|
|
npm run dist
|
|
./manage.py migrate
|
|
|
|
echo -e '\e[33;1;5mDONE!\e[0m \e[33;1;3m Connect using "vagrant ssh" \e[0m'</contents>
|
|
</file>
|
|
<file for="npm"><path>package.json</path>
|
|
<contents>{
|
|
"name": "django-markdownx",
|
|
"description": "Django Markdownx frontend (JavaScript).",
|
|
"version": "2.0.0",
|
|
"author": "Adi, Pouria Hadjibagheri",
|
|
"license": "2-clause BSD",
|
|
"engines": {
|
|
"node": ">=0.10",
|
|
"npm": ">=1.3"
|
|
},
|
|
|
|
"devDependencies": {
|
|
"watch": "~1",
|
|
"typescript": "~2.2",
|
|
"uglify-js": "~2.7",
|
|
"browserify": "~14.1",
|
|
"clean-css-cli": "~4"
|
|
},
|
|
|
|
"config": {
|
|
"tsfolder": "markdownx/.static/markdownx/js",
|
|
"jsoutput": "markdownx/static/markdownx/js",
|
|
|
|
"cssfolder": "markdownx/.static/markdownx/admin/css",
|
|
"cssoutput": "markdownx/static/markdownx/admin/css"
|
|
},
|
|
|
|
"scripts": {
|
|
"build:ts": "tsc -p $npm_package_config_tsfolder/tsconfig.json",
|
|
"build:js": "npm run build:ts && browserify $npm_package_config_tsfolder/markdownx.js -o $npm_package_config_jsoutput/markdownx.js && uglifyjs $npm_package_config_jsoutput/markdownx.js -o $npm_package_config_jsoutput/markdownx.js --beautify --stats",
|
|
"build:css": "cleancss $npm_package_config_cssfolder/markdownx.css -o $npm_package_config_cssoutput/markdownx.css --format beautify --debug",
|
|
"build": "npm run build:js && npm run build:css",
|
|
|
|
"dist:js": "npm run build:ts && browserify $npm_package_config_tsfolder/markdownx.js -o $npm_package_config_jsoutput/markdownx.js && uglifyjs $npm_package_config_jsoutput/markdownx.js -o $npm_package_config_jsoutput/markdownx.min.js --screw-ie8 --mangle --stats",
|
|
"dist:css": "npm run build:css && cleancss $npm_package_config_cssfolder/markdownx.css -o $npm_package_config_cssoutput/markdownx.min.css --compatibility ie9 --debug",
|
|
"dist": "npm run dist:js && npm run dist:css",
|
|
|
|
"watch:js": "watch 'npm run build:js' $npm_package_config_tsfolder -d -u",
|
|
"watch:css": "watch 'npm run build:css' $npm_package_config_cssfolder -d -u"
|
|
}
|
|
}</contents>
|
|
</file>
|
|
<file for="vagrant;docker"><path>runtests.py</path>
|
|
<contents>from __future__ import absolute_import
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), 'markdownx'))
|
|
|
|
import django
|
|
from django.conf import settings
|
|
|
|
configure_settings = {
|
|
'DATABASES': {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': ':memory:',
|
|
}
|
|
},
|
|
'INSTALLED_APPS': [
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.staticfiles',
|
|
'markdownx',
|
|
],
|
|
'DEBUG': False,
|
|
'STATIC_URL': '/static/',
|
|
'TEMPLATES': [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [
|
|
os.path.join(os.path.abspath(os.path.dirname(__file__)), 'markdownx/tests/templates'),
|
|
],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.i18n',
|
|
'django.template.context_processors.media',
|
|
'django.template.context_processors.static',
|
|
'django.template.context_processors.tz',
|
|
'django.contrib.messages.context_processors.messages',
|
|
],
|
|
'debug': True,
|
|
},
|
|
},
|
|
],
|
|
'ROOT_URLCONF': 'tests.urls',
|
|
}
|
|
|
|
settings.configure(**configure_settings)
|
|
django.setup()
|
|
|
|
from django.test.utils import get_runner
|
|
test_runner = get_runner(settings)
|
|
failures = test_runner(
|
|
verbosity=1,
|
|
interactive=False,
|
|
failfast=False).run_tests(['tests'])
|
|
sys.exit(failures)</contents>
|
|
</file>
|
|
<file for="docs">
|
|
<path>Makefile</path>
|
|
<contents># Minimal makefile for Sphinx documentation
|
|
#
|
|
|
|
# You can set these variables from the command line.
|
|
SPHINXOPTS =
|
|
SPHINXBUILD = sphinx-build
|
|
SPHINXPROJ = DjangoMarkdownx
|
|
SOURCEDIR = docs-src
|
|
BUILDDIR = docs
|
|
|
|
# Put it first so that "make" without argument is like "make help".
|
|
help:
|
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
|
|
.PHONY: help Makefile
|
|
|
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
%: Makefile
|
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)</contents>
|
|
</file>
|
|
<file for="docs"><path>create_docs.sh</path>
|
|
<contents>#!/usr/bin/env bash
|
|
|
|
# Compile the docs.
|
|
make clean
|
|
make html
|
|
|
|
mv ./docs/html/* ./docs/
|
|
|
|
# Open in the browser.
|
|
URL="docs/index.html"
|
|
|
|
echo "Documentations index file: $URL"
|
|
|
|
[[ -x $BROWSER ]] &amp;&amp; exec "$BROWSER" "$URL"
|
|
path=$(which xdg-open || which gnome-open || which open) &amp;&amp; exec "$path" "$URL"
|
|
echo "Built the docs - but couldn't find a browser to open them."
|
|
</contents>
|
|
</file>
|
|
<file for="vagrant;docker;no-container">
|
|
<path>manage.py</path>
|
|
<contents>#!/usr/bin/env python
|
|
import os
|
|
import sys
|
|
|
|
if __name__ == "__main__":
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testapp.settings")
|
|
try:
|
|
from django.core.management import execute_from_command_line
|
|
except ImportError:
|
|
# The above import may fail for some other reason. Ensure that the
|
|
# issue is really that Django is missing to avoid masking other
|
|
# exceptions on Python 2.
|
|
try:
|
|
import django
|
|
except ImportError:
|
|
raise ImportError(
|
|
"Couldn't import Django. Are you sure it's installed and "
|
|
"available on your PYTHONPATH environment variable? Did you "
|
|
"forget to activate a virtual environment?"
|
|
)
|
|
raise
|
|
execute_from_command_line(sys.argv)</contents>
|
|
</file>
|
|
<file for="docker"><path>Dockerfile</path>
|
|
<contents>FROM python:3.6
|
|
ENV PYTHONUNBUFFERED 1
|
|
RUN mkdir /markdownx
|
|
WORKDIR /markdownx
|
|
ADD requirements.txt /markdownx/
|
|
RUN python3.6 -m pip install -U setuptools
|
|
RUN python3.6 -m pip install -r requirements.txt
|
|
ADD . /markdownx/</contents>
|
|
</file>
|
|
<file for="docker"><path>docker-compose.yml</path>
|
|
<contents>version: '2'
|
|
services:
|
|
web:
|
|
restart: always
|
|
build: .
|
|
command: python3.6 manage.py runserver 0.0.0.0:8000
|
|
volumes:
|
|
- .:/markdownx
|
|
ports:
|
|
- "8000:8000"
|
|
|
|
mem_limit: 500m
|
|
cpuset: "1"</contents>
|
|
</file>
|
|
<file for="vagrant;docker;no-container"><path>runtests.py</path>
|
|
<contents>from __future__ import absolute_import
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), 'markdownx'))
|
|
|
|
import django
|
|
from django.conf import settings
|
|
|
|
configure_settings = {
|
|
'DATABASES': {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': ':memory:',
|
|
}
|
|
},
|
|
'INSTALLED_APPS': [
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.staticfiles',
|
|
'markdownx',
|
|
],
|
|
'DEBUG': False,
|
|
'STATIC_URL': '/static/',
|
|
'TEMPLATES': [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [
|
|
os.path.join(os.path.abspath(os.path.dirname(__file__)), 'markdownx/tests/templates'),
|
|
],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.i18n',
|
|
'django.template.context_processors.media',
|
|
'django.template.context_processors.static',
|
|
'django.template.context_processors.tz',
|
|
'django.contrib.messages.context_processors.messages',
|
|
],
|
|
'debug': True,
|
|
},
|
|
},
|
|
],
|
|
'ROOT_URLCONF': 'tests.urls',
|
|
}
|
|
|
|
settings.configure(**configure_settings)
|
|
django.setup()
|
|
|
|
from django.test.utils import get_runner
|
|
test_runner = get_runner(settings)
|
|
failures = test_runner(
|
|
verbosity=1,
|
|
interactive=False,
|
|
failfast=False).run_tests(['tests'])
|
|
sys.exit(failures)</contents>
|
|
</file>
|
|
</dev> |