forked from kgashok/makesite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add makesite: A simple static site generator
- Loading branch information
0 parents
commit 62d0aa1
Showing
31 changed files
with
1,631 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[report] | ||
exclude_lines = | ||
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
_site | ||
*.pyc | ||
__pycache__ | ||
.coverage | ||
htmlcov | ||
*.sw? | ||
.DS_Store | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
language: python | ||
|
||
python: | ||
- "2.7" | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
|
||
install: | ||
- pip install commonmark coverage coveralls | ||
|
||
script: | ||
- python -m unittest discover -bv | ||
- coverage run --branch --source=. -m unittest discover -bv | ||
- coverage report -m | ||
|
||
after_success: | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
===================== | ||
Copyright (c) 2018 Sunaina Pai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
site: | ||
./makesite.py | ||
|
||
serve: site | ||
cd _site && python -m SimpleHTTPServer 2> /dev/null || python3 -m http.server | ||
|
||
venv2: | ||
virtualenv ~/.venv/makesite | ||
echo . ~/.venv/makesite/bin/activate > venv | ||
. ./venv && pip install commonmark coverage | ||
|
||
venv: FORCE | ||
python3 -m venv ~/.venv/makesite | ||
echo . ~/.venv/makesite/bin/activate > venv | ||
. ./venv && pip install commonmark coverage | ||
|
||
test: FORCE | ||
. ./venv && python -m unittest -bv | ||
|
||
coverage: | ||
. ./venv && coverage run --branch --source=. -m unittest discover -bv; : | ||
. ./venv && coverage report -m | ||
. ./venv && coverage html | ||
|
||
clean: | ||
find . -name "__pycache__" -exec rm -r {} + | ||
find . -name "*.pyc" -exec rm {} + | ||
rm -rf .coverage htmlcov | ||
|
||
REV = cat /tmp/rev.txt | ||
example: | ||
# | ||
# Remove existing output directories. | ||
rm -rf _site /tmp/_site | ||
# | ||
# Create params.json for makesite-demo. | ||
echo '{ "base_path": "/makesite-demo", "site_url":' \ | ||
'"https://tmug.github.io/makesite-demo" }' > params.json | ||
# | ||
# Generate the website. | ||
. ./venv && ./makesite.py | ||
rm params.json | ||
# | ||
# Get current commit ID. | ||
git rev-parse --short HEAD > /tmp/rev.txt | ||
# | ||
# Write a README for makesite-demo repository. | ||
echo makesite.py demo > _site/README.md | ||
echo ================ >> _site/README.md | ||
echo This is the HTML/CSS source of an example static >> _site/README.md | ||
echo website auto-generated with [sunainapai/makesite][makesite] >> _site/README.md | ||
echo "([$$($(REV))][commit])". >> _site/README.md | ||
echo >> _site/README.md | ||
echo Visit "<https://tmug.github.io/makesite-demo>" to >> _site/README.md | ||
echo view the example website. >> _site/README.md | ||
echo >> _site/README.md | ||
echo [makesite]: https://github.com/sunainapai/makesite >> _site/README.md | ||
echo [commit]: https://github.com/sunainapai/makesite/commit/$$($(COMMIT)) >> _site/README.md | ||
echo [demo]: https://tmug.github.io/makesite-demo >> _site/README.md | ||
# | ||
# Publish makesite-demo. | ||
mv _site /tmp | ||
cd /tmp/_site && git init | ||
cd /tmp/_site && git add . | ||
cd /tmp/_site && git commit -m "Auto-generated with sunainapai/makesite - $$($(REV))" | ||
cd /tmp/_site && git remote add origin https://github.com/tmug/makesite-demo.git | ||
cd /tmp/_site && git log | ||
cd /tmp/_site && git push -f origin master | ||
|
||
loc: | ||
grep -vE '^[[:space:]]*#|^[[:space:]]*$$' makesite.py | wc -l | ||
|
||
FORCE: |
Oops, something went wrong.