-
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.
Added Travis CI build configuration and scripts for generating docume…
…ntation and pdf file. README updated to include links to documentation, dependencies, dependent libraries and mystery files as well the self-link. Added TravisCI badge to README.
- Loading branch information
Showing
10 changed files
with
240 additions
and
9 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,15 @@ | ||
language: csharp | ||
sudo: required | ||
dist: xenial | ||
mono: latest | ||
dotnet: 2.2 | ||
before_install: | ||
- sudo apt-get install -y texlive texlive-lang-cyrillic texlive-latex-extra python-pygments ghostscript | ||
- export TRAVIS_REPO_NAME=$(echo "${TRAVIS_REPO_SLUG#*/}" | sed 's/.*/\u&/') | ||
- export SOURCE_BRANCH="master" | ||
script: | ||
- dotnet build -c Release | ||
- dotnet test -c Release | ||
after_success: | ||
- bash ./generate-pdf.sh | ||
- bash ./publish-docs.sh |
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
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
[![Build Status](https://travis-ci.com/linksplatform/Communication.svg?branch=master)](https://travis-ci.com/linksplatform/Communication) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c25f708dc08b4f7e8d96c671378bb1ad)](https://app.codacy.com/app/drakonard/Communication?utm_source=github.com&utm_medium=referral&utm_content=linksplatform/Communication&utm_campaign=Badge_Grade_Dashboard) | ||
[![CodeFactor](https://www.codefactor.io/repository/github/linksplatform/communication/badge)](https://www.codefactor.io/repository/github/linksplatform/communication) | ||
|
||
# Communication | ||
# [Communication](https://github.com/linksplatform/Communication) | ||
|
||
LinksPlatform's Platform.Communication Class Library. | ||
|
||
Namespace: Platform.Communication | ||
Namespace: [Platform.Communication](https://linksplatform.github.io/Communication/api/Platform.Communication.html) | ||
|
||
Forked from: [Konard/LinksPlatform/Platform/Platform.Communication](https://github.com/Konard/LinksPlatform/tree/0599b1bdad82c23ae80c890e63b309764b6997bd/Platform/Platform.Communication) | ||
|
||
NuGet package: [Platform.Communication](https://www.nuget.org/packages/Platform.Communication) | ||
NuGet package: [Platform.Communication](https://www.nuget.org/packages/Platform.Communication) | ||
|
||
## [Documentation](https://linksplatform.github.io/Communication) | ||
[PDF file](https://linksplatform.github.io/Communication/Platform.Communication.pdf) with code for e-readers. | ||
|
||
## Depend on | ||
* [Platform.Threading](https://github.com/linksplatform/Threading) | ||
* [Platform.Singletons](https://github.com/linksplatform/Singletons) | ||
|
||
## Dependent libraries | ||
* [Platform.Data.Triplets](https://github.com/linksplatform/Data.Triplets) | ||
|
||
## Mystery files | ||
* [.travis.yml](https://github.com/linksplatform/Communication/blob/master/.travis.yml) - Travis CI build configuration. | ||
* [docfx.json](https://github.com/linksplatform/Communication/blob/master/docfx.json) and [toc.yml](https://github.com/linksplatform/Communication/blob/master/toc.yml) - DocFX build configuration. | ||
* [format-document.sh](https://github.com/linksplatform/Communication/blob/master/format-document.sh) - script for formating `tex` file for generating PDF from it. | ||
* [format-csharp-files.py](https://github.com/linksplatform/Communication/blob/master/format-csharp-files.py) - script for formating single `.cs` file as a part of `tex` file. | ||
* [generate-pdf.sh](https://github.com/linksplatform/Communication/blob/master/generate-pdf.sh) - script that generates PDF with code for e-readers. | ||
* [publish-docs.sh](https://github.com/linksplatform/Communication/blob/master/publish-docs.sh) - script that publishes generated documentation and PDF with code for e-readers to `gh-pages` branch. | ||
* [push-nuget.bat](https://github.com/linksplatform/Communication/blob/master/push-nuget.bat) - Windows script for publishing current version of NuGet package. |
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,37 @@ | ||
{ | ||
"metadata": [ | ||
{ | ||
"src": [ | ||
{ | ||
"files": [ "**/*.sln" ], | ||
"exclude": [ "**/bin/**", "**/obj/**" ], | ||
"src": "" | ||
} | ||
], | ||
"dest": "obj/api" | ||
} | ||
], | ||
"build": { | ||
"content": [ | ||
{ | ||
"files": [ "**/*.yml" ], | ||
"src": "obj/api", | ||
"dest": "api" | ||
}, | ||
{ | ||
"files": [ "*.md", "toc.yml" ] | ||
} | ||
], | ||
"globalMetadata": { | ||
"_appTitle": "LinksPlatform's Platform.$TRAVIS_REPO_NAME Library", | ||
"_enableSearch": true, | ||
"_gitContribute": { | ||
"branch": "master" | ||
}, | ||
"_gitUrlPattern": "github" | ||
}, | ||
"markdownEngineName": "markdig", | ||
"dest": "_site", | ||
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ] | ||
} | ||
} |
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 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
reload(sys) | ||
sys.setdefaultencoding('utf-8') | ||
for line in sys.stdin.readlines(): | ||
line = line.strip() | ||
print "\\index{%s}" % (line.replace('_','\\_')) | ||
print "\\begin{section}{%s}" % (line.replace('_','\\_')) | ||
#print "\\inputminted[tabsize=2,breaklines,linenos=true]{csharp}{%s}" % (line) | ||
print "\\begin{minted}[tabsize=2,breaklines,breakanywhere,linenos=true,xleftmargin=7mm,framesep=4mm]{csharp}" | ||
f = open(line,"rt") | ||
c = "\n".join([x.strip("\n") for x in f.readlines()]) | ||
f.close() | ||
c = c.replace(u'\ufeff','') | ||
print c | ||
print "\\end{minted}" | ||
print "\\end{section}" | ||
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,53 @@ | ||
#!/bin/bash | ||
set -e # Exit with nonzero exit code if anything fails | ||
|
||
# Remove auto-generated code files | ||
find ./Platform.${TRAVIS_REPO_NAME}/obj -type f -iname "*.cs" -delete | ||
find ./Platform.${TRAVIS_REPO_NAME}.Tests/obj -type f -iname "*.cs" -delete | ||
|
||
# Download fvextra package | ||
wget https://raw.githubusercontent.com/gpoore/fvextra/cc1c0c5f7b92023cfec67084e2a87bdac520414c/fvextra/fvextra.sty | ||
|
||
echo """ | ||
\\documentclass[11pt,a4paper,fleqn]{report} | ||
\\usepackage[left=5mm,top=5mm,right=5mm,bottom=5mm]{geometry} | ||
\\textwidth=200mm | ||
\\usepackage[utf8]{inputenc} | ||
\\usepackage[T1]{fontenc} | ||
\\usepackage[T2A]{fontenc} | ||
\\usepackage{fvextra} | ||
\\usepackage{minted} | ||
\\usemintedstyle{vs} | ||
\\usepackage{makeidx} | ||
\\usepackage[columns=1]{idxlayout} | ||
\\makeindex | ||
\\renewcommand{\\thesection}{\\arabic{chapter}.\\arabic{section}} | ||
\\setcounter{chapter}{1} | ||
\\setcounter{section}{0} | ||
\\usepackage[tiny]{titlesec} | ||
\\titlespacing\\chapter{0mm}{0mm}{0mm} | ||
\\titlespacing\\section{0mm}{0mm}{0mm} | ||
\\DeclareUnicodeCharacter{221E}{\\ensuremath{\\infty}} | ||
\\DeclareUnicodeCharacter{FFFD}{\\ensuremath{ }} | ||
\\usepackage{fancyhdr} | ||
\\pagestyle{fancy} | ||
\\fancyhf{} | ||
\\fancyfoot[C]{\\thepage} | ||
\\renewcommand{\\headrulewidth}{0mm} | ||
\\renewcommand{\\footrulewidth}{0mm} | ||
\\renewcommand{\\baselinestretch}{0.7} | ||
\\begin{document} | ||
\\sf | ||
\\noindent{\\Large LinksPlatform's Platform.${TRAVIS_REPO_NAME} Class Library} | ||
""" | ||
|
||
# Project files | ||
find ./Platform.${TRAVIS_REPO_NAME} -type f -iname '*.cs' | sort -b | python format-csharp-files.py | ||
|
||
# Tests files | ||
find ./Platform.${TRAVIS_REPO_NAME}.Tests -type f -iname '*.cs' | sort -b | python format-csharp-files.py | ||
|
||
echo """ | ||
\\printindex | ||
\\end{document} | ||
""" |
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 @@ | ||
#!/bin/bash | ||
set -e # Exit with nonzero exit code if anything fails | ||
|
||
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify | ||
if [[ ( "$TRAVIS_PULL_REQUEST" != "false" ) || ( "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ) ]]; then | ||
echo "Skipping pdf generation." | ||
exit 0 | ||
fi | ||
|
||
# Generate tex file | ||
bash format-document.sh > document.tex | ||
|
||
# Generate pdf | ||
latex -shell-escape document.tex | ||
makeindex document | ||
latex -shell-escape document.tex | ||
dvipdf document.dvi document.pdf | ||
dvips document.dvi | ||
|
||
# Copy pdf to publish location (with be used in the next script) | ||
mkdir _site | ||
cp document.pdf _site/Platform.${TRAVIS_REPO_NAME}.pdf |
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,55 @@ | ||
#!/bin/bash | ||
set -e # Exit with nonzero exit code if anything fails | ||
|
||
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify | ||
if [[ ( "$TRAVIS_PULL_REQUEST" != "false" ) || ( "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ) ]]; then | ||
echo "Skipping documentation deploy." | ||
exit 0 | ||
fi | ||
|
||
# Settings | ||
TARGET_BRANCH="gh-pages" | ||
SHA=$(git rev-parse --verify HEAD) | ||
COMMIT_USER_NAME="linksplatform-docs" | ||
COMMIT_USER_EMAIL="[email protected]" | ||
REPOSITORY="github.com/linksplatform/${TRAVIS_REPO_NAME}" | ||
|
||
# Insert repository name into DocFX's configuration files | ||
sed -i "s/\$TRAVIS_REPO_NAME/${TRAVIS_REPO_NAME}/g" toc.yml | ||
sed -i "s/\$TRAVIS_REPO_NAME/${TRAVIS_REPO_NAME}/g" docfx.json | ||
|
||
# DocFX installation | ||
nuget install docfx.console | ||
mono $(echo ./*docfx.console.*)/tools/docfx.exe docfx.json | ||
|
||
# Clone the existing gh-pages for this repo into out/ | ||
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply) | ||
git clone https://$REPOSITORY out | ||
cd out | ||
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH | ||
cd .. | ||
|
||
# Clean out existing contents | ||
rm -rf out/**/* || exit 0 | ||
|
||
# Copy genereted docs site | ||
cp -r _site/* out | ||
|
||
cd out | ||
|
||
# Do not use index.md | ||
cp README.html index.html | ||
|
||
# Now let's go have some fun with the cloned repo | ||
git config user.name "$COMMIT_USER_NAME" | ||
git config user.email "$COMMIT_USER_EMAIL" | ||
git remote rm origin | ||
git remote add origin https://$COMMIT_USER_NAME:$TOKEN@$REPOSITORY.git | ||
|
||
# Commit the "changes", i.e. the new version. | ||
# The delta will show diffs between new and old versions. | ||
git add --all | ||
git commit -m "Deploy to GitHub Pages: ${SHA}" | ||
|
||
# Now that we're all set up, we can push. | ||
git push https://$COMMIT_USER_NAME:$TOKEN@$REPOSITORY.git $TARGET_BRANCH |
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
dotnet pack -c Release | ||
cd bin\Release\ | ||
nuget push -Source https://api.nuget.org/v3/index.json *.nupkg | ||
del *.nupkg | ||
del *.snupkg | ||
cd ..\.. | ||
dotnet nuget push -s https://api.nuget.org/v3/index.json **/*.nupkg | ||
del /s /q *.nupkg | ||
del /s /q *.snupkg |
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,5 @@ | ||
- name: Home | ||
href: README.md | ||
- name: API Documentation | ||
href: obj/api/ | ||
homepage: api/Platform.$TRAVIS_REPO_NAME.html |