Skip to content
Browse files

update rbenv recipe to be overrideable, update pivotal_logos to allow…

… overriding as well
  • Loading branch information...
1 parent 904eaaf commit 22678bdc3585eb4cbf68a1ab5d56fbb143ef7546 Brian Cunnie, Doc Ritezel and Matthew Kocher committed Mar 1, 2013
Showing with 55 additions and 47 deletions.
  1. +11 −9 attributes/rbenv.rb
  2. +43 −37 recipes/pivotal_logos.rb
  3. +1 −1 templates/default/pivotal_logos-dsimport.erb
View
20 attributes/rbenv.rb
@@ -1,9 +1,11 @@
-node.default["rbenv"]= {
- "rubies" => {
- "ree-1.8.7-2012.01" => {},
- "1.8.7-p352" => {},
- "1.9.2-p290" => {},
- "1.9.3-p125" => { :env => {"CC" => "clang"}}
- },
- "default_ruby" => "1.9.3-p125"
-}
+unless node["rbenv"]
+ node.default["rbenv"]= {
+ "rubies" => {
+ "ree-1.8.7-2012.01" => {},
+ "1.8.7-p352" => {},
+ "1.9.2-p290" => {},
+ "1.9.3-p125" => { :env => {"CC" => "clang"}}
+ },
+ "default_ruby" => "1.9.3-p125"
+ }
+end
View
80 recipes/pivotal_logos.rb
@@ -1,49 +1,55 @@
-run_unless_marker_file_exists("pivotal_logos") do
- # Let's make Pivotal Logos less intrusive; assume
- # they want the logos the first time soloist is run,
- # but afterwards leave the backgrounds & icons untouched
- # (using a marker file)
- #
- # BUGS: the screen-share-lock icon will NOT refresh to the
- # red dot until you log out & log in again.
- %w{Icons BackgroundsPrimary BackgroundsSecondary}.each do |dir|
- directory "#{WS_HOME}/Pictures/#{dir}" do
- mode "0755"
- owner WS_USER
- :recursive
- end
- end
+node.default["background_host"] = "http://cheffiles.pivotallabs.com"
+node.default["backgrounds"]["primary"] ||= %w{blue green orange violet}.map do |color|
+ "pivID_#{color}-1004x400.png"
+end
+node.default["backgrounds"]["secondary"] = ["BackToTheEdward.png"]
+node.default['login_icon'] = "tracker_dot"
- %w{blue green orange violet}.each do |color|
- filename="pivID_#{color}-1004x400.png"
- remote_file "#{WS_HOME}/Pictures/BackgroundsPrimary/#{filename}" do
- source "http://cheffiles.pivotallabs.com/#{filename}"
- owner WS_USER
- :create_if_missing
- end
+node['backgrounds'].each do |level, filenames|
+ directory "#{WS_HOME}/Pictures/Backgrounds#{level.capitalize}/#{filename}" do
+ mode "0755"
+ owner WS_USER
+ recursive true
end
- %w{BackToTheEdward.png}.each do |filename|
- remote_file "#{WS_HOME}/Pictures/BackgroundsSecondary/#{filename}" do
- source "http://cheffiles.pivotallabs.com/#{filename}"
+ filenames.each do |filename|
+ remote_file "#{WS_HOME}/Pictures/Backgrounds#{level.capitalize}/#{filename}" do
+ source "#{node['background_host']}/#{filename}"
owner WS_USER
- :create_if_missing
+ action :create_if_missing
end
end
+end
- %w{Pivot.jpeg tracker_dot.png tracker_dot.jpeg}.each do |filename|
- remote_file "#{WS_HOME}/Pictures/Icons/#{filename}" do
- filename = filename.gsub(" ","%20")
- source "http://cheffiles.pivotallabs.com/#{filename}"
- owner WS_USER
- :create_if_missing
- end
- end
+directory "#{WS_HOME}/Pictures/Icons" do
+ mode "0755"
+ owner WS_USER
+ recursive true
+end
- template "#{Chef::Config[:file_cache_path]}/jpegphoto.dsimport" do
- source "pivotal_logos-dsimport.erb"
+["#{node['login_icon']}.png", "#{node['login_icon']}.jpeg"].each do |filename|
+ remote_file "#{WS_HOME}/Pictures/Icons/#{filename}" do
+ filename = filename.gsub(" ","%20")
+ source "#{node['background_host']}/#{filename}"
owner WS_USER
+ action :create_if_missing
end
+end
+
+template "#{Chef::Config[:file_cache_path]}/jpegphoto.dsimport" do
+ source "pivotal_logos-dsimport.erb"
+ owner WS_USER
+end
+
+run_unless_marker_file_exists("pivotal_logos") do
+ # Let's make Pivotal Logos less intrusive; assume
+ # they want the logos the first time soloist is run,
+ # but afterwards leave the backgrounds & icons untouched
+ # (using a marker file)
+ #
+ # BUGS: the screen-share-lock icon will NOT refresh to the
+ # red dot until you log out & log in again.
+
# OpenDirectory has a specific format for JPEGPhoto (320x320 72dpi)
# easiest way to create one is to let Apple create it for you and
@@ -54,7 +60,7 @@
# ->set your picture to the one you want. Then:
# dscl . read /Users/$USER JPEGPhoto |tail +2 |xxd -r -p > #{Chef::Config[:file_cache_path]}/precious.jpeg
execute("dscl . delete /Users/#{WS_USER} JPEGPhoto")
- execute("dscl . create /Users/#{WS_USER} Picture \"#{WS_HOME}/Pictures/Icons/tracker_dot.png\"")
+ execute("dscl . create /Users/#{WS_USER} Picture \"#{WS_HOME}/Pictures/Icons/#{node['login_icon']}.png\"")
execute("dsimport #{Chef::Config[:file_cache_path]}/jpegphoto.dsimport /Local/Default M")
gem_package("plist")
View
2 templates/default/pivotal_logos-dsimport.erb
@@ -1,2 +1,2 @@
0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName externalbinary:dsAttrTypeStandard:JPEGPhoto
-<%=WS_USER%>:<%=WS_HOME%>/Pictures/Icons/tracker_dot.jpeg
+<%=WS_USER%>:<%=WS_HOME%>/Pictures/Icons/<%= node['login_icon'] %>.jpeg

0 comments on commit 22678bd

Please sign in to comment.
Something went wrong with that request. Please try again.