Skip to content

Commit

Permalink
[GENTOO] Cleaned up code by using the technique of reopening a resource
Browse files Browse the repository at this point in the history
- http://gist.github.com/382024
- Thanks to Mithrandir #chef @irc.freenode.net
  • Loading branch information
hosh committed May 4, 2010
1 parent 5583db4 commit 56b223b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 60 deletions.
8 changes: 4 additions & 4 deletions gentoo/definitions/portage_conf.rb
Expand Up @@ -83,9 +83,6 @@ def map_conf(conf_param, &block)
appends = map_conf(:appends) { |e| map_append(e) }
sources = params[:sources].uniq

# NOTE: Cheat, I don't know of a better way
Utils::Gentoo::PortageConfs << params[:name]
include_recipe 'gentoo::make_conf'
extra_portage_conf = "#{node[:gentoo][:extra_portage_conf_dir]}/#{params[:name]}"

template extra_portage_conf do
Expand All @@ -94,7 +91,10 @@ def map_conf(conf_param, &block)
mode '0755'
source 'extra_portage_conf.erb'
variables(:overrides => overrides, :appends => appends, :sources => sources)
notifies :run, resources(:execute => :reset_make_conf), :delayed
end

# http://gist.github.com/382024
# Append conf file directly into the conf
resources(:template => node[:gentoo][:extra_portage_conf]).variables[:sources] << params[:name]

end
22 changes: 0 additions & 22 deletions gentoo/libraries/portage_confs.rb

This file was deleted.

33 changes: 0 additions & 33 deletions gentoo/recipes/make_conf.rb

This file was deleted.

8 changes: 8 additions & 0 deletions gentoo/recipes/portage.rb
Expand Up @@ -70,3 +70,11 @@
not_if "test -d #{node[:gentoo][:extra_portage_conf_dir]}"
end

template node[:gentoo][:extra_portage_conf] do
owner 'root'
group 'root'
mode '0755'
source 'chef_make.conf.erb'
variables(:extra_portage_conf_dir => node[:gentoo][:extra_portage_conf_dir],
:sources => [])
end
2 changes: 1 addition & 1 deletion gentoo/templates/default/chef_make.conf.erb
@@ -1,5 +1,5 @@
# Generated by Chef - edit the recipes/attributes to change this file

<% @sources.each do |source| %>
<% @sources.uniq.each do |source| %>
source <%= @extra_portage_conf_dir %>/<%= source %>
<% end %>

0 comments on commit 56b223b

Please sign in to comment.