Skip to content

Commit

Permalink
Allow specifying extra gemfiles for a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Sep 20, 2024
1 parent b72d58f commit 3ed93cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
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 = [],
) {
$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 %>

0 comments on commit 3ed93cd

Please sign in to comment.