-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding basics for citelang gen (will be an action) (#9)
* adding basics for citelang gen (will be an action) Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
240 additions
and
112 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
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,27 @@ | ||
name: test-action | ||
|
||
on: | ||
pull_request: [] | ||
|
||
jobs: | ||
test-action: | ||
name: Test CiteLang | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install CiteLang | ||
run: pip install -e . | ||
|
||
- name: Test citelang gen | ||
uses: ./action/gen | ||
env: | ||
CITELANG_LIBRARIES_KEY: ${{ secrets.CITELANG_LIBRARIES_KEY }} | ||
with: | ||
package: citelang | ||
manager: pypi | ||
outfile: citelang.md | ||
|
||
- name: View generated file | ||
run: cat citelang.md |
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 |
---|---|---|
|
@@ -15,3 +15,4 @@ RUN pip install ipython | |
WORKDIR /code | ||
COPY . /code | ||
RUN pip install -e .[all] | ||
ENTRYPOINT ["citelang"] |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "citelang gen action" | ||
description: "Generate a citelang markdown for your package" | ||
inputs: | ||
manager: | ||
description: the name of the package manager | ||
required: true | ||
package: | ||
description: the name of the package | ||
required: true | ||
outfile: | ||
description: the name of the outputfile. | ||
required: true | ||
default: citelang.md | ||
args: | ||
description: additional arguments / parameters for citelang. | ||
required: false | ||
default: "" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: Install CiteLang | ||
shell: bash | ||
run: | | ||
which citelang | ||
retval=$? | ||
if [[ "${retval}" != "0" ]]; then | ||
pip install citelang | ||
fi | ||
- name: Generate CiteLang | ||
env: | ||
manager: ${{ inputs.manager }} | ||
package: ${{ inputs.package }} | ||
outfile: ${{ inputs.outfile }} | ||
args: ${{ inputs.args }} | ||
run: citelang gen ${manager} ${package} --outfile ${outfile} ${args} | ||
shell: bash |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
__author__ = "Vanessa Sochat" | ||
__copyright__ = "Copyright 2022, Vanessa Sochat" | ||
__license__ = "MPL 2.0" | ||
|
||
from citelang.main import Client | ||
import citelang.utils as utils | ||
|
||
|
||
def main(args, parser, extra, subparser): | ||
|
||
cli = Client(quiet=args.quiet, settings_file=args.settings_file) | ||
result = cli.gen( | ||
name=args.package[1], | ||
manager=args.package[0], | ||
use_cache=not args.no_cache, | ||
max_depth=args.max_depth, | ||
max_deps=args.max_depth, | ||
min_credit=args.min_credit, | ||
credit_split=args.credit_split, | ||
) | ||
|
||
if args.outfile: | ||
utils.write_file(result.render(), args.outfile) | ||
print("Saved to %s" % args.outfile) | ||
else: | ||
print(result.render()) |
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
Oops, something went wrong.