Commit e8d30084 authored by Fabien Amarger's avatar Fabien Amarger

Create editorjs cube

parent d7680b146cab
Pipeline #60618 passed with stages
in 2 minutes and 41 seconds
default:
image: python
# avoid running duplicate pipelines for both topic head and MR
# see: https://docs.gitlab.com/ee/ci/yaml/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_REF_NAME =~ /^topic\/.*/ && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always
stages:
- lint
- tests
- after-tests
before_script:
- pip install tox
flake8:
stage: lint
script: tox -e flake8
check-manifest:
stage: lint
script: tox -e check-manifest
black:
stage: lint
script: tox -e black
yamllint:
rules:
- changes:
- "**/*.yaml"
- "**/*.yml"
stage: lint
before_script:
- pip install tox
script:
- tox -e yamllint
# If you have mypy set up
# mypy:
# stage: lint
# script: tox -e mypy
py3:
stage: tests
script: tox -e py3
# If you have your project on readthedocs, you can automatically trigger its
# build by setting:
# - READTHEDOCS_TOKEN
# - READTHEDOCS_ID
# in your heptapod project Settings > CI/CD > Variables.
# You can find those secrets by creating a new integration in your readthedocs
# project here: https://readthedocs.org/dashboard/cubicweb_editorjs/integrations/
#
# Related documentation:
# https://docs.readthedocs.io/en/latest/webhooks.html#using-the-generic-api-integration
#
# trigger-readthedocs:
# only:
# refs:
# - branch/default
# stage: after-tests
# script:
# # regarding the " everywhere when there is a '%': yaml is extremly weird when % are involved
# - curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/cubicweb_editorjs/${READTHEDOCS_ID} -w "\nhttp code:"\ "%{http_code}\n" -f
syntax: glob
*~
#*
*.bak
*.old
*.pyo
*.pyc
*.cache
*.swp
*.swo
*.mo
*.lock
*.sqlite
__pycache__
*.egg-info
.tox/
.pybuild
.cache
.coverage
.pytest-cache
build/
dist/
node_modules/
.mypy_cache/
debian/*.log
debian/*.substvars
debian/files
test/data/database/
test/data/ldapdb/
test/data/uicache/
docs/_build
ignore: |
.tox/
node_modules/
extends: default
rules:
document-start: disable
line-length: disable
include *.py
include */*.py
recursive-include cubicweb_editorjs *.py
recursive-include cubicweb_editorjs/data *.gif *.png *.ico *.css *.js
recursive-include cubicweb_editorjs/i18n *.po
recursive-include cubicweb_editorjs/wdoc *
recursive-include test/data bootstrap_cubes *.py
include *.ini
prune debian
exclude cubicweb-editorjs.spec
exclude .gitlab-ci.yml
exclude .yamllint
Summary
-------
Add editorjs format for RichString
"""cubicweb-editorjs application package
Add editorjs format for RichString
"""
def includeme(config):
pass
# pylint: disable=W0622
"""cubicweb-editorjs application packaging information"""
modname = "cubicweb_editorjs"
distname = "cubicweb-editorjs"
numversion = (0, 1, 0)
version = ".".join(str(num) for num in numversion)
license = "LGPL"
author = "LOGILAB S.A. (Paris, FRANCE)"
author_email = "contact@logilab.fr"
description = "Add editorjs format for RichString"
web = "http://www.cubicweb.org/project/%s" % distname
__depends__ = {"cubicweb": ">= 3.31.1"}
__recommends__ = {}
classifiers = [
"Environment :: Web Environment",
"Framework :: CubicWeb",
"Programming Language :: Python :: 3",
"Programming Language :: JavaScript",
]
# -*- coding: utf-8 -*-
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs entity's classes"""
# -*- coding: utf-8 -*-
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs specific hooks and operations"""
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
# -*- coding: utf-8 -*-
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs postcreate script, executed at instance creation time or when
the cube is added to an existing instance.
You could setup site properties or a workflow here for example.
"""
# Example of site property change
# set_property('ui.site-title', "<sitename>")
# -*- coding: utf-8 -*-
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs schema"""
# -*- coding: utf-8 -*-
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs views/forms/actions/components for web ui"""
cubicweb-editorjs (0.1.0-1) UNRELEASED; urgency=medium
* Initial release.
-- LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr> Tue, 08 Jun 2021 14:10:01 +0000
Source: cubicweb-editorjs
Section: web
Priority: optional
Maintainer: LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
Build-Depends:
debhelper (>= 9),
dh-python,
python3-all,
python3-setuptools,
python3-pytest,
Standards-Version: 4.3.0
X-Python3-Version: >= 3.4
Package: python3-cubicweb-editorjs
Architecture: all
Depends:
${python3:Depends},
${misc:Depends},
Description: Add editorjs format for RichString
CubicWeb is a semantic web application framework.
.
Add editorjs format for RichString
.
This package will install all the components you need to run an application
using the cubicweb-editorjs cube.
Upstream Author:
LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
Copyright:
Copyright (c) 2021 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr -- mailto:contact@logilab.fr
test
tox.ini
cubicweb-editorjs.egg-info
#!/usr/bin/make -f
export PYBUILD_NAME = cubicweb-editorjs
export PYBUILD_OPTION = --test-pytest
%:
dh $@ --with python3 --buildsystem=pybuild
extend-diff-ignore = "^([^/]*\.spec$)"
Tests: pytest
Depends:
@builddeps@,
# Uncomment if the tests require database access
# python3-cubicweb-postgresql-support
Restrictions:
allow-stderr,
# Uncomment if the tests require database access
# isolation-container,
#!/bin/sh
set -e
set -x
### Setup tests
# Uncomment if tests require database access
#service postgresql restart || service postgresql start
#trap 'service postgresql stop' EXIT
cp -r test tox.ini "$AUTOPKGTEST_TMP"
chown -R nobody:nogroup "$AUTOPKGTEST_TMP"
### Run tests
for py in $(py3versions -r 2>/dev/null); do
cd "$AUTOPKGTEST_TMP"
echo "Testing with $py:"
su nobody --shell /bin/sh \
-c "$py -m pytest -v"
done
#!/usr/bin/env python
# pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611
#
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This file is part of a cubicweb-editorjs.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb_editorjs setup module using data from
cubicweb_editorjs/__pkginfo__.py file
"""
from os.path import join, dirname
from setuptools import find_packages, setup
here = dirname(__file__)
# load metadata from the __pkginfo__.py file so there is no risk of conflict
# see https://packaging.python.org/en/latest/single_source_version.html
pkginfo = join(here, "cubicweb_editorjs", "__pkginfo__.py")
__pkginfo__ = {}
with open(pkginfo) as f:
exec(f.read(), __pkginfo__)
# get required metadatas
distname = __pkginfo__["distname"]
version = __pkginfo__["version"]
license = __pkginfo__["license"]
description = __pkginfo__["description"]
web = __pkginfo__["web"]
author = __pkginfo__["author"]
author_email = __pkginfo__["author_email"]
classifiers = __pkginfo__["classifiers"]
with open(join(here, "README")) as f:
long_description = f.read()
# get optional metadatas
data_files = __pkginfo__.get("data_files", None)
dependency_links = __pkginfo__.get("dependency_links", ())
requires = {}
for entry in ("__depends__",): # "__recommends__"):
requires.update(__pkginfo__.get(entry, {}))
install_requires = [
"{0} {1}".format(d, v and v or "").strip() for d, v in requires.items()
]
setup(
name=distname,
version=version,
license=license,
description=description,
long_description=long_description,
author=author,
author_email=author_email,
url=web,
classifiers=classifiers,
packages=find_packages(exclude=["test"]),
install_requires=install_requires,
include_package_data=True,
entry_points={
"cubicweb.cubes": [
"editorjs=cubicweb_editorjs",
],
},
zip_safe=False,
)
# copyright 2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-editorjs automatic tests
uncomment code below if you want to activate automatic test for your cube:
.. sourcecode:: python
from cubicweb.devtools.testlib import AutomaticWebTest
class AutomaticWebTest(AutomaticWebTest):
'''provides `to_test_etypes` and/or `list_startup_views` implementation
to limit test scope
'''
def to_test_etypes(self):
'''only test views for entities of the returned types'''
return set(('My', 'Cube', 'Entity', 'Types'))
def list_startup_views(self):
'''only test startup views of the returned identifiers'''
return ('some', 'startup', 'views')
"""
from cubicweb.devtools import testlib
class DefaultTC(testlib.CubicWebTC):
def test_something(self):
self.skipTest("this cube has no test")
if __name__ == "__main__":
from unittest import main
main()
[tox]
envlist = py3,flake8,check-manifest,black
[testenv]
deps =
pytest
commands =
{envpython} -m pytest {posargs:test}
[testenv:flake8]
basepython = python3
skip_install = true
deps =
flake8 >= 3.6
commands = flake8
[testenv:check-manifest]
skip_install = true
deps =
check-manifest
commands =
{envpython} -m check_manifest {toxinidir}
[testenv:mypy]
deps =
mypy >= 0.761
commands = mypy --ignore-missing-imports cubicweb_editorjs
[testenv:black]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black --check .
[testenv:black-run]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black .
[testenv:pypi-publish]
basepython = python3
skip_install = true
whitelist_externals = rm
deps =
twine
passenv =
TWINE_USERNAME
TWINE_PASSWORD
commands =
rm -rf build dist .egg .egg-info
python3 setup.py sdist bdist_wheel
twine check dist/*
twine upload --skip-existing dist/*
[testenv:deb-publish]
passenv = JENKINS_USER JENKINS_TOKEN
basepython = python3
skip_install = true
whitelist_externals =
rm
sh
hg
deps =
httpie
commands =
hg clean --all --dirs --files
rm -rf build dist .egg .egg-info
python3 setup.py sdist
sh -c "PACKAGE_NAME=$(python3 setup.py --name) && VERSION=$(python3 setup.py --version) && \
cd dist && \
tar xf $PACKAGE_NAME-$VERSION.tar.gz && \
cd $PACKAGE_NAME-$VERSION && \
cp -a {toxinidir}/debian . && \
mk-origtargz --rename ../$PACKAGE_NAME-$VERSION.tar.gz && \
dpkg-buildpackage -us -uc --no-check-builddeps --build=source "
sh -c "cd dist && dcmd zip latest.zip *.changes"
http -f POST https://{env:JENKINS_USER}:{env:JENKINS_TOKEN}@jenkins.intra.logilab.fr/job/pkg-from-dsc/buildWithParameters DIST=buster source.zip@dist/latest.zip REPO=buster PUBLISH=true
[testenv:yamllint]
skip_install = true
deps = yamllint
commands =