Skip to content

Conversation

@mnbbrown
Copy link
Contributor

This will support other programs running business logic/setup before
starting the que locker and workers like so:

require 'que/command_line_interface'

#
# other business logic/setup 
#

exit_code =
  Que::CommandLineInterface.parse(
    args: ARGV.dup,
    output: $stdout,
  )

exit(exit_code)

@ZimbiX ZimbiX changed the title move CommandLineInterface to bin to lib Move CommandLineInterface from bin to lib Aug 26, 2022
Copy link
Member

@ZimbiX ZimbiX left a comment

Choose a reason for hiding this comment

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

Thanks for this =)

The tests are failing though =\

/work/spec/que/command_line_interface_spec.rb:7:in `<top (required)>': uninitialized constant Que::CommandLineInterface (NameError)

It passes with:

diff --git a/lib/que.rb b/lib/que.rb
index f54832c..d01866e 100644
--- a/lib/que.rb
+++ b/lib/que.rb
@@ -36,6 +36,7 @@ module Que
 
   require_relative 'que/connection'
   require_relative 'que/connection_pool'
+  require_relative 'que/command_line_interface'
   require_relative 'que/job_methods'
   require_relative 'que/job'
   require_relative 'que/job_buffer'

This will support other programs running other business logic before
starting the que locker and workers.

```
exit_code =
  Que::CommandLineInterface.parse(
    args: ARGV.dup,
    output: $stdout,
  )

exit(exit_code)
```
@mnbbrown
Copy link
Contributor Author

Thanks for this =)

The tests are failing though =\

/work/spec/que/command_line_interface_spec.rb:7:in `<top (required)>': uninitialized constant Que::CommandLineInterface (NameError)

It passes with:

diff --git a/lib/que.rb b/lib/que.rb
index f54832c..d01866e 100644
--- a/lib/que.rb
+++ b/lib/que.rb
@@ -36,6 +36,7 @@ module Que
 
   require_relative 'que/connection'
   require_relative 'que/connection_pool'
+  require_relative 'que/command_line_interface'
   require_relative 'que/job_methods'
   require_relative 'que/job'
   require_relative 'que/job_buffer'

I tried to avoid requiring command_line_interface in que.rb because it's it wasn't strictly part of the library. I've updated the PR to instead include it in the test. How do you feel about that approach?

@ZimbiX
Copy link
Member

ZimbiX commented Aug 26, 2022

I tried to avoid requiring command_line_interface in que.rb because it's it wasn't strictly part of the library. I've updated the PR to instead include it in the test. How do you feel about that approach?

Fair enough =)

@ZimbiX ZimbiX merged commit cd1ba93 into que-rb:master Aug 26, 2022
@mnbbrown mnbbrown deleted the move-cli-to-lib branch August 26, 2022 17:19
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.

2 participants