Skip to content

Commit

Permalink
more CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Nov 17, 2019
1 parent e2be3e8 commit f8eeea0
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c

os:
- linux

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

env:
matrix:
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.0
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.1
- PYTHON_VERSION=3.6 SPHINX_VERSION=2.1

- PYTHON_VERSION=3.7 SPHINX_VERSION=2.0
- PYTHON_VERSION=3.7 SPHINX_VERSION=2.1
- PYTHON_VERSION=3.7 SPHINX_VERSION=2.1

- PYTHON_VERSION=3.8 SPHINX_VERSION=latest

global:
- LOCALE=default
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ rebuild:
cd docs; watchmedo shell-command --patterns='*.rst' --command='ablog build' --recursive

test:
cd docs; ablog build -T
set -e; cd docs; ablog build -T; cd ..

test1:
cd docs; ablog build -b latex -T -d .doctrees -w _latex
set -e; cd docs; ablog build -b latex -T -d .doctrees -w _latex; cd ..

test2:
cd docs; ablog build -T -b json
set -e; cd docs; ablog build -T -b json; cd ..

test3:
cd docs; ablog build -T -b pickle
set -e; cd docs; ablog build -T -b pickle; cd ..

test4:
mkdir -p test; cd test; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.org" | ablog start; ablog build
set -e; mkdir -p test; cd test; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.org" | ablog start; ablog build; cd ..; rm -rf test

test5:
mkdir -p test; cd test; printf "ablog\nABlog\nABlog Team\nhttps://ablog.readthedocs.org" | ablog start; cd ablog; ablog build
set -e; mkdir -p testablog; printf "testablog\nABlog\nABlog Team\nhttps://ablog.readthedocs.org" | ablog start; cd testablog; ablog build; cd ../..; rm -rf test

tests: test test1 test2 test3 test4 test5
tests: test test1 test2 test3 test4 test5 demo
19 changes: 10 additions & 9 deletions ablog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import re
import datetime as dtmod
from datetime import datetime
from urlparse import urljoin
from unicodedata import normalize
from urllib.parse import urljoin
from collections.abc import Container

from docutils import nodes
Expand All @@ -25,7 +25,7 @@ def slugify(string):
Slugify *s*.
"""

string = normalize("NFKD", string)
string = normalize("NFKD", str(string))
string = re.sub(r"[^\w\s-]", "", string).strip().lower()
return re.sub(r"[-\s]+", "-", string)

Expand Down Expand Up @@ -108,11 +108,12 @@ def verify_fn(key, value, config):
("blog_default_location", None, True, require_config_str_or_list_lookup("blog_locations")),
("blog_languages", {}, True, require_config_full_name_link_dict()),
("blog_default_language", None, True, require_config_str_or_list_lookup("blog_languages")),
("fontawesome_link_cdn", False, True, require_config_type(str)),
("fontawesome_link_cdn", None, True),
("fontawesome_included", False, True, require_config_type(bool)),
("fontawesome_css_file", "", True, require_config_type(str)),
("post_date_format", "%d %B %Y", True),
("post_date_format_short", "%d %B", True),
("post_date_format", "%d %B %Y", True, require_config_type(str)),
("post_date_format_short", "%d %B", True, require_config_type(str)),
("post_auto_orphan", True, True, require_config_type(bool)),
("post_auto_image", 0, True),
("post_auto_excerpt", 1, True),
("post_redirect_refresh", 5, True),
Expand Down Expand Up @@ -350,7 +351,7 @@ def __str__(self):

def __repr__(self):

return str(self) + " <" + text_type(self.docname) + ">"
return str(self) + " <" + str(self.docname) + ">"

@property
def blog(self):
Expand Down Expand Up @@ -521,7 +522,7 @@ def __init__(self, blog, name, xref, path, reverse=False):

def __str__(self):

return text_type(self.name)
return str(self.name)

def __getitem__(self, name):

Expand Down Expand Up @@ -599,7 +600,7 @@ def __init__(self, catalog, label, name=None, href=None, path=None, page=0):

def __str__(self):

return text_type(self.name)
return str(self.name)

def __len__(self):

Expand All @@ -611,7 +612,7 @@ def __nonzero__(self):

def __unicode__(self):

return text_type(self.name)
return str(self.name)

def __iter__(self):

Expand Down
28 changes: 10 additions & 18 deletions ablog/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from http import server

from invoke import run
from watchdog.observers import Observer
from watchdog.tricks import ShellCommandTrick

import ablog

Expand Down Expand Up @@ -288,10 +290,6 @@ def ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns="*.r

if rebuild:

# from watchdog.watchmedo import observe_with
from watchdog.observers import Observer
from watchdog.tricks import ShellCommandTrick

patterns = patterns.split(";")
ignore_patterns = [os.path.join(website, "*")]
handler = ShellCommandTrick(
Expand Down Expand Up @@ -368,12 +366,7 @@ def ablog_post(filename, title=None, **kwargs):
type=str,
help="environment variable name storing GitHub access token",
)
@arg(
"--github-ssh",
dest="github_is_http",
action="store_true",
help="use ssh when cloning website",
)
@arg("--github-ssh", dest="github_is_http", action="store_true", help="use ssh when cloning website")
@arg(
"--push-quietly",
dest="push_quietly",
Expand Down Expand Up @@ -436,10 +429,9 @@ def ablog_deploy(
run("git pull", echo=True)
else:
run(
"git clone " + ("https://github.com/" if github_is_http else "[email protected]:") +
"{0}/{0}.github.io.git {1}".format(
github_pages, repodir
),
"git clone "
+ ("https://github.com/" if github_is_http else "[email protected]:")
+ "{0}/{0}.github.io.git {1}".format(github_pages, repodir),
echo=True,
)

Expand Down Expand Up @@ -469,12 +461,12 @@ def ablog_deploy(
run("git add -f .nojekyll")

# Check to see if anything has actually been committed
result = run('git diff --cached --name-status HEAD')
if (not result.stdout):
print('Nothing changed from last deployment')
result = run("git diff --cached --name-status HEAD")
if not result.stdout:
print("Nothing changed from last deployment")
return

commit = 'git commit -m "{}"'.format(message or 'Updates.')
commit = 'git commit -m "{}"'.format(message or "Updates.")
if push_force:
commit += " --amend"
run(commit, echo=True)
Expand Down
15 changes: 7 additions & 8 deletions ablog/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@
# 'Earth': ('The Blue Planet', 'https://en.wikipedia.org/wiki/Earth),
#}
# -- Blog Post Related --------------------------------------------------------
# post_date_format = '%%b %%d, %%Y'
# Format date for a post.
#post_date_format = '%%b %%d, %%Y'
# Number of paragraphs (default is ``1``) that will be displayed as an excerpt
# from the post. Setting this ``0`` will result in displaying no post excerpt
Expand Down Expand Up @@ -151,8 +150,8 @@
# is ``True``
# Link to `Font Awesome`_ at `Bootstrap CDN`_ and use icons in sidebars
# and post footers. Default: ``False``
fontawesome_link_cdn = True
# and post footers. Default: ``None``
#fontawesome_link_cdn = None
# Sphinx_ theme already links to `Font Awesome`_. Default: ``False``
#fontawesome_included = False
Expand Down Expand Up @@ -554,8 +553,8 @@ def ask_user(d):
if "path" in d:
print(bold("Selected root path: %s" % d["path"]))
else:
print("Enter the root path for your blog project.")
d["path"] = do_prompt("Root path for your project", ".", is_path)
print("Enter the root path for your blog project (path has to exist).")
d["path"] = do_prompt("Root path for your project (path has to exist)", ".", is_path)

while path.isfile(path.join(d["path"], "conf.py")) or path.isfile(
path.join(d["path"], "source", "conf.py")
Expand All @@ -564,7 +563,7 @@ def ask_user(d):
print(bold(w("Error: an existing conf.py has been found in the " "selected root path.")))
print("ablog start will not overwrite existing Sphinx projects.")
print("")
d["path"] = do_prompt("Please enter a new root path (or just Enter to exit)", "", is_path)
d["path"] = do_prompt("Please enter a new root path (or just Enter to exit)", ".", is_path)
if not d["path"]:
sys.exit(1)

Expand Down
3 changes: 0 additions & 3 deletions docs/manual/cross-referencing-blog-pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ Archive Example reStructured Text
============== ========================== ===============================
Posts :ref:`blog-posts` ``:ref:`blog-posts```
Drafts :ref:`blog-drafts` ``:ref:`blog-drafts```
Tag :ref:`tag-config` ``:ref:`tag-config```
Author :ref:`author-ahmet` ``:ref:`author-ahmet```
Archive :ref:`archive-2014` ``:ref:`archive-2014```
Language :ref:`language-en` ``:ref:`language-en```
Location :ref:`location-pittsburgh` ``:ref:`location-pittsburgh```
Category :ref:`category-manual` ``:ref:`category-manual```
============== ========================== ===============================

Following archive pages list all posts by grouping them:
Expand Down
7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ packages = find:
include_package_data = True
setup_requires = setuptools_scm
install_requires =
werkzeug
sphinx>=2.0
alabaster
invoke
python-dateutil
sphinx-automodapi
sphinx>=2.0
watchdog
werkzeug

[options.extras_require]
notebook =
nbsphinx
ipython
nbsphinx

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit f8eeea0

Please sign in to comment.