Skip to content

Commit

Permalink
Merge branch 'main' into dccowan-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot authored Nov 19, 2021
2 parents b1db52f + a1a9f76 commit bf283bd
Show file tree
Hide file tree
Showing 45 changed files with 591 additions and 1,378 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: EM Website Build

on:
push:
branches:
- '*'
pull_request:
branches: [ main ]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest -s -v tests
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build pages
run: |
python _ext/build_contrib_case.py
make html
python _ext/copy_images.py
- name: GitHub Pages
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
build_dir: _build/html
fqdn: em.geosci.xyz
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 0 additions & 63 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# GeoSci.xyz EM

[![Build Status](https://travis-ci.org/geoscixyz/em.svg?branch=master)](https://travis-ci.org/geoscixyz/em) [![license](https://img.shields.io/badge/license-CC%20BY%204.0-blue.svg)](/LICENSE)
[![DOI](https://zenodo.org/badge/42916308.svg)](https://zenodo.org/badge/latestdoi/42916308)

This repository is the source for the open-textbook EM-GeoSci: https://em.geosci.xyz. This was the main textbook-resource used
Expand Down
14 changes: 0 additions & 14 deletions _ext/__init__.py

This file was deleted.

65 changes: 2 additions & 63 deletions _ext/autodoc.py → _ext/build_contrib_case.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shutil
import os
import json
import io
Expand All @@ -8,10 +7,10 @@
CONTRIB_INFO = ['affiliation', 'location', 'email', 'url', 'ORCID']
CASEHISTORY_INFO = ['citations', 'contributors', 'tags']

ORCID_URL = u'http://orcid.org/'
ORCID_URL = 'http://orcid.org/'

THIS_IS_AUTOGENERATED = (
u".. --------------------------------- ..\n"
".. --------------------------------- ..\n"
".. ..\n"
".. THIS FILE IS AUTO GENEREATED ..\n"
".. ..\n"
Expand All @@ -21,48 +20,6 @@
)


def make_formula_sheet():

# Create the examples dir in the docs folder.

EquationSheetDir = os.path.sep.join(
fName.split(os.path.sep)[:-2] + ['content', 'equation_bank']
)
files = os.listdir(EquationSheetDir)

rst = os.path.sep.join(
(fName.split(os.path.sep)[:-2] + ['content', 'equation_bank' + '.rst'])
)

out = u""".. _equation_bank:
{}
Equation Bank
=============
""".format(THIS_IS_AUTOGENERATED)

print('\nCreating: equation_bank.rst')
f = open(rst, 'w')
f.write(out)

for name in files:
out = """
- {}
.. include:: equation_bank/{}
""".format(name.rstrip('.rst'), name)
f.write(out)

f.close()

print('Done writing equation_bank.rst\n')


def make_contributorslist(fpath='contributors.json',
fout='contributors.rst',
contrib_info=CONTRIB_INFO):
Expand Down Expand Up @@ -335,28 +292,10 @@ def make_case_histories(fpath='content/case_histories/case_histories.json',
print('Done writing case_histories.rst')


# .. raw:: html

# <span id="{uid}"></span><h3><a class="referance internal" href="{source}/index.html" title="Go to the case history">{title}</a></h3>
# <div class="row">
# <div class="col-md-6">
# <a class="reference internal image-reference" href="../../_images/{thumbnail}"><img alt="../../_images/{thumbnail}" class="align-left" src="../../_images/{thumbnail}" style="width: 250px;" /></a>
# </div>
# <div class="col-md-6">
# <ul>
# {info_block}
# </ul>
# </div>
# <br>
# <br>
# </div>


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

make_formula_sheet()
make_contributorslist()
make_case_histories()
15 changes: 10 additions & 5 deletions _ext/copyImages.py → _ext/copy_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import shutil

def copyImages():

def copy_images():
# get relevant directories
cwd = os.getcwd()
contentdir = os.path.sep.join(cwd.split(os.path.sep) + ['content'])
Expand All @@ -27,9 +28,13 @@ def copyImages():
if root.endswith('images'):
for filename in fileList:
if filename not in imnames:
shutil.copy(os.path.join(root, filename),buildimagesdir)
return
print(f'copying in {filename}')
shutil.copy(os.path.join(root, filename), buildimagesdir)


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

if __name__ == "__main__":
copyImages()
copy_images()
39 changes: 0 additions & 39 deletions _ext/edit_on_github.py

This file was deleted.

34 changes: 0 additions & 34 deletions _ext/environmentSetup.py

This file was deleted.

2 changes: 1 addition & 1 deletion _ext/geosciapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import sphinx
from sphinx.locale import _
from sphinx.environment import NoUri
from sphinx.errors import NoUri
from sphinx.util.nodes import set_source_info
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
Expand Down
Loading

0 comments on commit bf283bd

Please sign in to comment.