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

Move the guts of the CLI into a class for easier testing #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Fryguy
Copy link
Member

@Fryguy Fryguy commented Jun 18, 2024

Before: bundle exec rake  1.95s user 0.87s system 90% cpu 3.097 total
After:  bundle exec rake  0.67s user 0.25s system 94% cpu 0.981 total

I kept a singular test in there that ensures we are calling the exe/floe interface properly, but I'm really not sure if we need it or not. I'd be ok with dropping it. It would save an additional 0.13s knocking the time down to 0.85s or so

@kbrock Please review.
Fixes #218

# Create workflow/input pairs from the various combinations of paramaters
workflows_inputs =
if opts[:workflow_given]
Optimist.die("cannot specify both --workflow and bare workflows") if args.any?
Copy link
Member Author

@Fryguy Fryguy Jun 18, 2024

Choose a reason for hiding this comment

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

Now that this is in a class, these Optimist.die statements actually raise a SystemExit, which means this is kind of gross. I started refactoring to use an Optimist::Parser, but then this code started getting too complicated, so I left the PR as is to be a more pure moving of the code. We can follow up with better cleanup later if needed (or not - it's a CLI class after all).

@Fryguy Fryguy force-pushed the cli_to_class branch 2 times, most recently from 4da92c9 to 629e6e0 Compare June 18, 2024 20:09
@miq-bot
Copy link
Member

miq-bot commented Jun 18, 2024

Some comments on commit Fryguy@49daace

lib/floe/cli.rb

  • ⚠️ - 32 - Detected puts. Remove all debugging statements.
  • ⚠️ - 33 - Detected puts. Remove all debugging statements.

@miq-bot
Copy link
Member

miq-bot commented Jun 18, 2024

Checked commit Fryguy@49daace with ruby 2.7.8, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
3 files checked, 0 offenses detected
Everything looks fine. 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DEV] Improve performance of exe/floe specs
3 participants