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

Allow specifying extra gemfiles for a plugin #307

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
settings_template => 'katello_devel/katello.yaml.erb',
scm_revision => $katello_scm_revision,
manage_repo => $katello_manage_repo,
extra_gemfiles => ['gemfile.d/test.rb'],
}

katello_devel::plugin { 'theforeman/foreman_remote_execution':
Expand Down
4 changes: 4 additions & 0 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
#
# @param manage_repo
# Set to false if the plugin source repository is managed externally.
#
# @param extra_gemfiles
# Additional gemfiles a plugin needs added
define katello_devel::plugin (
Optional[String] $settings_template = undef,
Optional[String] $scm_revision = undef,
Boolean $manage_repo = true,
Array[String] $extra_gemfiles = [],
Copy link
Member

Choose a reason for hiding this comment

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

It has been a long time since I looked at puppet, here we are setting an empty array, then in https://github.com/theforeman/puppet-katello_devel/pull/307/files#diff-b55cd2d4fee4ad88a9e21316ff2015c5579e8ec9bef7bc0fe5253262905fa702R51 we are hard coding it, is that so Katello always has it and we can override it if needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a define which is meant to be a re-usable chunk of code, so we assume this is empty by default and plugin definitions can pass in values if they need.

) {
$split_array = split($name, '/')
$github_organization = $split_array[0]
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/katello_devel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
' :katello_applicability: true',
])
end

it do
verify_exact_contents(catalogue, '/home/vagrant/foreman/bundler.d/katello.local.rb', [
"gemspec :path => '../katello', :development_group => 'katello_dev', :name => 'katello'",
"eval_gemfile('/home/vagrant/katello/gemfile.d/test.rb')"
])
end
end

describe 'with modulestream_nodejs' do
Expand Down
6 changes: 3 additions & 3 deletions templates/plugin.local.rb.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gemspec :path => '../<%= scope['plugin'] %>', :development_group => '<%= scope['plugin'] %>_dev', :name => '<%= scope['plugin'] %>'
Dir['../<%= scope['plugin'] %>/gemfile.d/*.rb'].each do |file|
eval_gemfile(file)
end
<%- for gemfile in scope['extra_gemfiles'] %>
eval_gemfile('<%= scope['katello_devel::deployment_dir'] %>/<%= scope['plugin'] %>/<%= gemfile %>')
<%- end %>