Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add low-setup usage #146

Merged
merged 1 commit into from
Jan 4, 2019
Merged

✨ Add low-setup usage #146

merged 1 commit into from
Jan 4, 2019

Conversation

CLiu13
Copy link
Collaborator

@CLiu13 CLiu13 commented Jan 1, 2019

This adds the ability to use moban in an ad-hoc manner
without a config file. This also adds environment variables
as a fallback data source if the default/specified data files
do not exist.

Closes #133

Before raising the PR, here is a check list:

  1. have you written unit tests for your code changes?
  2. have you run "make format"?
  3. are you requesting to "dev"?
  4. have you updated the change log?
  5. do you think that you can understand your changes after 6 month?
    5.1) can someone else understand your changes without your explanation?
  6. are you pround of your code changes?
    6.1) do you have the feeling of achievement?
  7. please add your name and github link to contributors.rst in alphabetical order.

@CLiu13
Copy link
Collaborator Author

CLiu13 commented Jan 1, 2019

Working on writing tests and updating the proper documentation.

@CLiu13 CLiu13 force-pushed the low-setup-usage branch 3 times, most recently from 270f9c2 to b32bc8a Compare January 2, 2019 07:13
@codecov-io
Copy link

codecov-io commented Jan 2, 2019

Codecov Report

Merging #146 into dev will decrease coverage by 0.62%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff            @@
##              dev    #146      +/-   ##
=========================================
- Coverage   98.33%   97.7%   -0.63%     
=========================================
  Files          39      40       +1     
  Lines        1857    1918      +61     
=========================================
+ Hits         1826    1874      +48     
- Misses         31      44      +13
Impacted Files Coverage Δ
moban/reporter.py 98.38% <100%> (+0.2%) ⬆️
moban/_version.py 100% <100%> (ø) ⬆️
...sts/integration_tests/test_command_line_options.py 98.25% <100%> (-1.75%) ⬇️
tests/test_engine.py 100% <100%> (ø) ⬆️
moban/mobanfile.py 99.19% <100%> (-0.81%) ⬇️
tests/fixtures/environ_vars_as_data/test.template 100% <100%> (ø)
moban/plugins.py 91.44% <55.55%> (-4.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0880fb...d9e98b8. Read the comment docs.

moban/plugins.py Show resolved Hide resolved
@chfw
Copy link
Member

chfw commented Jan 2, 2019

An update on the documentation regarding this new usage would be helpful.

@CLiu13 CLiu13 force-pushed the low-setup-usage branch 8 times, most recently from 97f01a8 to baa4aaa Compare January 3, 2019 06:02
@CLiu13 CLiu13 changed the title [WIP] ✨ Add low-setup usage ✨ Add low-setup usage Jan 3, 2019
@jayvdb
Copy link
Member

jayvdb commented Jan 3, 2019

With a rule foo/bar.py: foo/bar.py.jj2

moban -o foo/bar.py -t foo/bar.py.jj2 does find the relevant entry in the config and only process that one entry.

However ... moban -t foo/bar.py.jj2 ...

Traceback (most recent call last):
  File "/home/jayvdb/.local/bin/moban", line 11, in <module>
    load_entry_point('moban', 'console_scripts', 'moban')()
  File "/home/jayvdb/projects/moban/moban/moban/main.py", line 36, in main
    count = handle_moban_file(moban_file, options)
  File "/home/jayvdb/projects/moban/moban/moban/main.py", line 121, in handle_moban_file
    mobanfile.handle_moban_file_v1(moban_file_configurations, options)
  File "/home/jayvdb/projects/moban/moban/moban/mobanfile.py", line 40, in handle_moban_file_v1
    target = extract_target(command_line_options)
  File "/home/jayvdb/projects/moban/moban/moban/mobanfile.py", line 149, in extract_target
    "Please specify a output file name for %s." % template
Exception: Please specify a output file name for foo/bar.py.jj2.

And moban -o foo/bar.py processes all rules. I think this is an important mode of operation, as people will often know the filename of the file they want updated, and may not remember which template it is.

And all of the above then process the copy:, which should be omitted if a specific rule was requested on the CLI. Note I've been think the copy: rules should be implemented as a builtin plugin template type 'copy', so that they are no longer a special set of targets.

This adds the ability to use moban in an ad-hoc manner
without a config file. This also adds environment variables
as a fallback data source if the default/specified data files
do not exist.

Closes moremoban#133
@CLiu13 CLiu13 requested review from chfw and jayvdb January 4, 2019 05:35
@chfw
Copy link
Member

chfw commented Jan 4, 2019

However, I think the code refactoring could be done in a separate PR. Letting this PR pending so long is not good.

Copy link
Member

@chfw chfw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code refactoring is required before releasing. Otherwise, functionalities are agreed.

moban/plugins.py Show resolved Hide resolved
@chfw chfw merged commit bb1eb42 into moremoban:dev Jan 4, 2019
CLiu13 added a commit to CLiu13/moban that referenced this pull request Jan 4, 2019
@CLiu13 CLiu13 mentioned this pull request Jan 4, 2019
CLiu13 added a commit to CLiu13/moban that referenced this pull request Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants