Skip to content
New issue

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

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

Already on GitHub? # to your account

Add test coverage for scripts #375

Merged
merged 5 commits into from
Jan 3, 2018
Merged

Conversation

floehopper
Copy link
Contributor

I've extracted the two custom scripts (bin/create_asset & bin/update_asset) into methods on a new class (CLI) and added a spec for that class.

In doing this I identified a slight flaw in the argument parsing of bin/update_asset which I have fixed. Other than that I've attempted to keep the code as unchanged as possible, albeit with some changes to make testing easier. This is not because I think the code is especially good, but because I wanted to minimise the chance of introducing bugs.

I did contemplate turning them into Rake tasks as we did in Manuals Publisher, but I realised that would mean updating the corresponding documentation.

Note that I've attempted as unchanged as possible while making
sufficient changes to allow for sensible testing.
Note that I've attempted as unchanged as possible while making
sufficient changes to allow for sensible testing.

In the course of doing this, I realised that there was a flaw in the
logic and the `filename` usage message would never be displayed, because
an IndexError would be raised when `ARGV.fetch(1)` was called when ARGV
is a single element array. I've fixed this and simplified the code in
doing so.
Consistency is good and in any case, I think this is simpler and easier
to understand.
Copy link
Contributor

@chrislo chrislo left a comment

Choose a reason for hiding this comment

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

Looks good!

I think at some point it'd be great if we added a small web UI to the app to allow people to manually manage assets instead of having to use the CLI.

@floehopper
Copy link
Contributor Author

floehopper commented Jan 3, 2018

I think at some point it'd be great if we added a small web UI to the app to allow people to manually manage assets instead of having to use the CLI.

Yes - I agree - see my comment here: #326 (comment). I've added #380 to capture the idea properly, because we've talked about it quite a few times and I couldn't see it in the list of issues.

@floehopper floehopper merged commit 8c8b87d into master Jan 3, 2018
@floehopper floehopper deleted the add-test-coverage-for-scripts branch January 3, 2018 12:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants