Skip to content

Commit

Permalink
use separated files
Browse files Browse the repository at this point in the history
update docs for development
  • Loading branch information
rcmdnk committed Jan 5, 2023
1 parent ba2720f commit 02c348b
Show file tree
Hide file tree
Showing 13 changed files with 3,980 additions and 21 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ jobs:
echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}"
echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}"
echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}"
- name: Check coverage branch
id: checkCoverage
continue-on-error: true
if: ${{ steps.isMain.outcome == 'success' }}
run: |
git branch --list | grep -q coverage
- name: Create coverage branch
if: ${{ steps.isMain.outcome == 'success' && steps.checkCoverage.outcome != 'success'}}
run: |
git checkout --orphan coverage
git rm -rf .
touch README.md
git add README.md
git commit -m 'initial commit of coverage'
- name: Update Readme in coverage branch with Coverage Html
if: ${{ steps.isMain.outcome == 'success' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Brew-file
[![Test](https://github.com/rcmdnk/homebrew-file/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/homebrew-file/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/homebrew-file/badge/?version=latest)](http://homebrew-file.readthedocs.io/en/latest/?badge=latest)

[Test coverage](https://github.com/accelstars/apaf/tree/coverage)
[Test coverage](https://github.com/rcmdnk/homebrew-file/tree/coverage)

Brewfile manager for [Homebrew](http://brew.sh/) at OS X.

Expand Down
15 changes: 15 additions & 0 deletions combine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash


output=my_script.py
echo "#!/usr/bin/env python3" > $output
grep -E "(^from|^import)" src/brew_file/*.py|grep -v "from \."| cut -d ":" -f2|sort -u >> $output
cat src/brew_file/info.py|grep -vE "(^from|^import)" >> $output
cat src/brew_file/utils.py|grep -vE "(^from|^import)" >> $output
cat src/brew_file/brew_helper.py|grep -vE "(^from|^import)" >> $output
cat src/brew_file/brew_info.py|grep -vE "(^from|^import)" >> $output
cat src/brew_file/brew_file.py|grep -vE "(^from|^import)" >> $output
cat src/brew_file/main.py|grep -vE "(^from|^import)" >> $output

black $output
isort $output
46 changes: 46 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Development
===========

Preparation
-----------

To develop this package, use poetry.

$ pip install poetry
$ poetry install
$ poetry shell

Then, you can run ``brew-file`` command made from ``src`` directory.

Update scripts
--------------

Do not edit ``bin/brew-file`` directly.

Edit ``src/brew_file/*.py`` and run::

$ ./combine.sh


Test
----

Run::

$ pytest


Tests in ``tests`` will test ``bin/brew-file`` instead of files in ``src``, therefore run ``combine.sh`` before run tests.


Commit
------

When you run ``git commit``, ``pre-commit`` will run ``black`` and other linters.

Some of parts will be automatically fixed
and you need just rerun ``git commit``.

Some of parts will be remained and you need to fix them manually.

Fix them and rerun ``git commit``.
11 changes: 6 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Welcome to homebrew-file's documentation!

|BuildStatus|_ |CoverageStatus|_ |DocumentationStatus|_

.. |BuildStatus| image:: https://travis-ci.org/rcmdnk/homebrew-file.svg?branch=master
.. _BuildStatus: https://travis-ci.org/rcmdnk/homebrew-file

.. |CoverageStatus| image:: https://coveralls.io/repos/rcmdnk/homebrew-file/badge.png?branch=master
.. _CoverageStatus: https://coveralls.io/r/rcmdnk/homebrew-file?branch=master
.. |BuildStatus| image:: https://github.com/rcmdnk/homebrew-file/actions/workflows/test.yml/badge.svg
.. _BuildStatus: https://github.com/rcmdnk/homebrew-file/actions/workflows/test.yml

.. |DocumentationStatus| image:: https://readthedocs.org/projects/homebrew-file/badge/?version=latest
.. _DocumentationStatus: http://homebrew-file.readthedocs.io/en/latest/?badge=latest

.. _CoverageStatus: https://github.com/rcmdnk/homebrew-file/tree/coverage


Brewfile manager for `Homebrew <http://brew.sh/>`_ at OS X.

It is similar to
Expand All @@ -41,5 +41,6 @@ Contents:
settings
brew-wrap
completion
development
help
homebrew-file
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ bandit = {extras = ["toml"], version = "^1.7.4"}
pre-commit-hooks = "4.4.0"


[tool.poetry.scripts]
brew-file = "brew_file.main:main"

[tool.pytest.ini_options]
addopts = "-n auto"
testpaths = ["tests",]
Expand Down Expand Up @@ -61,7 +64,7 @@ profile = "black"
line_length = 79

[tool.mypy]
files = "bin/brew-file"
files = ["bin/brew-file", "src/**/*.py"]
ignore_missing_imports = true
scripts_are_modules = true
warn_unused_ignores = true
Expand Down
4 changes: 4 additions & 0 deletions src/brew_file/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .info import __version__
from .main import main

__all__ = ["__version__", "main"]

0 comments on commit 02c348b

Please sign in to comment.