From 4973aa88f2ddef0a67f8278e5411416dc392e39f Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 29 Jun 2015 20:47:24 +0300 Subject: [PATCH] qt_types test fixed Sphinx doc added --- doc/CHANGELOG_sphinx_deployment.md | 45 +++++ doc/LICENSE_sphinx_deployment | 27 +++ doc/README_sphinx_deployment.md | 251 +++++++++++++++++++++++++ doc/_themes/sphinx_rtd_theme | 1 + doc/conf.py | 284 +++++++++++++++++++++++++++++ doc/index.rst | 22 +++ doc/requirements.txt | 4 + doc/rsync_exclude | 1 + doc/sphinx_deployment.mk | 202 ++++++++++++++++++++ doc/spxd.sh | 119 ++++++++++++ src/private/qt_types_p.cpp | 24 --- tests/qttypes/qttypes_test.cpp | 10 +- 12 files changed, 961 insertions(+), 29 deletions(-) create mode 100644 doc/CHANGELOG_sphinx_deployment.md create mode 100644 doc/LICENSE_sphinx_deployment create mode 100644 doc/README_sphinx_deployment.md create mode 120000 doc/_themes/sphinx_rtd_theme create mode 100644 doc/conf.py create mode 100644 doc/index.rst create mode 100644 doc/requirements.txt create mode 100644 doc/rsync_exclude create mode 100644 doc/sphinx_deployment.mk create mode 100755 doc/spxd.sh diff --git a/doc/CHANGELOG_sphinx_deployment.md b/doc/CHANGELOG_sphinx_deployment.md new file mode 100644 index 0000000..fc25cc3 --- /dev/null +++ b/doc/CHANGELOG_sphinx_deployment.md @@ -0,0 +1,45 @@ +Change Log +========== + +[0.3.0][] (2013-11-26) +---------------------- + +- Improvement + + [SPXD-10] - Deploy vX.X.X tag to docs/X.X.X instead of docs/vX.X.X + +- New Feature + + [SPXD-9] - PaaS deployment: heroku + +- Migration (from v0.2.0 to v0.3.0) + + `REPO_URL` was changed to `REPO_URL_GITHUB` + + `DEPLOY_BRANCH` was changed to `DEPLOY_BRANCH_GITHUB` + + `$ make push` was changed to `$ make deploy_gh_pages` + + `$ make rsync` was changed to `$ make deploy_rsync` + + +[0.2.0][] (2013-09-26) +---------------------- + +- Improvement + + [SPXD-6] - remove duplication of git init when setup_gh_pages + +- New Feature + + [SPXD-5] - Rsync support + + +[0.1.0][] (2013-08-18) +---------------------- + +- Improvement + + [SPXD-2] - remove "make init_gh_pages" step + +- New Feature + + [SPXD-1] - make gen_deploy + + [SPXD-3] - installation bash script + + +[0.1.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?version=10003&styleName=Text&projectId=10405&Create=Create&atl_token=BD5N-YNBS-EHHQ-478Z%7C87dd31199258f9de5ade180582481463461ded32%7Clin + +[0.2.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?projectId=10405&version=10004 + +[0.3.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?projectId=10405&version=10301 diff --git a/doc/LICENSE_sphinx_deployment b/doc/LICENSE_sphinx_deployment new file mode 100644 index 0000000..113810e --- /dev/null +++ b/doc/LICENSE_sphinx_deployment @@ -0,0 +1,27 @@ +Copyright (c) Teracy, Inc. and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/README_sphinx_deployment.md b/doc/README_sphinx_deployment.md new file mode 100644 index 0000000..bf2e388 --- /dev/null +++ b/doc/README_sphinx_deployment.md @@ -0,0 +1,251 @@ +sphinx-deployment +================= + +Automatic setup and deployment for [sphinx][] docs. + +This project is intended to be used to deploy [sphinx][] project on: + +- [Github Pages](https://help.github.com/categories/20/articles) +- [Rsync](http://en.wikipedia.org/wiki/Rsync) +- PaaS services: [heroku](http://heroku.com/), etc. + +Usage +----- + +**1. `$ make generate`** + +For generating contents, alias for `$ make html` + +**2. `$ make deploy`** + +For short-cut deployment, it could be `$ make deploy_gh_pages`, `$ make deploy_rsync` or +`$ make deploy_heroku` basing on the configuration of `DEPLOY_DEFAULT`. + +**3. `$ make gen_deploy`** + +For short-cut generation and deployment: `$ make generate` and then `$ make deploy`. + +**4. `$ make setup_gh_pages`** + +For the first time only to create `$(DEPLOY_DIR)` to track `$(DEPLOY_BRANCH)`. This is used for +github pages deployment. + +**5. `$ make setup_heroku`** + +For the first time only to create `$(DEPLOY_DIR_HEROKU` to track the Heroku repo's master branch. +This is used for heroku deployment. + +**6. `$ make deploy_gh_pages`** + +For deploying with github pages only. + +**7. `$ make deploy_rsync`** + +For deploying with rsync only. + +**8. `$ make deploy_heroku`** + +For deploying with heroku only. + + +Installation +------------ + +**1. Bash script** + +Just run this bash script from your root git repository project and it's enough. + +You need to specify the `` to your sphinx docs directory: + +``` bash +$ cd +$ wget https://raw.github.com/teracy-official/sphinx-deployment/master/scripts/spxd.sh && chmod +x ./spxd.sh && ./spxd.sh -p +``` + +For example: + +``` bash +$ cd my_project +$ wget https://raw.github.com/teracy-official/sphinx-deployment/master/scripts/spxd.sh && chmod +x ./spxd.sh && ./spxd.sh -p ./docs +``` + +**2. Manual** + +a. You need to copy these following files to your [sphinx][] directory: + +- `docs/requirements` +- `docs/sphinx_deployment.mk` +- `docs/rsync_exclude` +- `docs/.deploy_heroku/*` +- `docs/.gitignore` + +b. Include `sphinx_deployment.mk` to your `Makefile`: + +- Add the content below to your `Makefile`: + +``` +include sphinx_deployment.mk +``` + +- Or do with commands on terminal: + +``` bash +echo '' >> Makefile +echo 'include sphinx_deployment.mk' >> Makefile +``` + + +c.. To build with `travis-ci`, you need to copy these following files to your root project directory: + +- `.travis.yml` +- `.travis/setup.sh` + + +Configuration +------------- + +You need to configure these following deployment configurations following your project settings on +`sphinx_deployment.mk` file. + +``` Makefile +# Deployment configurations from sphinx_deployment project + +# default deployment when $ make deploy +# deploy_gh_pages : to $ make deploy_gh_pages +# deploy_rsync : to $ make deploy_rsync +# deploy_heroku : to $ make deploy_heroku +# deploy_gh_pages deploy_rsync deploy_heroku : to $ make deploy_gh_pages then $ make deploy_rsync +# and then $ make deploy_heroku +# default value: deploy_gh_pages +ifndef DEPLOY_DEFAULT +DEPLOY_DEFAULT = deploy_gh_pages +endif + +# The deployment directory to be deployed +ifndef DEPLOY_DIR +DEPLOY_DIR = _deploy +endif + +# The heroku deployment directory to be deployed +# we must create this separated dir to avoid any conflict with _deploy (rsync and gh_pages) +ifndef DEPLOY_DIR_HEROKU +DEPLOY_DIR_HEROKU = _deploy_heroku +endif + +# Copy contents from $(BUILDDIR) to $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) directory +ifndef DEPLOY_HTML_DIR +DEPLOY_HTML_DIR = docs +endif + + +## -- Rsync Deploy config -- ## +# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file +ifndef SSH_USER +SSH_USER = user@domain.com +endif + +ifndef SSH_PORT +SSH_PORT = 22 +endif + +ifndef DOCUMENT_ROOT +DOCUMENT_ROOT = ~/website.com/ +endif + +#If you choose to delete on sync, rsync will create a 1:1 match +ifndef RSYNC_DELETE +RSYNC_DELETE = false +endif + +# Any extra arguments to pass to rsync +ifndef RSYNC_ARGS +RSYNC_ARGS = +endif + +## -- Github Pages Deploy config -- ## + +# Configure the right deployment branch +ifndef DEPLOY_BRANCH_GITHUB +DEPLOY_BRANCH_GITHUB = gh-pages +endif + +#if REPO_URL_GITHUB was NOT defined by travis-ci +ifndef REPO_URL_GITHUB +# Configure your right github project repo +# REPO_URL = git@github.com:teracy-official/sphinx-deployment.git +endif + +## -- Heroku Deployment Config -- ## + +ifndef REPO_URL_HEROKU +# Configure your right heroku repo +# REPO_URL_HEROKU = git@heroku.com:spxd.git +endif + + +## end deployment configuration, don't edit anything below this line ## +####################################################################### +``` + +Continuous Integration Build +---------------------------- + +**1. `travis-ci`** + +Move `.travis.yml` file to your root repository project, and configure it following its +instruction there. There is a supported `.travis/setup.sh` to export variables for `Makefile` +depending on the being-built branch. + +To configure secure token for `travis-ci`, please read the similar step described at +http://blog.teracy.com/2013/08/03/how-to-start-blogging-easily-with-octopress-and-teracy-dev/ + + +**2. `jenkins`** + +//TODO + + +Authors and contributors +------------------------ + +- Hoat Le: http://github.com/hoatle + +- Many thanks to http://octopress.org/docs/deploying/ for inspiration. + +License +------- + +BSD License + +``` +Copyright (c) Teracy, Inc. and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +``` + +[sphinx]: http://sphinx-doc.org diff --git a/doc/_themes/sphinx_rtd_theme b/doc/_themes/sphinx_rtd_theme new file mode 120000 index 0000000..4ecbeb5 --- /dev/null +++ b/doc/_themes/sphinx_rtd_theme @@ -0,0 +1 @@ +/usr/local/lib/python2.7/dist-packages/sphinx_rtd_theme \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..0fff4ce --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,284 @@ +# -*- coding: utf-8 -*- +# +# qmsgpack documentation build configuration file, created by +# sphinx-quickstart on Sun Jun 28 11:29:36 2015. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'qmsgpack' +copyright = u'2015, Roman Isaikin' +author = u'Roman Isaikin' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0.0rc' +# The full version, including alpha/beta/rc tags. +release = '1.0.0rc' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = ["_themes", ] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +#html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +#html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'qmsgpackdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', + +# Latex figure (float) alignment +#'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'qmsgpack.tex', u'qmsgpack Documentation', + u'Roman Isaikin', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'qmsgpack', u'qmsgpack Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'qmsgpack', u'qmsgpack Documentation', + author, 'qmsgpack', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..98f232c --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,22 @@ +.. qmsgpack documentation master file, created by + sphinx-quickstart on Sun Jun 28 11:29:36 2015. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to qmsgpack's documentation! +==================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..3a5211b --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,4 @@ +# pip requirements for docs generation +# pip install -r docs/requirements.txt + +Sphinx \ No newline at end of file diff --git a/doc/rsync_exclude b/doc/rsync_exclude new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/doc/rsync_exclude @@ -0,0 +1 @@ +.git diff --git a/doc/sphinx_deployment.mk b/doc/sphinx_deployment.mk new file mode 100644 index 0000000..2b838d5 --- /dev/null +++ b/doc/sphinx_deployment.mk @@ -0,0 +1,202 @@ +# Copyright (c) Teracy, Inc. and individual contributors. +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: + +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. + +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. + +# 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used +# to endorse or promote products derived from this software without +# specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Deployment configurations from sphinx_deployment project + +# default deployment when $ make deploy +# deploy_gh_pages : to $ make deploy_gh_pages +# deploy_rsync : to $ make deploy_rsync +# deploy_heroku : to $ make deploy_heroku +# deploy_gh_pages deploy_rsync deploy_heroku : to $ make deploy_gh_pages then $ make deploy_rsync +# and then $ make deploy_heroku +# default value: deploy_gh_pages +ifndef DEPLOY_DEFAULT +DEPLOY_DEFAULT = deploy_rsync +endif + +# The deployment directory to be deployed +ifndef DEPLOY_DIR +DEPLOY_DIR = _build/html/ +endif + +# The heroku deployment directory to be deployed +# we must create this separated dir to avoid any conflict with _deploy (rsync and gh_pages) +ifndef DEPLOY_DIR_HEROKU +DEPLOY_DIR_HEROKU = _deploy_heroku +endif + +# Copy contents from $(BUILDDIR) to $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) directory +ifndef DEPLOY_HTML_DIR +DEPLOY_HTML_DIR = ../_deploy +endif + + +## -- Rsync Deploy config -- ## +# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file +ifndef SSH_USER +SSH_USER = roman@marsworks.ru +endif + +ifndef SSH_PORT +SSH_PORT = 22 +endif + +ifndef DOCUMENT_ROOT +DOCUMENT_ROOT = /var/www/roman/data/www/msgpack.marsworks.ru/ +endif + +#If you choose to delete on sync, rsync will create a 1:1 match +ifndef RSYNC_DELETE +RSYNC_DELETE = true +endif + +# Any extra arguments to pass to rsync +ifndef RSYNC_ARGS +RSYNC_ARGS = +endif + +## -- Github Pages Deploy config -- ## + +# Configure the right deployment branch +ifndef DEPLOY_BRANCH_GITHUB +DEPLOY_BRANCH_GITHUB = gh-pages +endif + +#if REPO_URL_GITHUB was NOT defined by travis-ci +ifndef REPO_URL_GITHUB +# Configure your right github project repo +# REPO_URL = git@github.com:teracy-official/sphinx-deployment.git +endif + +## -- Heroku Deployment Config -- ## + +ifndef REPO_URL_HEROKU +# Configure your right heroku repo +# REPO_URL_HEROKU = git@heroku.com:spxd.git +endif + + +## end deployment configuration, don't edit anything below this line ## +####################################################################### + +ifeq ($(RSYNC_DELETE), true) +RSYNC_DELETE_OPT = --delete +endif + +init_gh_pages: + @rm -rf $(DEPLOY_DIR) + @mkdir -p $(DEPLOY_DIR) + @cd $(DEPLOY_DIR); git init;\ + echo 'sphinx docs comming soon...' > index.html;\ + touch .nojekyll;\ + git add .; git commit -m "sphinx docs init";\ + git branch -m $(DEPLOY_BRANCH_GITHUB);\ + git remote add origin $(REPO_URL_GITHUB); + @cd $(DEPLOY_DIR);\ + if ! git ls-remote origin $(DEPLOY_BRANCH_GITHUB) | grep $(DEPLOY_BRANCH_GITHUB) ; then \ + echo "Preparing Github deployment branch: $(DEPLOY_BRANCH_GITHUB) for the first time only...";\ + git push -u origin $(DEPLOY_BRANCH_GITHUB);\ + fi + +setup_gh_pages: init_gh_pages + @echo "Setting up gh-pages deployment..." + @cd $(DEPLOY_DIR);\ + git fetch origin;\ + git reset --hard origin/$(DEPLOY_BRANCH_GITHUB);\ + git branch --set-upstream $(DEPLOY_BRANCH_GITHUB) origin/$(DEPLOY_BRANCH_GITHUB) + @echo "Now you can deploy to Github Pages with 'make generate' and then 'make deploy_gh_pages'" + +init_heroku: + @rm -rf $(DEPLOY_DIR_HEROKU) + @mkdir -p $(DEPLOY_DIR_HEROKU) + @cd $(DEPLOY_DIR_HEROKU); git init;\ + cp -r ../.deploy_heroku/* .;\ + echo 'sphinx docs comming soon...' > public/index.html;\ + git add .; git commit -m "sphinx docs init";\ + git remote add origin $(REPO_URL_HEROKU); + @cd $(DEPLOY_DIR_HEROKU);\ + if ! git ls-remote origin master | grep master ; then\ + echo "Preparing Heroku deployment for the first time only...";\ + git push -u origin master;\ + fi + +setup_heroku: init_heroku + @echo "setting up heroku deployment..." + @cd $(DEPLOY_DIR_HEROKU);\ + git fetch origin;\ + git reset --hard origin/master;\ + git branch --set-upstream master origin/master + @echo "Now you can deploy to Heroku with 'make generate' and then 'make deploy_heroku'" + +generate: html + +prepare_rsync_deployment: + @echo "Preparing rsync deployment..." + @mkdir -p $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) + @echo "Copying files from '$(BUILDDIR)/html/.' to '$(DEPLOY_DIR)/$(DEPLOY_HTML_DIR)'" + @cp -r $(BUILDDIR)/html/. $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) + +deploy_rsync: prepare_rsync_deployment + @echo "Deploying on rsync now..." + rsync -avze 'ssh -p $(SSH_PORT)' --exclude-from $(realpath ./rsync_exclude) $(RSYNC_ARGS) $(RSYNC_DELETE_OPT) ${DEPLOY_DIR}/ $(SSH_USER):$(DOCUMENT_ROOT) + +prepare_gh_pages_deployment: + @echo "Preparing gh_pages deployment..." + @echo "Pulling any updates from Github Pages..." + @cd $(DEPLOY_DIR); git pull; + @mkdir -p $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) + @echo "Copying files from '$(BUILDDIR)/html/.' to '$(DEPLOY_DIR)/$(DEPLOY_HTML_DIR)'" + @cp -r $(BUILDDIR)/html/. $(DEPLOY_DIR)/$(DEPLOY_HTML_DIR) + +deploy_gh_pages: prepare_gh_pages_deployment + @echo "Deploying on github pages now..." + @cd $(DEPLOY_DIR); git add -A; git commit -m "docs updated at `date -u`";\ + git push origin $(DEPLOY_BRANCH) --quiet + @echo "Github Pages deploy was completed at `date -u`" + +prepare_heroku_deployment: + @echo "Preparing heroku deployment..." + @echo "Pulling any updates from Heroku..." + @cd $(DEPLOY_DIR_HEROKU); git pull; + @mkdir -p $(DEPLOY_DIR_HEROKU)/public/$(DEPLOY_HTML_DIR) + @echo "Copying files from .deploy_heroku to $(DEPLOY_DIR_HEROKU)" + @cp -r .deploy_heroku/. $(DEPLOY_DIR_HEROKU) + @echo "Copying files from '$(BUILDDIR)/html/.' to '$(DEPLOY_DIR_HEROKU)/public/$(DEPLOY_HTML_DIR)'" + @cp -r $(BUILDDIR)/html/. $(DEPLOY_DIR_HEROKU)/public/$(DEPLOY_HTML_DIR) + + +deploy_heroku: prepare_heroku_deployment + @echo "Deploying on heroku now..." + @cd $(DEPLOY_DIR_HEROKU); git add -A; git commit -m "docs updated at `date -u`";\ + git push origin master --quiet + @echo "Heroku deployment was completed at `date -u`" + + +deploy: $(DEPLOY_DEFAULT) + +gen_deploy: generate deploy diff --git a/doc/spxd.sh b/doc/spxd.sh new file mode 100755 index 0000000..9865fa3 --- /dev/null +++ b/doc/spxd.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +# spxd bash script to install sphinx-deployment to your sphinx docs project. +# +############################################################################ +# Usage: +# spxd.sh [options] +# +# Options: +# -h Help +# -p Install sphinx_deployment to a specified docs path +############################################################################ +# Example to install on +# $ cd +# $ wget https://raw.github.com/teracy-official/sphinx-deployment/master/scripts/spxd.sh && chmod +x ./spxd.sh && ./spxd.sh -p ./docs +# + +function command_exists() { + type "$1" &> /dev/null; +} + +function require() { + if ! command_exists git ; then + echo "Error: 'git' is required for installation, please install 'git' first." + echo "Installation aborted!" + exit 1 + fi +} + +function usage() { + echo "Usage:" + echo " spxd.sh [options]" + echo "" + echo "Options:" + echo " -h Help" + echo " -p Install sphinx_deployment to a specified docs path" +} + +function install() { + # assume that the current working directory is the root git repository directory + # to copy travis-ci stuff into this directory + local project_root_path=`pwd` + # relative or absolute ? + if [[ $1 =~ ^\/ ]]; then + local docs_path=$1 + else + local docs_path="$project_root_path/$1" + fi + + echo "installing sphinx_deployment to '$docs_path'..." + cd /tmp + rm -rf sphinx-deployment + git clone https://github.com/teracy-official/sphinx-deployment.git + cd sphinx-deployment + git fetch origin + git checkout origin/master + # test + # git clone https://github.com/hoatle/sphinx-deployment.git + # cd sphinx-deployment + # git fetch origin + # git checkout origin/features/3_installation_bash_script + # copy required stuff + + echo "copying required files..." + mkdir -p $docs_path + mkdir -p $docs_path/.deploy_heroku + cp -r docs/* $docs_path + cp docs/.gitignore $docs_path + cp -r docs/.deploy_heroku/* $docs_path/.deploy_heroku + cp .travis.yml $project_root_path + mkdir -p $project_root_path/.travis + cp -r .travis/* $project_root_path/.travis + + # copy meta stuff + echo "copying meta files..." + cp CHANGELOG.md $docs_path/CHANGELOG_sphinx_deployment.md + cp LICENSE $docs_path/LICENSE_sphinx_deployment + cp README.md $docs_path/README_sphinx_deployment.md + + # clean up + cd .. + rm -rf sphinx-deployment + + # add sphinx-deployment.mk to Makefile only if not added yet + cd $docs_path + if [ -f Makefile ] && ! grep -q sphinx_deployment.mk Makefile ; then + echo '' >> Makefile + echo 'include sphinx_deployment.mk' >> Makefile + fi + + echo '' + echo "installation completed, please read $docs_path/README_sphinx_deployment.md for usage." +} + +# check requirements +require + +while getopts ":p:h" opt; do + case $opt in + p) + install $OPTARG + exit 0 + ;; + h) + usage + exit 0 + ;; + \?) + echo "Invalid options -$OPTARG" >&2 + exit 1 + ;; + :) + if [ $OPTARG == "p" ]; then + echo "Option -$OPTARG requires argument." >&2 + fi + exit 1 + ;; + esac +done diff --git a/src/private/qt_types_p.cpp b/src/private/qt_types_p.cpp index 56246b5..41ebfc2 100644 --- a/src/private/qt_types_p.cpp +++ b/src/private/qt_types_p.cpp @@ -98,8 +98,6 @@ QTime MsgPackPrivate::unpack_qtime_raw(quint8 *p, bool with_ms) QByteArray MsgPackPrivate::pack_qtime(const QVariant &variant) { QTime time = variant.toTime(); - if (time.isNull()) - return QByteArray("\xc0", 1); quint8 size = time.msec() == 0 ? 2 : 4; QByteArray data; data.resize(size); @@ -109,8 +107,6 @@ QByteArray MsgPackPrivate::pack_qtime(const QVariant &variant) QVariant MsgPackPrivate::unpack_qtime(const QByteArray &data) { - if (data.size() == 1) - return QTime(); return unpack_qtime_raw((quint8 *)data.data(), data.size() == 4); } @@ -139,8 +135,6 @@ QDate MsgPackPrivate::unpack_qdate_raw(quint8 *p) QByteArray MsgPackPrivate::pack_qdate(const QVariant &variant) { QDate date = variant.toDate(); - if (date.isNull()) - return QByteArray("\xc0", 1); QByteArray data; data.resize(3); pack_qdate_raw(variant.toDate(), (quint8 *)data.data()); @@ -149,16 +143,12 @@ QByteArray MsgPackPrivate::pack_qdate(const QVariant &variant) QVariant MsgPackPrivate::unpack_qdate(const QByteArray &data) { - if (data.size() == 1) - return QDate(); return unpack_qdate_raw((quint8 *)data.data()); } QByteArray MsgPackPrivate::pack_qdatetime(const QVariant &variant) { QDateTime dt = variant.toDateTime(); - if (dt.isNull()) - return QByteArray("\xc0", 1); quint8 time_size = dt.time().msec() == 0 ? 2 : 4; QByteArray data; data.resize(3 + time_size); @@ -171,8 +161,6 @@ QByteArray MsgPackPrivate::pack_qdatetime(const QVariant &variant) QVariant MsgPackPrivate::unpack_qdatetime(const QByteArray &data) { - if (data.size() == 1) - return QDateTime(); quint8 *p = (quint8 *)data.data(); QDate d = unpack_qdate_raw(p); QTime t = unpack_qtime_raw(p + 3, data.size() == 7); @@ -183,8 +171,6 @@ QVariant MsgPackPrivate::unpack_qdatetime(const QByteArray &data) QByteArray MsgPackPrivate::pack_qpoint(const QVariant &variant) { QPoint point = variant.toPoint(); - if (point.isNull()) - return QByteArray("\xc0", 1); QByteArray packed; MsgPackStream stream(&packed, QIODevice::WriteOnly); stream << point.x() << point.y(); @@ -193,8 +179,6 @@ QByteArray MsgPackPrivate::pack_qpoint(const QVariant &variant) QVariant MsgPackPrivate::unpack_qpoint(const QByteArray &data) { - if (data.size() == 1) - return QPoint(); MsgPackStream stream(data); qint32 x, y; stream >> x >> y; @@ -204,8 +188,6 @@ QVariant MsgPackPrivate::unpack_qpoint(const QByteArray &data) QByteArray MsgPackPrivate::pack_qsize(const QVariant &variant) { QSize size = variant.toSize(); - if (size.isNull()) - return QByteArray("\xc0", 1); QByteArray packed; MsgPackStream stream(&packed, QIODevice::WriteOnly); stream << size.width() << size.height(); @@ -214,8 +196,6 @@ QByteArray MsgPackPrivate::pack_qsize(const QVariant &variant) QVariant MsgPackPrivate::unpack_qsize(const QByteArray &data) { - if (data.size() == 1) - return QSize(); MsgPackStream stream(data); qint32 width, height; stream >> width >> height; @@ -225,8 +205,6 @@ QVariant MsgPackPrivate::unpack_qsize(const QByteArray &data) QByteArray MsgPackPrivate::pack_qrect(const QVariant &variant) { QRect rect = variant.toRect(); - if (rect.isNull()) - return QByteArray("\xc0", 1); QPoint pt1 = rect.topLeft(); QPoint pt2 = rect.bottomRight(); QByteArray packed; @@ -237,8 +215,6 @@ QByteArray MsgPackPrivate::pack_qrect(const QVariant &variant) QVariant MsgPackPrivate::unpack_qrect(const QByteArray &data) { - if (data.size() == 1) - return QRect(); MsgPackStream stream(data); qint32 x, y; stream >> x >> y; diff --git a/tests/qttypes/qttypes_test.cpp b/tests/qttypes/qttypes_test.cpp index 2d3bff2..f7ca125 100644 --- a/tests/qttypes/qttypes_test.cpp +++ b/tests/qttypes/qttypes_test.cpp @@ -23,7 +23,7 @@ void QtTypesTest::test_qtime() QByteArray packed = MsgPack::pack(t); QTime t2 = MsgPack::unpack(packed).toTime(); QVERIFY(t == t2); - QVERIFY(packed.size() == 3); // user, type, 0xc0 + QVERIFY(packed.size() == 1); t = QTime(12, 01, 01, 0); packed = MsgPack::pack(t); @@ -51,7 +51,7 @@ void QtTypesTest::test_qdate() QByteArray packed = MsgPack::pack(d); QDate d2 = MsgPack::unpack(packed).toDate(); QVERIFY(d == d2); - QVERIFY(packed.size() == 3); // user, type, 0xc0 + QVERIFY(packed.size() == 1); d = QDate(1234, 12, 1); packed = MsgPack::pack(d); @@ -70,7 +70,7 @@ void QtTypesTest::test_qpoint() QPoint pt; QByteArray packed = MsgPack::pack(pt); - QVERIFY(packed.size() == 3); + QVERIFY(packed.size() == 1); QPoint pt2 = MsgPack::unpack(packed).toPoint(); QVERIFY(pt == pt2); @@ -99,7 +99,7 @@ void QtTypesTest::test_qsize() QSize sz; QByteArray packed = MsgPack::pack(sz); -// QVERIFY(packed.size() == 3); +// QVERIFY(packed.size() == 1); QSize sz2 = MsgPack::unpack(packed).toSize(); QVERIFY(sz == sz2); @@ -121,7 +121,7 @@ void QtTypesTest::test_qrect() MsgPack::registerType(QMetaType::QRect, 81); QRect r; QByteArray packed = MsgPack::pack(r); - QVERIFY(packed.size() == 3); + QVERIFY(packed.size() == 1); QRect r2 = MsgPack::unpack(packed).toRect(); QVERIFY(r == r2);