-
Notifications
You must be signed in to change notification settings - Fork 104
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
(PDK-785) Add --puppet-version and --pe-version CLI options #448
Conversation
0f95455
to
c9b9255
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good Tim! Like you say, some of the internals will probably get revised as we go along but this seems like a great start.
lib/pdk/cli/test/unit.rb
Outdated
@@ -21,6 +22,11 @@ module PDK::CLI | |||
run do |opts, _args, _cmd| | |||
require 'pdk/tests/unit' | |||
|
|||
if opts[:'puppet-version'] && opts[:'pe-version'] | |||
PDK.logger.error _('You can not specify both --puppet-version and --pe-version at the same time.') | |||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this raise PDK::CLI::ExitWithError
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call
lib/pdk/cli/validate.rb
Outdated
@@ -32,6 +33,11 @@ module PDK::CLI | |||
exit 0 | |||
end | |||
|
|||
if opts[:'puppet-version'] && opts[:'pe-version'] | |||
PDK.logger.error _('You can not specify both --puppet-version and --pe-version at the same time.') | |||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this raise PDK::CLI::ExitWithError
instead?
The important bit: It adds the
--puppet-version
and--pe-version
options to thepdk validate
andpdk test unit
commands (it's a lot of changed lines for such a simple change, but this PR lays a lot of the groundwork for the rest of the puppet & ruby version switching behaviour).GEM_PATH
andGEM_HOME
have been extracted fromPDK::CLI::Exec
into a separate class, allowing them to be reused when scanning for available Puppet versions (and eventual ruby version switching).GEM_HOME
andGEM_PATH
for puppet gemspec files and parsing their contents.I would recommend not being too worried about the internals of
PDK::Util::PuppetVersion
andPDK::Util::RubyVersion
at this stage, as they will change as this feature evolves in further PRs.